Modifier and Type | Method and Description |
---|---|
<K,V> void |
assertAllSatisfy(AssertionInfo info,
Map<K,V> actual,
BiConsumer<? super K,? super V> entryRequirements) |
<K,V> void |
assertAnySatisfy(AssertionInfo info,
Map<K,V> actual,
BiConsumer<? super K,? super V> entryRequirements) |
<K,V> void |
assertContains(AssertionInfo info,
Map<K,V> actual,
Map.Entry<? extends K,? extends V>[] entries)
Asserts that the given
Map contains the given entries, in any order. |
<K,V> void |
assertContainsAnyOf(AssertionInfo info,
Map<K,V> actual,
Map.Entry<? extends K,? extends V>[] entries) |
<K,V> void |
assertContainsExactly(AssertionInfo info,
Map<K,V> actual,
Map.Entry<? extends K,? extends V>... entries)
Verifies that the actual map contains only the given entries and nothing else, in order.
This assertion should only be used with map that have a consistent iteration order (i.e. |
<K,V> void |
assertContainsKeys(AssertionInfo info,
Map<K,V> actual,
K... keys)
Verifies that the actual map contain the given key.
|
<K,V> void |
assertContainsOnly(AssertionInfo info,
Map<K,V> actual,
Map.Entry<? extends K,? extends V>... entries)
Verifies that the actual map contains only the given entries and nothing else, in any order.
|
<K,V> void |
assertContainsOnlyKeys(AssertionInfo info,
Map<K,V> actual,
Iterable<? extends K> keys)
Verifies that the actual map contains only the given keys and nothing else, in any order.
|
<K,V> void |
assertContainsOnlyKeys(AssertionInfo info,
Map<K,V> actual,
K... keys)
Verifies that the actual map contains only the given keys and nothing else, in any order.
|
<K,V> void |
assertContainsOnlyKeys(AssertionInfo info,
Map<K,V> actual,
String placeholderForErrorMessages,
K[] keys) |
<K,V> void |
assertContainsValue(AssertionInfo info,
Map<K,V> actual,
V value)
Verifies that the actual map contain the given value.
|
<K,V> void |
assertContainsValues(AssertionInfo info,
Map<K,V> actual,
V... values)
Verifies that the actual map contain the given values.
|
<K,V> void |
assertDoesNotContain(AssertionInfo info,
Map<K,V> actual,
Map.Entry<? extends K,? extends V>[] entries)
Asserts that the given
Map does not contain the given entries. |
<K,V> void |
assertDoesNotContainKey(AssertionInfo info,
Map<K,V> actual,
K key)
Verifies that the actual map not contains the given key.
|
<K,V> void |
assertDoesNotContainKeys(AssertionInfo info,
Map<K,V> actual,
K... keys)
Verifies that the actual map not contains all the given keys.
|
<K,V> void |
assertDoesNotContainValue(AssertionInfo info,
Map<K,V> actual,
V value)
Verifies that the actual map not contains the given value.
|
void |
assertEmpty(AssertionInfo info,
Map<?,?> actual)
Asserts that the given
Map is empty. |
<K,V> void |
assertHasEntrySatisfying(AssertionInfo info,
Map<K,V> actual,
Condition<? super Map.Entry<K,V>> entryCondition)
Verifies that the given
Map contains an entry satisfying given entryCondition . |
<K,V> void |
assertHasEntrySatisfying(AssertionInfo info,
Map<K,V> actual,
K key,
Condition<? super V> valueCondition)
Verifies that the given
Map contains the value for given key that satisfy given valueCondition . |
<K,V> void |
assertHasEntrySatisfying(AssertionInfo info,
Map<K,V> actual,
K key,
Consumer<? super V> valueRequirements)
Verifies that the
Map contains the value for given key that satisfy given valueRequirements . |
<K,V> void |
assertHasEntrySatisfyingConditions(AssertionInfo info,
Map<K,V> actual,
Condition<? super K> keyCondition,
Condition<? super V> valueCondition)
Verifies that the given
Map contains an entry with key satisfying keyCondition
and value satisfying valueCondition . |
<K> void |
assertHasKeySatisfying(AssertionInfo info,
Map<K,?> actual,
Condition<? super K> keyCondition)
Verifies that the given
Map contains an entry with key satisfying keyCondition . |
void |
assertHasSameSizeAs(AssertionInfo info,
Map<?,?> map,
Iterable<?> other)
Asserts that the number of entries in the given
Map has the same size as the other Iterable . |
void |
assertHasSameSizeAs(AssertionInfo info,
Map<?,?> map,
Map<?,?> other)
Asserts that the size of the given
Map is equal to the size of the other Map . |
void |
assertHasSameSizeAs(AssertionInfo info,
Map<?,?> map,
Object other)
Asserts that the number of entries in the given
Map has the same size as the other array. |
void |
assertHasSize(AssertionInfo info,
Map<?,?> actual,
int expectedSize)
Asserts that the number of entries in the given
Map is equal to the expected one. |
void |
assertHasSizeBetween(AssertionInfo info,
Map<?,?> actual,
int lowerBoundary,
int higherBoundary)
Asserts that the number of entries in the given
Map is between the given lower and higher boundary (inclusive). |
void |
assertHasSizeGreaterThan(AssertionInfo info,
Map<?,?> actual,
int boundary)
Asserts that the number of entries in the given
Map is greater than the boundary. |
void |
assertHasSizeGreaterThanOrEqualTo(AssertionInfo info,
Map<?,?> actual,
int boundary)
Asserts that the number of entries in the given
Map is greater than or equal to the boundary. |
void |
assertHasSizeLessThan(AssertionInfo info,
Map<?,?> actual,
int boundary)
Asserts that the number of entries in the given
Map is less than the boundary. |
void |
assertHasSizeLessThanOrEqualTo(AssertionInfo info,
Map<?,?> actual,
int boundary)
Asserts that the number of entries in the given
Map is less than or equal to the boundary. |
<V> void |
assertHasValueSatisfying(AssertionInfo info,
Map<?,V> actual,
Condition<? super V> valueCondition)
Verifies that the given
Map contains an entry with value satisfying valueCondition . |
<K,V> void |
assertNoneSatisfy(AssertionInfo info,
Map<K,V> actual,
BiConsumer<? super K,? super V> entryRequirements) |
void |
assertNotEmpty(AssertionInfo info,
Map<?,?> actual)
Asserts that the given
Map is not empty. |
void |
assertNullOrEmpty(AssertionInfo info,
Map<?,?> actual)
Asserts that the given
Map is null or empty. |
static Maps |
instance()
Returns the singleton instance of this class.
|
public static Maps instance()
public <K,V> void assertAllSatisfy(AssertionInfo info, Map<K,V> actual, BiConsumer<? super K,? super V> entryRequirements)
public <K,V> void assertAnySatisfy(AssertionInfo info, Map<K,V> actual, BiConsumer<? super K,? super V> entryRequirements)
public <K,V> void assertNoneSatisfy(AssertionInfo info, Map<K,V> actual, BiConsumer<? super K,? super V> entryRequirements)
public void assertNullOrEmpty(AssertionInfo info, Map<?,?> actual)
Map
is null
or empty.info
- contains information about the assertion.actual
- the given map.AssertionError
- if the given Map
is not null
*and* contains one or more entries.public void assertEmpty(AssertionInfo info, Map<?,?> actual)
Map
is empty.info
- contains information about the assertion.actual
- the given Map
.AssertionError
- if the given Map
is null
.AssertionError
- if the given Map
is not empty.public void assertNotEmpty(AssertionInfo info, Map<?,?> actual)
Map
is not empty.info
- contains information about the assertion.actual
- the given Map
.AssertionError
- if the given Map
is null
.AssertionError
- if the given Map
is empty.public void assertHasSize(AssertionInfo info, Map<?,?> actual, int expectedSize)
Map
is equal to the expected one.info
- contains information about the assertion.actual
- the given Map
.expectedSize
- the expected size of actual
.AssertionError
- if the given Map
is null
.AssertionError
- if the number of entries in the given Map
is different than the expected one.public void assertHasSizeGreaterThan(AssertionInfo info, Map<?,?> actual, int boundary)
Map
is greater than the boundary.info
- contains information about the assertion.actual
- the given Map
.boundary
- the given value to compare the size of actual
to.AssertionError
- if the given Map
is null
.AssertionError
- if the number of entries in the given Map
is greater than the boundary.public void assertHasSizeGreaterThanOrEqualTo(AssertionInfo info, Map<?,?> actual, int boundary)
Map
is greater than or equal to the boundary.info
- contains information about the assertion.actual
- the given Map
.boundary
- the given value to compare the size of actual
to.AssertionError
- if the given Map
is null
.AssertionError
- if the number of entries in the given Map
is greater than or equal to the boundary.public void assertHasSizeLessThan(AssertionInfo info, Map<?,?> actual, int boundary)
Map
is less than the boundary.info
- contains information about the assertion.actual
- the given Map
.boundary
- the given value to compare the size of actual
to.AssertionError
- if the given Map
is null
.AssertionError
- if the number of entries in the given Map
is less than the expected one.public void assertHasSizeLessThanOrEqualTo(AssertionInfo info, Map<?,?> actual, int boundary)
Map
is less than or equal to the boundary.info
- contains information about the assertion.actual
- the given Map
.boundary
- the given value to compare the size of actual
to.AssertionError
- if the given Map
is null
.AssertionError
- if the number of entries in the given Map
is less than or equal to the boundary.public void assertHasSizeBetween(AssertionInfo info, Map<?,?> actual, int lowerBoundary, int higherBoundary)
Map
is between the given lower and higher boundary (inclusive).info
- contains information about the assertion.actual
- the given Map
.lowerBoundary
- the lower boundary compared to which actual size should be greater than or equal to.higherBoundary
- the higher boundary compared to which actual size should be less than or equal to.AssertionError
- if the given array is null
.AssertionError
- if the number of elements in the given array is not between the boundaries.public void assertHasSameSizeAs(AssertionInfo info, Map<?,?> map, Iterable<?> other)
Map
has the same size as the other Iterable
.info
- contains information about the assertion.map
- the given Map
.other
- the group to compareAssertionError
- if the given Map
is null
.AssertionError
- if the given Iterable
is null
.AssertionError
- if the number of entries in the given Map
does not have the same size.public void assertHasSameSizeAs(AssertionInfo info, Map<?,?> map, Object other)
Map
has the same size as the other array.info
- contains information about the assertion.map
- the given Map
.other
- the group to compareAssertionError
- if the given Map
is null
.AssertionError
- if the given array is null
.AssertionError
- if the number of entries in the given Map
does not have the same size.public void assertHasSameSizeAs(AssertionInfo info, Map<?,?> map, Map<?,?> other)
Map
is equal to the size of the other Map
.info
- contains information about the assertion.map
- the given Map
.other
- the other Map
to compareNullPointerException
- if the other Map
is null
.AssertionError
- if the given Map
is null
.AssertionError
- if the size of the given Map
is not equal to the other Map
sizepublic <K,V> void assertContains(AssertionInfo info, Map<K,V> actual, Map.Entry<? extends K,? extends V>[] entries)
Map
contains the given entries, in any order.K
- key typeV
- value typeinfo
- contains information about the assertion.actual
- the given Map
.entries
- the entries that are expected to be in the given Map
.NullPointerException
- if the array of entries is null
.IllegalArgumentException
- if the array of entries is empty.NullPointerException
- if any of the entries in the given array is null
.AssertionError
- if the given Map
is null
.AssertionError
- if the given Map
does not contain the given entries.public <K,V> void assertContainsAnyOf(AssertionInfo info, Map<K,V> actual, Map.Entry<? extends K,? extends V>[] entries)
public <K,V> void assertHasEntrySatisfying(AssertionInfo info, Map<K,V> actual, K key, Condition<? super V> valueCondition)
Map
contains the value for given key
that satisfy given valueCondition
.K
- key typeV
- value typeinfo
- contains information about the assertion.actual
- the given Map
.key
- he given key to check.valueCondition
- the given condition for check value.NullPointerException
- if the given values is null
.AssertionError
- if the actual map is null
.AssertionError
- if the actual map not contains the given key
.AssertionError
- if the actual map contains the given key, but value not match the given valueCondition
.public <K,V> void assertHasEntrySatisfying(AssertionInfo info, Map<K,V> actual, K key, Consumer<? super V> valueRequirements)
Map
contains the value for given key
that satisfy given valueRequirements
.K
- key typeV
- value typeinfo
- contains information about the assertion.actual
- the given Map
.key
- he given key to check.valueRequirements
- the given requirements for check value.NullPointerException
- if the given values is null
.AssertionError
- if the actual map is null
.AssertionError
- if the actual map not contains the given key
.AssertionError
- if the actual map contains the given key, but value not pass the given valueRequirements
.public <K,V> void assertHasEntrySatisfying(AssertionInfo info, Map<K,V> actual, Condition<? super Map.Entry<K,V>> entryCondition)
Map
contains an entry satisfying given entryCondition
.K
- key typeV
- value typeinfo
- contains information about the assertion.actual
- the given Map
.entryCondition
- the condition for searching entry.NullPointerException
- if the given condition is null
.AssertionError
- if the actual map is null
.AssertionError
- if there is no entry matching given entryCondition
.public <K,V> void assertHasEntrySatisfyingConditions(AssertionInfo info, Map<K,V> actual, Condition<? super K> keyCondition, Condition<? super V> valueCondition)
Map
contains an entry with key satisfying keyCondition
and value satisfying valueCondition
.K
- key typeV
- value typeinfo
- contains information about the assertion.actual
- the given Map
.keyCondition
- the condition for entry key.valueCondition
- the condition for entry value.NullPointerException
- if any of the given conditions is null
.AssertionError
- if the actual map is null
.AssertionError
- if there is no entry matching given keyCondition
and valueCondition
.public <K> void assertHasKeySatisfying(AssertionInfo info, Map<K,?> actual, Condition<? super K> keyCondition)
Map
contains an entry with key satisfying keyCondition
.K
- key typeinfo
- contains information about the assertion.actual
- the given Map
.keyCondition
- the condition for key search.NullPointerException
- if the given condition is null
.AssertionError
- if the actual map is null
.AssertionError
- if there is no key matching given keyCondition
.public <V> void assertHasValueSatisfying(AssertionInfo info, Map<?,V> actual, Condition<? super V> valueCondition)
Map
contains an entry with value satisfying valueCondition
.V
- value typeinfo
- contains information about the assertion.actual
- the given Map
.valueCondition
- the condition for value search.NullPointerException
- if the given condition is null
.AssertionError
- if the actual map is null
.AssertionError
- if there is no value matching given valueCondition
.public <K,V> void assertDoesNotContain(AssertionInfo info, Map<K,V> actual, Map.Entry<? extends K,? extends V>[] entries)
Map
does not contain the given entries.K
- key typeV
- value typeinfo
- contains information about the assertion.actual
- the given Map
.entries
- the entries that are expected to be in the given Map
.NullPointerException
- if the array of entries is null
.IllegalArgumentException
- if the array of entries is empty.NullPointerException
- if any of the entries in the given array is null
.AssertionError
- if the given Map
is null
.AssertionError
- if the given Map
contains any of the given entries.public <K,V> void assertContainsKeys(AssertionInfo info, Map<K,V> actual, K... keys)
K
- key typeV
- value typeinfo
- contains information about the assertion.actual
- the given Map
.keys
- the given keysAssertionError
- if the actual map is null
.AssertionError
- if the actual map not contains the given key.public <K,V> void assertDoesNotContainKey(AssertionInfo info, Map<K,V> actual, K key)
K
- key typeV
- value typeinfo
- contains information about the assertion.actual
- the given Map
.key
- the given keyAssertionError
- if the actual map is null
.AssertionError
- if the actual map contains the given key.public <K,V> void assertDoesNotContainKeys(AssertionInfo info, Map<K,V> actual, K... keys)
K
- key typeV
- value typeinfo
- contains information about the assertion.actual
- the given Map
.keys
- the given keysAssertionError
- if the actual map is null
.AssertionError
- if the actual map contains all the given keys.public <K,V> void assertContainsOnlyKeys(AssertionInfo info, Map<K,V> actual, K... keys)
K
- key typeV
- value typeinfo
- contains information about the assertion.actual
- the given Map
.keys
- the keys that are expected to be in the given Map
.NullPointerException
- if the array of keys is null
.IllegalArgumentException
- if the array of keys is empty.AssertionError
- if the given Map
is null
.AssertionError
- if the given Map
does not contain the given keys or if the given Map
contains keys that are not in the given array.public <K,V> void assertContainsOnlyKeys(AssertionInfo info, Map<K,V> actual, Iterable<? extends K> keys)
K
- key typeV
- value typeinfo
- contains information about the assertion.actual
- the given Map
.keys
- the keys that are expected to be in the given Map
.NullPointerException
- if the array of keys is null
.IllegalArgumentException
- if the array of keys is empty.AssertionError
- if the given Map
is null
.AssertionError
- if the given Map
does not contain the given keys or if the given Map
contains keys that are not in the given array.public <K,V> void assertContainsOnlyKeys(AssertionInfo info, Map<K,V> actual, String placeholderForErrorMessages, K[] keys)
public <K,V> void assertContainsValue(AssertionInfo info, Map<K,V> actual, V value)
K
- key typeV
- value typeinfo
- contains information about the assertion.actual
- the given Map
.value
- the given valueAssertionError
- if the actual map is null
.AssertionError
- if the actual map not contains the given value.public <K,V> void assertContainsValues(AssertionInfo info, Map<K,V> actual, V... values)
K
- key typeV
- value typeinfo
- contains information about the assertion.actual
- the given Map
.values
- the given valuesAssertionError
- if the actual map is null
.AssertionError
- if the actual map not contains the given values.NullPointerException
- if values vararg is null
.public <K,V> void assertDoesNotContainValue(AssertionInfo info, Map<K,V> actual, V value)
K
- key typeV
- value typeinfo
- contains information about the assertion.actual
- the given Map
.value
- the given valueAssertionError
- if the actual map is null
.AssertionError
- if the actual map contains the given value.public <K,V> void assertContainsOnly(AssertionInfo info, Map<K,V> actual, Map.Entry<? extends K,? extends V>... entries)
K
- key typeV
- value typeinfo
- contains information about the assertion.actual
- the given Map
.entries
- the entries that should be in the actual map.AssertionError
- if the actual map is null
.NullPointerException
- if the given entries array is null
.IllegalArgumentException
- if the given entries array is empty.AssertionError
- if the actual map does not contain the given entries, i.e. the actual map contains some or
none of the given entries, or the actual map contains more entries than the given ones.public <K,V> void assertContainsExactly(AssertionInfo info, Map<K,V> actual, Map.Entry<? extends K,? extends V>... entries)
HashMap
).K
- key typeV
- value typeinfo
- contains information about the assertion.actual
- the given Map
.entries
- the given entries.NullPointerException
- if the given entries array is null
.AssertionError
- if the actual map is null
.IllegalArgumentException
- if the given entries array is empty.AssertionError
- if the actual map does not contain the given entries with same order, i.e. the actual map
contains some or none of the given entries, or the actual map contains more entries than the given ones
or entries are the same but the order is not.Copyright © 2014–2019 AssertJ. All rights reserved.