public class MultimapSubject extends Subject<MultimapSubject,com.google.common.collect.Multimap<?,?>>
Multimap
subjects.Modifier and Type | Class and Description |
---|---|
class |
MultimapSubject.UsingCorrespondence<A,E>
A partially specified proposition in which the actual values (i.e.
|
failureStrategy
Modifier and Type | Method and Description |
---|---|
<A,E> MultimapSubject.UsingCorrespondence<A,E> |
comparingValuesUsing(Correspondence<A,E> correspondence)
Starts a method chain for a test proposition in which the actual values (i.e.
|
void |
containsEntry(Object key,
Object value)
Fails if the multimap does not contain the given entry.
|
Ordered |
containsExactly()
Fails if the multimap is not empty.
|
Ordered |
containsExactly(com.google.common.collect.Multimap<?,?> expectedMultimap)
Deprecated.
|
Ordered |
containsExactly(Object k0,
Object v0,
Object... rest)
Fails if the multimap does not contain exactly the given set of key/value pairs.
|
Ordered |
containsExactlyEntriesIn(com.google.common.collect.Multimap<?,?> expectedMultimap)
Fails if the
Multimap does not contain precisely the same entries as the argument
Multimap . |
void |
containsKey(Object key)
Fails if the multimap does not contain the given key.
|
void |
doesNotContainEntry(Object key,
Object value)
Fails if the multimap contains the given entry.
|
void |
doesNotContainKey(Object key)
Fails if the multimap contains the given key.
|
void |
hasSize(int expectedSize)
Fails if the multimap does not have the given size.
|
void |
isEmpty()
Fails if the multimap is not empty.
|
void |
isEqualTo(Object other)
Fails if the subject is not equal to the given object.
|
void |
isNotEmpty()
Fails if the multimap is empty.
|
IterableSubject |
valuesForKey(Object key)
Returns a context-aware
Subject for making assertions about the values for the given
key within the Multimap . |
actual, actualAsString, actualCustomStringRepresentation, check, equals, fail, fail, fail, failComparing, failComparing, failWithBadResults, failWithCustomSubject, failWithoutActual, failWithoutSubject, failWithRawMessage, failWithRawMessageAndCause, getDisplaySubject, getSubject, hashCode, ignoreCheck, internalCustomName, isAnyOf, isIn, isInstanceOf, isNoneOf, isNotEqualTo, isNotIn, isNotInstanceOf, isNotNull, isNotSameAs, isNull, isSameAs, named
public void isEmpty()
public void isNotEmpty()
public void hasSize(int expectedSize)
public void containsKey(@Nullable Object key)
public void doesNotContainKey(@Nullable Object key)
public void containsEntry(@Nullable Object key, @Nullable Object value)
public void doesNotContainEntry(@Nullable Object key, @Nullable Object value)
public IterableSubject valuesForKey(@Nullable Object key)
Subject
for making assertions about the values for the given
key within the Multimap
.
This method performs no checks on its own and cannot cause test failures. Subsequent
assertions must be chained onto this method call to test properties of the Multimap
.
public void isEqualTo(@Nullable Object other)
Subject
Objects.equal(java.lang.Object, java.lang.Object)
Arrays#equals
overload
Byte
, Short
, Character
, Integer
, or Long
) and they are numerically equal when converted to Long
.
isEqualTo
in class Subject<MultimapSubject,com.google.common.collect.Multimap<?,?>>
public Ordered containsExactlyEntriesIn(com.google.common.collect.Multimap<?,?> expectedMultimap)
Multimap
does not contain precisely the same entries as the argument
Multimap
.
A subsequent call to Ordered.inOrder()
may be made if the caller wishes to verify that
the two multimaps iterate fully in the same order. That is, their key sets iterate in the same
order, and the value collections for each key iterate in the same order.
public Ordered containsExactly()
public Ordered containsExactly(@Nullable Object k0, @Nullable Object v0, Object... rest)
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!
@Deprecated public Ordered containsExactly(com.google.common.collect.Multimap<?,?> expectedMultimap)
containsExactlyEntriesIn(com.google.common.collect.Multimap<?, ?>)
instead.public <A,E> MultimapSubject.UsingCorrespondence<A,E> comparingValuesUsing(Correspondence<A,E> correspondence)
Multimap
under test) are compared to expected values using the given Correspondence
. The actual values must be of type A
, and the expected values must be
of type E
. The proposition is actually executed by continuing the method chain. For
example:
assertThat(actualMultimap)
.comparingValuesUsing(correspondence)
.containsEntry(expectedKey, expectedValue);
where actualMultimap
is a Multimap<?, A>
(or, more generally, a Multimap<?, ? extends A>
), correspondence
is a Correspondence<A, E>
, and
expectedValue
is an E
.
Note that keys will always be compared with regular object equality (Object.equals(java.lang.Object)
).
Any of the methods on the returned object may throw ClassCastException
if they
encounter an actual value that is not of type A
.
Copyright © 2017. All rights reserved.