Package com.google.common.truth
Class MapSubject.UsingCorrespondence<A extends @Nullable Object,E extends @Nullable Object>
- java.lang.Object
-
- com.google.common.truth.MapSubject.UsingCorrespondence<A,E>
-
- Enclosing class:
- MapSubject
public static final class MapSubject.UsingCorrespondence<A extends @Nullable Object,E extends @Nullable Object> extends Object
A partially specified check in which the actual values (i.e. the values of theMap
under test) are compared to expected values using aCorrespondence
. The expected values are of typeE
. Call methods on this object to actually execute the check.Note that keys will always be compared with regular object equality (
Object.equals(java.lang.Object)
).
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Ordered
containsAtLeast(@Nullable Object k0, @Nullable E v0, @Nullable Object... rest)
Checks that the actual map contains at least the given set of keys mapping to values that correspond to the given values.Ordered
containsAtLeastEntriesIn(@Nullable Map<?,? extends E> expected)
Checks that the actual map contains at least the keys in the given map, mapping to values that correspond to the values of the given map.void
containsEntry(@Nullable Object key, E value)
Checks that the actual map contains an entry with the given key and a value that corresponds to the given value.Ordered
containsExactly(@Nullable Object k0, @Nullable E v0, @Nullable Object... rest)
Checks that the actual map contains exactly the given set of keys mapping to values that correspond to the given values.Ordered
containsExactlyEntriesIn(@Nullable Map<?,? extends E> expected)
Checks that the actual map contains exactly the keys in the given map, mapping to values that correspond to the values of the given map.void
doesNotContainEntry(@Nullable Object key, E value)
Checks that the actual map does not contain an entry with the given key and a value that corresponds to the given value.
-
-
-
Method Detail
-
containsEntry
public void containsEntry(@Nullable Object key, E value)
Checks that the actual map contains an entry with the given key and a value that corresponds to the given value.
-
doesNotContainEntry
public void doesNotContainEntry(@Nullable Object key, E value)
Checks that the actual map does not contain an entry with the given key and a value that corresponds to the given value.
-
containsExactly
@CanIgnoreReturnValue public Ordered containsExactly(@Nullable Object k0, @Nullable E v0, @Nullable Object... rest)
Checks that the actual map contains exactly the given set of keys mapping to values that correspond to the given values.The values must all be of type
E
, and aClassCastException
will be thrown if any other type is encountered.Warning: the use of varargs means that we cannot guarantee an equal number of key/value pairs at compile time. Please make sure you provide varargs in key/value pairs!
-
containsAtLeast
@CanIgnoreReturnValue public Ordered containsAtLeast(@Nullable Object k0, @Nullable E v0, @Nullable Object... rest)
Checks that the actual map contains at least the given set of keys mapping to values that correspond to the given values.The values must all be of type
E
, and aClassCastException
will be thrown if any other type is encountered.Warning: the use of varargs means that we cannot guarantee an equal number of key/value pairs at compile time. Please make sure you provide varargs in key/value pairs!
-
containsExactlyEntriesIn
@CanIgnoreReturnValue public Ordered containsExactlyEntriesIn(@Nullable Map<?,? extends E> expected)
Checks that the actual map contains exactly the keys in the given map, mapping to values that correspond to the values of the given map.
-
containsAtLeastEntriesIn
@CanIgnoreReturnValue public Ordered containsAtLeastEntriesIn(@Nullable Map<?,? extends E> expected)
Checks that the actual map contains at least the keys in the given map, mapping to values that correspond to the values of the given map.
-
-