@Test public void testEmpty() throws Exception { subject.add("cows"); subject.add("sheep"); subject.add("ducks"); subject.add("mice"); subject.add("dogs"); subject.add("cats"); subject.add("birds"); subject.clear(); boolean nothing = subject.isEmpty(); Assert.assertTrue(nothing); subject.add("birds"); nothing = subject.isEmpty(); Assert.assertFalse(nothing); }
@Test public void testClear() throws Exception { subject.add("cows"); subject.add("sheep"); subject.add("ducks"); subject.add("mice"); subject.add("dogs"); subject.add("cats"); subject.add("birds"); subject.clear(); int size = subject.size(); Assert.assertEquals(0, size); subject.add("birds"); size = subject.size(); Assert.assertEquals(1, size); }