@Test public void testClear() { list.add("A"); list.add("b"); list.add("e"); list.clear(); assertTrue(list.size() == 0); }
@Test public void testAdd() { list.add("Ann"); assertTrue(list.size() == 1); list.add("Olga"); assertTrue(list.size() == 2); assertEquals("Ann", list.get(0)); assertEquals("Olga", list.get(1)); }
@Test public void testRemoveByObjectMiddleElement() { list.add("Olga"); list.add("Kate"); list.add("Ira"); list.remove("Kate"); assertTrue(list.size() == 2); assertEquals("Olga", list.get(0)); assertEquals("Ira", list.get(1)); }
@Test public void testAddingOnZeroIndex() { list.add("Artem"); assertTrue(list.size() == 1); assertEquals("Artem", list.get(0)); list.add("Chika", 0); assertTrue(list.size() == 2); assertEquals("Chika", list.get(0)); assertEquals("Artem", list.get(1)); }
@Test public void testLastIndexOf() { list.add("One"); list.add("Two"); list.add("One"); list.add("Two"); assertEquals(2, list.lastIndexOf("One")); assertEquals(3, list.lastIndexOf("Two")); assertEquals(-1, list.indexOf("Four")); }
@Test public void testRemoveByIndexLastElement() { list.add("Ann"); list.add("Olga"); list.add("Ira"); list.remove(2); assertTrue(list.size() == 2); assertEquals("Ann", list.get(0)); assertEquals("Olga", list.get(1)); }
@Test public void testAddOnNextIndex() { list.add("Artem"); list.add("Chika"); assertTrue(list.size() == 2); list.add("Sasha", 2); assertTrue(list.size() == 3); assertEquals("Artem", list.get(0)); assertEquals("Chika", list.get(1)); assertEquals("Sasha", list.get(2)); }
@Test public void testGetObjectByIndex() { list.add("Artem"); list.add("Chika"); list.add("Sasha"); list.add("Tolik"); list.add("Katya"); list.add("Tim"); assertEquals("Artem", list.get(0)); assertEquals("Chika", list.get(1)); assertEquals("Sasha", list.get(2)); assertEquals("Tolik", list.get(3)); assertEquals("Katya", list.get(4)); assertEquals("Tim", list.get(5)); }
@Test public void testAddOIndex() { list.add("Artem"); list.add("Chika"); list.add("Sasha"); list.add("Katya"); list.add("Tim"); list.add("Tolik", 3); assertTrue(list.size() == 6); assertEquals("Artem", list.get(0)); assertEquals("Chika", list.get(1)); assertEquals("Sasha", list.get(2)); assertEquals("Tolik", list.get(3)); assertEquals("Katya", list.get(4)); assertEquals("Tim", list.get(5)); }
@Test public void testRemoveByIndexMiddleElement() { list.add("Artem"); list.add("Chika"); list.add("Sasha"); list.add("Tolik"); list.add("Tim"); list.add("Katya"); list.remove(4); assertTrue(list.size() == 5); assertEquals("Artem", list.get(0)); assertEquals("Chika", list.get(1)); assertEquals("Sasha", list.get(2)); assertEquals("Tolik", list.get(3)); assertEquals("Katya", list.get(4)); }
@Test public void testContainsObjectInArray() { list.add("One"); list.add("Two"); assertTrue(list.contains("One")); assertTrue(list.contains("Two")); assertFalse(list.contains("Zero")); }
@Test public void testSetValueOnIndex() { list.add("Ann"); list.add("Iren"); list.add("Olga"); list.add("Helen"); list.add("Marina"); list.add("Billie"); list.set("Cat", 0); list.set("Dog", 1); list.set("Bird", 2); list.set("Kittie", 3); list.set("Doggy", 4); list.set("Birdy", 5); assertEquals("Cat", list.get(0)); assertEquals("Dog", list.get(1)); assertEquals("Bird", list.get(2)); assertEquals("Kittie", list.get(3)); assertEquals("Doggy", list.get(4)); assertEquals("Birdy", list.get(5)); }
@Test public void testIsEmpty() { assertTrue(list.isEmpty()); list.add("One"); assertFalse(list.isEmpty()); }
@Test public void testRemoveByIndexSingleElement() { list.add("Olga"); list.remove(0); assertTrue(list.size() == 0); }