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 | 15 |
1 files changed, 15 insertions, 0 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 6bbdfcaa..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,6 +32,7 @@ package com.google.protobuf; import static java.util.Arrays.asList; +import com.google.protobuf.Internal.LongList; import java.util.Collections; import java.util.ConcurrentModificationException; import java.util.Iterator; @@ -297,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."); |