Using Eclipse snippets for faster JUnit test creation (with Mockito!)

I’m using this snippet to create a template of new unit test method supporting BDD mockito tests. This is a good example for adding static imports to a class from snippets.@${testType:newType(org.junit.Test)}public void should${testname}() { ${staticIm…I’m using this snippet to create a template of new unit test method supporting BDD mockito tests. This is a good example for adding static imports to a class from snippets.@${testType:newType(org.junit.Test)}public void should${testname}() { ${staticIm…

I’m using this snippet to create a template of new unit test method supporting BDD 

mockito tests. This is a good example for adding static imports to a class from snippets.

@${testType:newType(org.junit.Test)}
public void should${testname}() {
${staticImport:importStatic('org.mockito.BDDMockito.*', 'org.mockito.Matchers.*', 'org.mockito.Mockito.*', 'org.junit.Assert.*')}// given

// when ${cursor} // then } The result is astonishing ;)

import static org.mockito.BDDMockito.*;
import static org.mockito.Matchers.*;
import static org.mockito.Mockito.*;
import static org.junit.Assert.*;

(…) @Test public void shouldTestSomething() { // given // when CURSOR_LANDS_HERE // then }

You May Also Like