Junit Example
From RifidiWiki
Junit 4.x may be tricky at first to build test suites or regular tests, but they are pretty easy to write once one gains a hang of it.
Here is an example of a regular test class.
import org.junit.AfterClass;
import org.junit.Assert;
import org.junit.BeforeClass;
import org.junit.Test;
public class Example {
@BeforeClass
public static void setUpBeforeClass() throws Exception {
/* things to do before running tests */
}
@AfterClass
public static void tearDownAfterClass() throws Exception {
/* things to do after running tests */
}
@Test
public void testExample1() {
}
@Test
public void testExample2() {
}
}