S
- the "self" type of this assertion class. Please read "Emulating 'self types' using Java Generics to simplify fluent API implementation"
for more details.A
- the type of the "actual" value.K
- the type of keys in map.V
- the type of values in map.public abstract class AbstractMapAssert<S extends AbstractMapAssert<S,A,K,V>,A extends Map<K,V>,K,V> extends AbstractAssert<S,A> implements EnumerableAssert<S,MapEntry>
Map
s.actual, info, myself
Modifier | Constructor and Description |
---|---|
protected |
AbstractMapAssert(A actual,
Class<?> selfType) |
Modifier and Type | Method and Description |
---|---|
S |
contains(MapEntry... entries)
Verifies that the actual map contains the given entries, in any order.
|
S |
containsEntry(K key,
V value)
Verifies that the actual map contains the given entry.
|
S |
containsKey(K key)
Verifies that the actual map contains the given key.
|
S |
containsKeys(K... keys)
Verifies that the actual map contains the given keys.
|
S |
containsValue(V value)
Verifies that the actual map contains the given value.
|
S |
doesNotContain(MapEntry... entries)
Verifies that the actual map does not contain the given entries.
|
S |
doesNotContainEntry(K key,
V value)
Verifies that the actual map does not contain the given entry.
|
S |
doesNotContainKey(K key)
Verifies that the actual map does not contain the given key.
|
S |
doesNotContainValue(V value)
Verifies that the actual map does not contain the given value.
|
S |
hasSameSizeAs(Iterable<?> other)
Verifies that the actual group has the same size as given
Iterable . |
S |
hasSameSizeAs(Object[] other)
Verifies that the actual group has the same size as given array.
|
S |
hasSize(int expected)
Verifies that the number of values in the actual group is equal to the given one.
|
void |
isEmpty()
Verifies that the actual group of values is empty.
|
S |
isNotEmpty()
Verifies that the actual group of values is not empty.
|
void |
isNullOrEmpty()
Verifies that the actual group of values is
null or empty. |
S |
usingDefaultElementComparator()
Deprecated.
Custom element Comparator is not supported for MapEntry comparison.
|
S |
usingElementComparator(Comparator<? super MapEntry> customComparator)
Deprecated.
Custom element Comparator is not supported for MapEntry comparison.
|
as, as, describedAs, describedAs, descriptionText, doesNotHave, doesNotHaveSameClassAs, equals, failWithMessage, getWritableAssertionInfo, has, hashCode, hasSameClassAs, is, isEqualTo, isExactlyInstanceOf, isIn, isIn, isInstanceOf, isInstanceOfAny, isNot, isNotEqualTo, isNotExactlyInstanceOf, isNotIn, isNotIn, isNotInstanceOf, isNotInstanceOfAny, isNotNull, isNotOfAnyClassIn, isNotSameAs, isNull, isOfAnyClassIn, isSameAs, overridingErrorMessage, usingComparator, usingDefaultComparator
public void isNullOrEmpty()
null
or empty.isNullOrEmpty
in interface EnumerableAssert<S extends AbstractMapAssert<S,A,K,V>,MapEntry>
public void isEmpty()
isEmpty
in interface EnumerableAssert<S extends AbstractMapAssert<S,A,K,V>,MapEntry>
public S isNotEmpty()
isNotEmpty
in interface EnumerableAssert<S extends AbstractMapAssert<S,A,K,V>,MapEntry>
this
assertion object.public S hasSize(int expected)
hasSize
in interface EnumerableAssert<S extends AbstractMapAssert<S,A,K,V>,MapEntry>
expected
- the expected number of values in the actual group.this
assertion object.public S hasSameSizeAs(Object[] other)
hasSameSizeAs
in interface EnumerableAssert<S extends AbstractMapAssert<S,A,K,V>,MapEntry>
other
- the array to compare size with actual group.this
assertion object.public S hasSameSizeAs(Iterable<?> other)
Iterable
.hasSameSizeAs
in interface EnumerableAssert<S extends AbstractMapAssert<S,A,K,V>,MapEntry>
other
- the Iterable
to compare size with actual group.this
assertion object.public S contains(MapEntry... entries)
Example :
MapringBearers = ... // init omitted assertThat(ringBearers).contains(entry(oneRing, frodo), entry(nenya, galadriel));
entries
- the given entries.this
assertion object.NullPointerException
- if the given argument is null
.IllegalArgumentException
- if the given argument is an empty array.NullPointerException
- if any of the entries in the given array is null
.AssertionError
- if the actual map is null
.AssertionError
- if the actual map does not contain the given entries.public S containsEntry(K key, V value)
Example :
MapringBearers = ... // init omitted assertThat(ringBearers).containsEntry(oneRing, frodo).containsEntry(nenya, galadriel);
key
- the given key to check.value
- the given value to check.this
assertion object.NullPointerException
- if the given argument is null
.IllegalArgumentException
- if the given argument is an empty array.NullPointerException
- if any of the entries in the given array is null
.AssertionError
- if the actual map is null
.AssertionError
- if the actual map does not contain the given entries.public S doesNotContain(MapEntry... entries)
Example :
MapringBearers = ... // init omitted assertThat(ringBearers).doesNotContain(entry(oneRing, aragorn));
entries
- the given entries.this
assertion object.NullPointerException
- if the given argument is null
.IllegalArgumentException
- if the given argument is an empty array.AssertionError
- if the actual map is null
.AssertionError
- if the actual map contains any of the given entries.public S doesNotContainEntry(K key, V value)
Example :
MapringBearers = ... // init omitted assertThat(ringBearers).doesNotContainEntry(oneRing, aragorn);
key
- key of the entry.value
- value of the entry.this
assertion object.NullPointerException
- if the given argument is null
.IllegalArgumentException
- if the given argument is an empty array.AssertionError
- if the actual map is null
.AssertionError
- if the actual map contains any of the given entries.public S containsKey(K key)
key
- the given keyAssertionError
- if the actual map is null
.AssertionError
- if the actual map does not contain the given key.public S containsKeys(K... keys)
keys
- the given keysAssertionError
- if the actual map is null
.AssertionError
- if the actual map does not contain the given key.IllegalArgumentException
- if the given argument is an empty array.public S doesNotContainKey(K key)
key
- the given keyAssertionError
- if the actual map is null
.AssertionError
- if the actual map contains the given key.public S containsValue(V value)
value
- the value to look for.AssertionError
- if the actual map is null
.AssertionError
- if the actual map does not contain the given value.public S doesNotContainValue(V value)
value
- the value that should not be in actual map.AssertionError
- if the actual map is null
.AssertionError
- if the actual map contains the given value.@Deprecated public final S usingElementComparator(Comparator<? super MapEntry> customComparator)
usingElementComparator
in interface EnumerableAssert<S extends AbstractMapAssert<S,A,K,V>,MapEntry>
customComparator
- the comparator to use for incoming assertion checks.this
assertion object.UnsupportedOperationException
- if this method is called.@Deprecated public final S usingDefaultElementComparator()
usingDefaultElementComparator
in interface EnumerableAssert<S extends AbstractMapAssert<S,A,K,V>,MapEntry>
this
assertion object.UnsupportedOperationException
- if this method is called.Copyright © 2013 AssertJ. All Rights Reserved.