@Test
The annotation @Test identifies that a method is a test method.
Denotes a test method. Can be used with expected to assert expected results on the object under test.
@Before
Will execute the method before each test. This method can prepare the
test environment (e.g. read input data, initialize the class).
Run before each test method is run i.e. do a setup
@After
Run after each test method is run i.e. do a teardown
Will execute the method after each test. This method can cleanup the
test environment (e.g. delete temporary data, restore defaults).
@BeforeClass
Run before all the tests in a class (Runs once for all of the tests)
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
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.
Run after all the tests in a class (Runs once for all of the tests)
@Parameters
Allows you to run the same test with different data by defining the data
parameters. @Parameters have to return List[], and the parameter will
pass into class constructor as argument.
@RunWith
Exclusively tells the class that the Junit Test Case uses Parameterized runner
When a class is annotated with @RunWith or extends a class annotated
with @RunWith, JUnit will invoke the class it references to run the
tests in that class instead of the runner built into JUnit.