Some of the annotations provided by JUnit are as follows :
* @Test
: This annotation over a public method of void return type can be run as a test case. This is a replacement of the org.junit.TestCase annotation.
* @Before
: This is used when we want to execute the preconditions or any initialisation based statements before running every test case.
* @BeforeClass
: This is used when we want to execute statements before all test cases. The statements may include test connections, common setup initialisation etc.
* @After
: This is used when we want to execute statements after each test case. The statements can be resetting the variables, deleting extra memory used etc.
* @AfterClass
: This is used when certain statements are required to be executed after all the test cases of the class are run. Releasing resource connections post-execution of test cases is one such example.
* @Ignores
: This is used when some statements are required to be ignored during the execution of test cases.
* @Test(timeout=x)
: This is used when some timeout during the execution of test cases is to be set. The value of x is an integer that represents the time within which the tests have to be completed.
* @Test(expected=NullPointerException.class)
: This is used when some exception thrown by the target method needs to be asserted.