1) JUNIT Templates
a) Junit before method
${:import (org.junit.Before)} @Beforepublic void setUp() { ${cursor}} |
b) Junit after method
${:import (org.junit.After)} @Afterpublic void tearDown() { ${cursor}} |
c) Junit before class
${:import (org.junit.BeforeClass)} @BeforeClasspublic static void oneTimeSetUp() { // one-time initialization code ${cursor}} |
d) Junit after class
${:import (org.junit.AfterClass)} @AfterClasspublic 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
|
No comments:
Post a Comment