├── .gitignore
├── LICENSE
├── README.md
├── java-8-templates.xml
├── junit-templates.xml
└── mockito-templates.xml
/.gitignore:
--------------------------------------------------------------------------------
1 | .DS_Store
2 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | (C) Copyright (c) 2016 Tasktop Technologies and others.
2 |
3 | Licensed under the Apache License, Version 2.0 (the "License");
4 | you may not use this file except in compliance with the License.
5 | You may obtain a copy of the License at
6 |
7 | http://www.apache.org/licenses/LICENSE-2.0
8 |
9 | Unless required by applicable law or agreed to in writing, software
10 | distributed under the License is distributed on an "AS IS" BASIS,
11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | See the License for the specific language governing permissions and
13 | limitations under the License.
14 |
15 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # eclipse-templates
2 | A set of [Eclipse templates](http://help.eclipse.org/juno/index.jsp?topic=%2Forg.eclipse.cdt.doc.user%2Ftasks%2Fcdt_t_imp_code_temp.htm) to increase productivity used at [Tasktop Technologies](http://www.tasktop.com/).
3 |
4 | All files in this repository is published under terms of the [Apache 2.0 Software License](http://www.apache.org/licenses/LICENSE-2.0).
--------------------------------------------------------------------------------
/java-8-templates.xml:
--------------------------------------------------------------------------------
1 | () -> {${cursor}}${lambdaParameter:newName(parameter)} -> {${cursor}}${lambdaParameter:newName(input)} -> {return ${result};}${lambdaParameter:newName(parameter)} -> {return ${matches:var(boolean)};}() -> { return ${cursor}}${:import(java.util.Optional)}
2 | Optional.of(${of});${:import(java.util.Optional)}
3 | Optional.ofNullable(${of});
--------------------------------------------------------------------------------
/junit-templates.xml:
--------------------------------------------------------------------------------
1 | @Rule${imp:import(org.junit.rules.ExpectedException,org.junit.Rule)}
2 | public ExpectedException thrown = ExpectedException.none();@${testType:newType(org.junit.Before)}
3 | public void setUp() {
4 | ${cursor}
5 | }@${testType:newType(org.junit.After)}
6 | public void tearDown() {
7 | ${cursor}
8 | }@${testType:newType(org.junit.Test)}
9 | public void test${Name}() {
10 | ${cursor}
11 | }
--------------------------------------------------------------------------------
/mockito-templates.xml:
--------------------------------------------------------------------------------
1 | ${a:importStatic(org.mockito.Mockito.doAnswer)}${b:import(org.mockito.stubbing.Answer, org.mockito.invocation.InvocationOnMock, java.lang.Throwable)}doAnswer( new Answer<${T}>() {
2 | public ${T} answer( InvocationOnMock invocation ) throws Throwable {
3 | ${cursor}
4 | return null;
5 | }
6 | } ).when( ${mock} ).${call};${a:importStatic(org.mockito.Mockito.doAnswer)}${b:import(org.mockito.stubbing.Answer, org.mockito.invocation.InvocationOnMock, java.lang.Throwable)}doAnswer( new Answer<${T}>() {
7 | public ${T} answer( InvocationOnMock invocation ) throws Throwable {
8 | ${ArgType} ${argument} = ( ${ArgType} )invocation.getArguments()[ ${i} ];
9 | ${cursor}
10 | return null;
11 | }
12 | } ).when( ${mock} ).${call};${:importStatic(org.mockito.Mockito.doReturn)}doReturn( ${value} ).when( ${mock} ).${call};${:importStatic(org.mockito.Mockito.doThrow)}doThrow( ${throwable} ).when( ${mock} ).${call};${a:import(org.mockito.ArgumentCaptor)}ArgumentCaptor<${Type}> ${captor} = ${b:importStatic(org.mockito.ArgumentCaptor.forClass)}forClass( ${Type}.class );${a:importStatic(org.mockito.Mockito.when)}${b:import(org.mockito.stubbing.Answer, org.mockito.invocation.InvocationOnMock, java.lang.Throwable)}when( ${mock}.${call} ).thenAnswer( new Answer<${T}>() {
13 | public ${T} answer( InvocationOnMock invocation ) throws Throwable {
14 | ${cursor}
15 | return null;
16 | }
17 | } );${a:importStatic(org.mockito.Mockito.when)}${b:import(org.mockito.stubbing.Answer, org.mockito.invocation.InvocationOnMock, java.lang.Throwable)}when( ${mock}.${call} ).thenAnswer( new Answer<${T}>() {
18 | public ${T} answer( InvocationOnMock invocation ) throws Throwable {
19 | ${ArgType} ${argument} = ( ${ArgType} )invocation.getArguments()[ ${i} ];
20 | ${cursor}
21 | return null;
22 | }
23 | } );${:importStatic(org.mockito.Mockito.when)}when( ${mock}.${call} ).thenReturn( ${value} );${:importStatic(org.mockito.Mockito.when)}when( ${mock}.${call} ).thenThrow( ${throwable} );
--------------------------------------------------------------------------------