Junit Annotations With Description

@Test 
public void method()
The annotation @Test identifies that a method is a test method.

@Before
public void method()
Will execute the method before each test. This method can prepare the test environment (e.g. read input data, initialize the class).

@After
public void method()
Will execute the method after each test. This method can cleanup the test environment (e.g. delete temporary data, restore defaults).

@BeforeClass
public void method()
Will execute the method once, before the start of all tests. This can be used to perform time intensive activities, for example to connect to a database.

@AfterClass
public void method()
Will execute the method once, after all tests have finished. This can be used to perform clean-up activities, for example to disconnect from a database.

@Ignore
Will ignore the test method. This is useful when the underlying code has been changed and the test case has not yet been adapted. Or if the execution time of this test is too long to be included.

@Test (expected = Exception.class)
Fails, if the method does not throw the named exception.

@Test(timeout=100)
Fails, if the method takes longer than 100 milliseconds.