Package com.google.common.truth
Class MapSubject<S extends MapSubject<S,K,V,M>,K,V,M extends java.util.Map<K,V>>
- java.lang.Object
-
- com.google.common.truth.Subject<S,M>
-
- com.google.common.truth.MapSubject<S,K,V,M>
-
public class MapSubject<S extends MapSubject<S,K,V,M>,K,V,M extends java.util.Map<K,V>> extends Subject<S,M>
Propositions forMap
subjects.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interface
MapSubject.WithValue<V>
Deprecated.UsecontainsEntry(Object, Object)
instead.-
Nested classes/interfaces inherited from class com.google.common.truth.Subject
Subject.HasField
-
-
Field Summary
-
Fields inherited from class com.google.common.truth.Subject
failureStrategy
-
-
Constructor Summary
Constructors Modifier Constructor Description private
MapSubject(FailureStrategy failureStrategy, M map)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description void
containsEntry(java.lang.Object key, java.lang.Object value)
Fails if the map does not contain the given entry.void
containsKey(java.lang.Object key)
Fails if the map does not contain the given key.(package private) static <K,V,M extends java.util.Map<K,V>>
MapSubject<? extends MapSubject<?,K,V,M>,K,V,M>create(FailureStrategy failureStrategy, java.util.Map<K,V> map)
void
doesNotContainEntry(java.lang.Object key, java.lang.Object value)
Fails if the map contains the given entry.void
doesNotContainKey(java.lang.Object key)
Fails if the map contains the given key.MapSubject.WithValue<V>
hasKey(K key)
Deprecated.UsecontainsKey(Object)
instead.void
hasSize(int expectedSize)
Fails if the map does not have the given size.void
isEmpty()
Fails if the map is not empty.void
isNotEmpty()
Fails if the map is empty.void
lacksKey(K key)
Deprecated.UsedoesNotContainKey(Object)
instead.-
Methods inherited from class com.google.common.truth.Subject
check, equals, fail, fail, fail, failWithBadResults, failWithCustomSubject, failWithoutSubject, failWithRawMessage, getDisplaySubject, getSubject, hasField, hashCode, internalCustomName, is, isA, isEqualTo, isInstanceOf, isNotA, isNotEqualTo, isNotInstanceOf, isNotNull, isNotSameAs, isNull, isSameAs, labeled, named
-
-
-
-
Constructor Detail
-
MapSubject
private MapSubject(FailureStrategy failureStrategy, M map)
-
-
Method Detail
-
create
static <K,V,M extends java.util.Map<K,V>> MapSubject<? extends MapSubject<?,K,V,M>,K,V,M> create(FailureStrategy failureStrategy, java.util.Map<K,V> map)
-
isEmpty
public void isEmpty()
Fails if the map is not empty.
-
isNotEmpty
public void isNotEmpty()
Fails if the map is empty.
-
hasSize
public final void hasSize(int expectedSize)
Fails if the map does not have the given size.
-
containsKey
public void containsKey(java.lang.Object key)
Fails if the map does not contain the given key.
-
doesNotContainKey
public void doesNotContainKey(java.lang.Object key)
Fails if the map contains the given key.
-
containsEntry
public void containsEntry(java.lang.Object key, java.lang.Object value)
Fails if the map does not contain the given entry.
-
doesNotContainEntry
public void doesNotContainEntry(java.lang.Object key, java.lang.Object value)
Fails if the map contains the given entry.
-
hasKey
@Deprecated public MapSubject.WithValue<V> hasKey(K key)
Deprecated.UsecontainsKey(Object)
instead.Fails if the map does not contain the given key.
-
lacksKey
@Deprecated public void lacksKey(K key)
Deprecated.UsedoesNotContainKey(Object)
instead.Fails if the map contains the given key.
-
-