public void empty() {
/* test case 1*/
Collection collection = new ArrarList();
assertTrue(collection.isEmpty());
}
@Before 和 @After 就是setUp()和tearDown()的替代。
public void runBeforeEveryTest() {
simpleMath = new SimpleMath();
}
@After
public void runAfterEveryTest() {
simpleMath = null;
}
public static void runBeforeClass() {
// run for one time before all test cases
}
@AfterClass
public static void runAfterClass() {
// run for one time after all test cases
}
/* test case 2*/
ArrayList emptyList = new ArrayList();
try {
Object o = emptyList.get(0);
fail("Should raise an IndexOutOfBoundsException");
} catch (IndexOutOfBoundsException expected) {
assertTrue(true);
}
}
public void testCase2() {
/* test case 2*/
ArrayList emptyList = new ArrayList();
Object o = emptyList.get(0);
}
@Test
public void multiplication() {
assertEquals(15, simpleMath.multiply(3, 5));
}
public void remoteBaseRelativeResolutionWithDirectory()
throws IOException, ParsingException {
readBuilder.parse("config.xml");
}
public void listEquality() {
List<Integer> expected = new ArrayList<Integer>();
expected.add(5);
List<Integer> actual = new ArrayList<Integer>();
actual.add(5);
assertEquals(expected, actual);
}
return new JUnit4TestAdapter(SimpleMathTest.class);
}
















