public class UnmodifiableCollectionTests
extends java.lang.Object
| Constructor and Description |
|---|
UnmodifiableCollectionTests() |
| Modifier and Type | Method and Description |
|---|---|
static <E> void |
assertCollectionIsUnmodifiable(java.util.Collection<E> collection,
E sampleElement)
Verifies that a collection is immutable.
|
private static <E> void |
assertCollectionsAreEquivalent(java.util.Collection<E> expected,
java.util.Collection<E> actual) |
static void |
assertIteratorIsUnmodifiable(java.util.Iterator<?> iterator)
Verifies that an Iterator is unmodifiable.
|
static void |
assertIteratorsInOrder(java.util.Iterator<?> expectedIterator,
java.util.Iterator<?> actualIterator)
Asserts that two iterators contain elements in tandem.
|
static void |
assertMapEntryIsUnmodifiable(java.util.Map.Entry<?,?> entry) |
static <K,V> void |
assertMultimapIsUnmodifiable(Multimap<K,V> multimap,
K sampleKey,
V sampleValue)
Verifies that a multimap is immutable.
|
private static <K,V> void |
assertMultimapRemainsUnmodified(Multimap<K,V> expected,
java.util.List<java.util.Map.Entry<K,V>> actual) |
static <E> void |
assertMultisetIsUnmodifiable(Multiset<E> multiset,
E sampleElement)
Verifies that a multiset is immutable.
|
static <E> void |
assertSetIsUnmodifiable(java.util.Set<E> set,
E sampleElement)
Verifies that a set is immutable.
|
public static void assertMapEntryIsUnmodifiable(java.util.Map.Entry<?,?> entry)
public static void assertIteratorIsUnmodifiable(java.util.Iterator<?> iterator)
This test only works with iterators that iterate over a finite set.
public static void assertIteratorsInOrder(java.util.Iterator<?> expectedIterator,
java.util.Iterator<?> actualIterator)
This test only works with iterators that iterate over a finite set.
public static <E> void assertCollectionIsUnmodifiable(java.util.Collection<E> collection,
E sampleElement)
A collection is considered immutable if:
collection - the presumed-immutable collectionsampleElement - an element of the same type as that contained by collection.
collection may or may not have sampleElement as a member.public static <E> void assertSetIsUnmodifiable(java.util.Set<E> set,
E sampleElement)
A set is considered immutable if:
set - the presumed-immutable setsampleElement - an element of the same type as that contained by set. set
may or may not have sampleElement as a member.public static <E> void assertMultisetIsUnmodifiable(Multiset<E> multiset, E sampleElement)
A multiset is considered immutable if:
multiset - the presumed-immutable multisetsampleElement - an element of the same type as that contained by multiset. multiset may or may not have sampleElement as a member.public static <K,V> void assertMultimapIsUnmodifiable(Multimap<K,V> multimap, K sampleKey, V sampleValue)
A multimap is considered immutable if:
multimap - the presumed-immutable multimapsampleKey - a key of the same type as that contained by multimap. multimap
may or may not have sampleKey as a key.sampleValue - a key of the same type as that contained by multimap. multimap may or may not have sampleValue as a key.private static <E> void assertCollectionsAreEquivalent(java.util.Collection<E> expected,
java.util.Collection<E> actual)
private static <K,V> void assertMultimapRemainsUnmodified(Multimap<K,V> expected, java.util.List<java.util.Map.Entry<K,V>> actual)