1) JUNIT Templates
a) Junit before method
${: import (org.junit.Before)} @Before public void setUp() { ${cursor} } |
b) Junit after method
${: import (org.junit.After)} @After public void tearDown() { ${cursor} } |
c) Junit before class
${: import (org.junit.BeforeClass)} @BeforeClass public static void oneTimeSetUp() { // one-time initialization code ${cursor} } |
d) Junit after class
${: import (org.junit.AfterClass)} @AfterClass public static void oneTimeTearDown() { // one-time cleanup code ${cursor} }
2) Logging Templates
The templates below are useful for creating a logger and logging messages. I use SLF4J, but they could easily be tweaked to use any other logging framework.
a) Create a new Logger
b) Check Debug scope before putting debug log
c) Log info level statement
d) Log the error
e) Log error and throw exception
|