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

Rapid js + css development

BackgroundLast time I had some work to do in OSGi web module written in Spring MVC. If we have application splitted to well-designed modules, back-end development in this framework run in OSGi environment is quite fast because after some modification w...

Agile Skills Project at my company

Unfulfilled programmers Erich Fromm, a famous humanist, philosopher and psychologist strongly believed that people are basically good. If he was right, then either our society is a mind-breaking dystopia or we have a great misfortune of working i... Unfulfilled programmers Erich Fromm, a famous humanist, philosopher and psychologist strongly believed that people are basically good. If he was right, then either our society is a mind-breaking dystopia or we have a great misfortune of working i...