diff options
Diffstat (limited to 'java/core/src/test/java/com/google/protobuf/LongArrayListTest.java')
-rw-r--r-- | java/core/src/test/java/com/google/protobuf/LongArrayListTest.java | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/java/core/src/test/java/com/google/protobuf/LongArrayListTest.java b/java/core/src/test/java/com/google/protobuf/LongArrayListTest.java index 6aaf85d7..e50c7d1e 100644 --- a/java/core/src/test/java/com/google/protobuf/LongArrayListTest.java +++ b/java/core/src/test/java/com/google/protobuf/LongArrayListTest.java @@ -32,11 +32,11 @@ package com.google.protobuf; import static java.util.Arrays.asList; -import junit.framework.TestCase; - +import com.google.protobuf.Internal.LongList; import java.util.Collections; import java.util.ConcurrentModificationException; import java.util.Iterator; +import junit.framework.TestCase; /** * Tests for {@link LongArrayList}. @@ -298,6 +298,20 @@ public class LongArrayListTest extends TestCase { } } + public void testRemoveEndOfCapacity() { + LongList toRemove = LongArrayList.emptyList().mutableCopyWithCapacity(1); + toRemove.addLong(3); + toRemove.remove(0); + assertEquals(0, toRemove.size()); + } + + public void testSublistRemoveEndOfCapacity() { + LongList toRemove = LongArrayList.emptyList().mutableCopyWithCapacity(1); + toRemove.addLong(3); + toRemove.subList(0, 1).clear(); + assertEquals(0, toRemove.size()); + } + private void assertImmutable(LongArrayList list) { if (list.contains(1L)) { throw new RuntimeException("Cannot test the immutability of lists that contain 1."); |