コード例 #1
0
 @Test
 public void testSerialize() {
   Data data = serializationService.toData(list);
   List<Integer> deserializedList = serializationService.toObject(data);
   int size = list.size();
   assertEquals(size, deserializedList.size());
   for (int i = 0; i < size; i++) {
     assertEquals(list.get(i), deserializedList.get(i));
   }
 }
コード例 #2
0
 @Test
 public void testContainsAll_False() {
   ArrayList<Integer> integers = new ArrayList<Integer>();
   integers.add(randomInt());
   integers.add(randomInt() + SIZE);
   assertFalse(list.containsAll(integers));
 }
コード例 #3
0
 @Test(expected = UnsupportedOperationException.class)
 public void testRetainAll() {
   ArrayList<Integer> integers = new ArrayList<Integer>();
   integers.add(randomInt());
   integers.add(randomInt());
   list.retainAll(integers);
 }
コード例 #4
0
 @Test(expected = UnsupportedOperationException.class)
 public void testAddAll_WithIndex() {
   ArrayList<Integer> integers = new ArrayList<Integer>();
   integers.add(randomInt());
   integers.add(randomInt());
   list.addAll(randomInt(), integers);
 }
コード例 #5
0
 @Test
 public void testSubList() {
   int i = RandomPicker.getInt(SIZE / 2);
   List<Integer> subList = list.subList(i, i + SIZE / 2);
   for (int integer : subList) {
     assertEquals(i++, integer);
   }
 }
コード例 #6
0
 @Test
 public void testListIterator() {
   int i = randomInt();
   ListIterator<Integer> listIterator = list.listIterator(i);
   while (listIterator.hasNext()) {
     assertEquals(i++, (int) listIterator.next());
   }
   while (listIterator.hasPrevious()) {
     assertEquals(--i, (int) listIterator.previous());
   }
 }
コード例 #7
0
 @Test(expected = UnsupportedOperationException.class)
 public void testListIterator_Set() {
   ListIterator<Integer> listIterator = list.listIterator();
   listIterator.next();
   listIterator.set(randomInt());
 }
コード例 #8
0
 @Test
 public void testLastIndexOf() {
   int i = randomInt();
   assertEquals(i, list.indexOf(i));
 }
コード例 #9
0
 @Test(expected = UnsupportedOperationException.class)
 public void testRemove_WithIndex() {
   list.remove(randomInt());
 }
コード例 #10
0
 @Test
 public void testContains_True() {
   assertTrue(list.contains(randomInt()));
 }
コード例 #11
0
 @Test
 public void testToArray_AsObject() {
   Object[] array = list.toArray();
   assertParamsEquals(array, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9);
 }
コード例 #12
0
 @Test(expected = UnsupportedOperationException.class)
 public void testIterator_remove() {
   Iterator<Integer> iterator = list.iterator();
   iterator.next();
   iterator.remove();
 }
コード例 #13
0
 @Test(expected = UnsupportedOperationException.class)
 public void testClear() {
   list.clear();
 }
コード例 #14
0
 @Test(expected = UnsupportedOperationException.class)
 public void testRemove() {
   list.remove(new Integer(randomInt()));
 }
コード例 #15
0
 @Test(expected = UnsupportedOperationException.class)
 public void testAdd() {
   list.add(randomInt());
 }
コード例 #16
0
 @Test
 public void testToArray_AsGenericType_GreaterSize() {
   Integer[] a = new Integer[SIZE + 1];
   Integer[] array = list.toArray(a);
   assertParamsEquals(array, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, null);
 }
コード例 #17
0
 @Test
 public void testToArray_AsGenericType_SmallSize() {
   Integer[] a = new Integer[randomInt()];
   Integer[] array = list.toArray(a);
   assertParamsEquals(array, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9);
 }
コード例 #18
0
 @Test
 public void testIsEmpty_True() {
   list = new UnmodifiableLazyList<Integer>(Collections.emptyList(), serializationService);
   assertTrue(list.isEmpty());
 }
コード例 #19
0
 @Test
 public void testGet() {
   int i = randomInt();
   assertEquals(i, (int) list.get(i));
 }
コード例 #20
0
 @Test
 public void testContains_False() {
   assertFalse(list.contains(randomInt() + SIZE));
 }
コード例 #21
0
 @Test
 public void testSize() {
   assertEquals(SIZE, list.size());
 }
コード例 #22
0
 @Test(expected = UnsupportedOperationException.class)
 public void testSet() {
   int i = randomInt();
   list.set(i, i + 1);
 }
コード例 #23
0
 @Test
 public void testIsEmpty_False() {
   assertFalse(list.isEmpty());
 }
コード例 #24
0
 @Test(expected = UnsupportedOperationException.class)
 public void testAdd_WithIndex() {
   int i = randomInt();
   list.add(i, i + 1);
 }