Skip to content

Instantly share code, notes, and snippets.

@nekman
Created October 8, 2012 10:27
Show Gist options
  • Select an option

  • Save nekman/3851854 to your computer and use it in GitHub Desktop.

Select an option

Save nekman/3851854 to your computer and use it in GitHub Desktop.
JUnit code template
package ${enclosing_package};
/**
* Eclipse JUnit template that imports
* Mockito + common asserts and matchers.
*
* Import by select: Window > Preferences > Java > Editor > Templates > New...
*
*/
import static junit.framework.Assert.*;
import static org.hamcrest.CoreMatchers.*;
import static org.hamcrest.core.Is.is;
import static org.hamcrest.core.IsNot.*;
import static org.junit.Assert.*;
import static org.mockito.Mockito.*;
import static org.mockito.Matchers.*;
import org.junit.*;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
public class ${enclosing_type} {
@Before
public void setup() {
//TODO:
}
@After
public void tearDown() {
//TODO:
}
@Test
public void shouldDoDummyStuff() {
${cursor}
//TODO:
final Object o = mock(Object.class);
assertThat(o, is(notNullValue()));
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment