コード例 #1
0
 @Test
 public void testClear() {
   list.add("A");
   list.add("b");
   list.add("e");
   list.clear();
   assertTrue(list.size() == 0);
 }
コード例 #2
0
 @Test
 public void testContainsObjectInArray() {
   list.add("One");
   list.add("Two");
   assertTrue(list.contains("One"));
   assertTrue(list.contains("Two"));
   assertFalse(list.contains("Zero"));
 }
コード例 #3
0
 @Test
 public void testRemoveByObjectFirstElement() {
   list.add("Ann");
   list.add("Olga");
   list.add("Kate");
   list.remove("Ann");
   assertTrue(list.size() == 2);
   assertEquals("Olga", list.get(0));
   assertEquals("Kate", list.get(1));
 }
コード例 #4
0
 @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"));
 }
コード例 #5
0
 @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));
 }
コード例 #6
0
 @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));
 }
コード例 #7
0
 @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));
 }
コード例 #8
0
 @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));
 }
コード例 #9
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));
 }
コード例 #10
0
 @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));
 }
コード例 #11
0
 @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));
 }
コード例 #12
0
 @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));
 }
コード例 #13
0
 @Test
 public void testIsEmpty() {
   assertTrue(list.isEmpty());
   list.add("One");
   assertFalse(list.isEmpty());
 }
コード例 #14
0
 @Test
 public void testRemoveByIndexSingleElement() {
   list.add("Olga");
   list.remove(0);
   assertTrue(list.size() == 0);
 }