Package org.assertj.core.internal
Class Maps
- java.lang.Object
-
- org.assertj.core.internal.Maps
-
-
Field Summary
Fields Modifier and Type Field Description (package private) Conditions
conditions
(package private) Failures
failures
private static Maps
INSTANCE
-
Constructor Summary
Constructors Constructor Description Maps()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description <K,V>
voidassertAllSatisfy(AssertionInfo info, Map<K,V> actual, BiConsumer<? super K,? super V> entryRequirements)
<K,V>
voidassertAnySatisfy(AssertionInfo info, Map<K,V> actual, BiConsumer<? super K,? super V> entryRequirements)
<K,V>
voidassertContains(AssertionInfo info, Map<K,V> actual, Map.Entry<? extends K,? extends V>[] entries)
Asserts that the givenMap
contains the given entries, in any order.<K,V>
voidassertContainsAnyOf(AssertionInfo info, Map<K,V> actual, Map.Entry<? extends K,? extends V>[] entries)
<K,V>
voidassertContainsExactly(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>
voidassertContainsKeys(AssertionInfo info, Map<K,V> actual, K... keys)
Verifies that the actual map contain the given key.<K,V>
voidassertContainsOnly(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>
voidassertContainsOnlyKeys(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>
voidassertContainsOnlyKeys(AssertionInfo info, Map<K,V> actual, String placeholderForErrorMessages, K[] keys)
<K,V>
voidassertContainsOnlyKeys(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>
voidassertContainsValue(AssertionInfo info, Map<K,V> actual, V value)
Verifies that the actual map contain the given value.<K,V>
voidassertContainsValues(AssertionInfo info, Map<K,V> actual, V... values)
Verifies that the actual map contain the given values.<K,V>
voidassertDoesNotContain(AssertionInfo info, Map<K,V> actual, Map.Entry<? extends K,? extends V>[] entries)
Asserts that the givenMap
does not contain the given entries.<K,V>
voidassertDoesNotContainKey(AssertionInfo info, Map<K,V> actual, K key)
Verifies that the actual map not contains the given key.<K,V>
voidassertDoesNotContainKeys(AssertionInfo info, Map<K,V> actual, K... keys)
Verifies that the actual map not contains all the given keys.<K,V>
voidassertDoesNotContainValue(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 givenMap
is empty.<K,V>
voidassertHasEntrySatisfying(AssertionInfo info, Map<K,V> actual, K key, Consumer<? super V> valueRequirements)
Verifies that theMap
contains the value for givenkey
that satisfy givenvalueRequirements
.<K,V>
voidassertHasEntrySatisfying(AssertionInfo info, Map<K,V> actual, K key, Condition<? super V> valueCondition)
Verifies that the givenMap
contains the value for givenkey
that satisfy givenvalueCondition
.<K,V>
voidassertHasEntrySatisfying(AssertionInfo info, Map<K,V> actual, Condition<? super Map.Entry<K,V>> entryCondition)
Verifies that the givenMap
contains an entry satisfying givenentryCondition
.<K,V>
voidassertHasEntrySatisfyingConditions(AssertionInfo info, Map<K,V> actual, Condition<? super K> keyCondition, Condition<? super V> valueCondition)
Verifies that the givenMap
contains an entry with key satisfyingkeyCondition
and value satisfyingvalueCondition
.<K> void
assertHasKeySatisfying(AssertionInfo info, Map<K,?> actual, Condition<? super K> keyCondition)
Verifies that the givenMap
contains an entry with key satisfyingkeyCondition
.void
assertHasSameSizeAs(AssertionInfo info, Map<?,?> map, Iterable<?> other)
Asserts that the number of entries in the givenMap
has the same size as the otherIterable
.void
assertHasSameSizeAs(AssertionInfo info, Map<?,?> map, Object other)
Asserts that the number of entries in the givenMap
has the same size as the other array.void
assertHasSameSizeAs(AssertionInfo info, Map<?,?> map, Map<?,?> other)
Asserts that the size of the givenMap
is equal to the size of the otherMap
.void
assertHasSize(AssertionInfo info, Map<?,?> actual, int expectedSize)
Asserts that the number of entries in the givenMap
is equal to the expected one.void
assertHasSizeBetween(AssertionInfo info, Map<?,?> actual, int lowerBoundary, int higherBoundary)
Asserts that the number of entries in the givenMap
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 givenMap
is greater than the boundary.void
assertHasSizeGreaterThanOrEqualTo(AssertionInfo info, Map<?,?> actual, int boundary)
Asserts that the number of entries in the givenMap
is greater than or equal to the boundary.void
assertHasSizeLessThan(AssertionInfo info, Map<?,?> actual, int boundary)
Asserts that the number of entries in the givenMap
is less than the boundary.void
assertHasSizeLessThanOrEqualTo(AssertionInfo info, Map<?,?> actual, int boundary)
Asserts that the number of entries in the givenMap
is less than or equal to the boundary.<V> void
assertHasValueSatisfying(AssertionInfo info, Map<?,V> actual, Condition<? super V> valueCondition)
Verifies that the givenMap
contains an entry with value satisfyingvalueCondition
.<K,V>
voidassertNoneSatisfy(AssertionInfo info, Map<K,V> actual, BiConsumer<? super K,? super V> entryRequirements)
void
assertNotEmpty(AssertionInfo info, Map<?,?> actual)
Asserts that the givenMap
is not empty.private void
assertNotNull(AssertionInfo info, Map<?,?> actual)
void
assertNullOrEmpty(AssertionInfo info, Map<?,?> actual)
Asserts that the givenMap
isnull
or empty.private <K,V>
voidcompareActualMapAndExpectedEntries(Map<K,V> actual, Map.Entry<? extends K,? extends V>[] entries, Set<Map.Entry<? extends K,? extends V>> notExpected, Set<Map.Entry<? extends K,? extends V>> notFound)
private <K,V>
voidcompareActualMapAndExpectedKeys(Map<K,V> actual, K[] keys, Set<K> notExpected, Set<K> notFound)
private <K,V>
booleancontainsEntry(Map<K,V> actual, Map.Entry<? extends K,? extends V> entry)
private <K,V>
voiddoCommonContainsCheck(AssertionInfo info, Map<K,V> actual, Map.Entry<? extends K,? extends V>[] entries)
private static <K,V>
Map<K,V>entriesToMap(Map.Entry<? extends K,? extends V>[] entries)
private static <K,V>
voidfailIfEmpty(Map.Entry<? extends K,? extends V>[] entries)
private static <K> void
failIfEmpty(K[] keys, String errorMessage)
private static <K,V>
voidfailIfEmptySinceActualIsNotEmpty(Map.Entry<? extends K,? extends V>[] values)
private static <K,V>
voidfailIfNull(Map.Entry<? extends K,? extends V>[] entries)
private static <K> void
failIfNull(K[] keys, String errorMessage)
private static <K,V>
voidfailIfNullOrEmpty(Map.Entry<? extends K,? extends V>[] entries)
private static <K,V>
Optional<UnsatisfiedRequirement>failsRequirements(BiConsumer<? super K,? super V> entryRequirements, Map.Entry<K,V> entry)
private <V,K>
Optional<Map.Entry<K,V>>failsRestrictions(Map.Entry<K,V> entry, BiConsumer<? super K,? super V> entryRequirements)
static Maps
instance()
Returns the singleton instance of this class.
-
-
-
Field Detail
-
INSTANCE
private static final Maps INSTANCE
-
failures
Failures failures
-
conditions
Conditions conditions
-
-
Method Detail
-
instance
public static Maps instance()
Returns the singleton instance of this class.- Returns:
- the singleton instance of this class.
-
assertAllSatisfy
public <K,V> void assertAllSatisfy(AssertionInfo info, Map<K,V> actual, BiConsumer<? super K,? super V> entryRequirements)
-
failsRequirements
private static <K,V> Optional<UnsatisfiedRequirement> failsRequirements(BiConsumer<? super K,? super V> entryRequirements, Map.Entry<K,V> entry)
-
assertAnySatisfy
public <K,V> void assertAnySatisfy(AssertionInfo info, Map<K,V> actual, BiConsumer<? super K,? super V> entryRequirements)
-
assertNoneSatisfy
public <K,V> void assertNoneSatisfy(AssertionInfo info, Map<K,V> actual, BiConsumer<? super K,? super V> entryRequirements)
-
failsRestrictions
private <V,K> Optional<Map.Entry<K,V>> failsRestrictions(Map.Entry<K,V> entry, BiConsumer<? super K,? super V> entryRequirements)
-
assertNullOrEmpty
public void assertNullOrEmpty(AssertionInfo info, Map<?,?> actual)
Asserts that the givenMap
isnull
or empty.- Parameters:
info
- contains information about the assertion.actual
- the given map.- Throws:
AssertionError
- if the givenMap
is notnull
*and* contains one or more entries.
-
assertEmpty
public void assertEmpty(AssertionInfo info, Map<?,?> actual)
Asserts that the givenMap
is empty.- Parameters:
info
- contains information about the assertion.actual
- the givenMap
.- Throws:
AssertionError
- if the givenMap
isnull
.AssertionError
- if the givenMap
is not empty.
-
assertNotEmpty
public void assertNotEmpty(AssertionInfo info, Map<?,?> actual)
Asserts that the givenMap
is not empty.- Parameters:
info
- contains information about the assertion.actual
- the givenMap
.- Throws:
AssertionError
- if the givenMap
isnull
.AssertionError
- if the givenMap
is empty.
-
assertHasSize
public void assertHasSize(AssertionInfo info, Map<?,?> actual, int expectedSize)
Asserts that the number of entries in the givenMap
is equal to the expected one.- Parameters:
info
- contains information about the assertion.actual
- the givenMap
.expectedSize
- the expected size ofactual
.- Throws:
AssertionError
- if the givenMap
isnull
.AssertionError
- if the number of entries in the givenMap
is different than the expected one.
-
assertHasSizeGreaterThan
public void assertHasSizeGreaterThan(AssertionInfo info, Map<?,?> actual, int boundary)
Asserts that the number of entries in the givenMap
is greater than the boundary.- Parameters:
info
- contains information about the assertion.actual
- the givenMap
.boundary
- the given value to compare the size ofactual
to.- Throws:
AssertionError
- if the givenMap
isnull
.AssertionError
- if the number of entries in the givenMap
is greater than the boundary.
-
assertHasSizeGreaterThanOrEqualTo
public void assertHasSizeGreaterThanOrEqualTo(AssertionInfo info, Map<?,?> actual, int boundary)
Asserts that the number of entries in the givenMap
is greater than or equal to the boundary.- Parameters:
info
- contains information about the assertion.actual
- the givenMap
.boundary
- the given value to compare the size ofactual
to.- Throws:
AssertionError
- if the givenMap
isnull
.AssertionError
- if the number of entries in the givenMap
is greater than or equal to the boundary.
-
assertHasSizeLessThan
public void assertHasSizeLessThan(AssertionInfo info, Map<?,?> actual, int boundary)
Asserts that the number of entries in the givenMap
is less than the boundary.- Parameters:
info
- contains information about the assertion.actual
- the givenMap
.boundary
- the given value to compare the size ofactual
to.- Throws:
AssertionError
- if the givenMap
isnull
.AssertionError
- if the number of entries in the givenMap
is less than the expected one.
-
assertHasSizeLessThanOrEqualTo
public void assertHasSizeLessThanOrEqualTo(AssertionInfo info, Map<?,?> actual, int boundary)
Asserts that the number of entries in the givenMap
is less than or equal to the boundary.- Parameters:
info
- contains information about the assertion.actual
- the givenMap
.boundary
- the given value to compare the size ofactual
to.- Throws:
AssertionError
- if the givenMap
isnull
.AssertionError
- if the number of entries in the givenMap
is less than or equal to the boundary.
-
assertHasSizeBetween
public void assertHasSizeBetween(AssertionInfo info, Map<?,?> actual, int lowerBoundary, int higherBoundary)
Asserts that the number of entries in the givenMap
is between the given lower and higher boundary (inclusive).- Parameters:
info
- contains information about the assertion.actual
- the givenMap
.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.- Throws:
AssertionError
- if the given array isnull
.AssertionError
- if the number of elements in the given array is not between the boundaries.
-
assertHasSameSizeAs
public void assertHasSameSizeAs(AssertionInfo info, Map<?,?> map, Iterable<?> other)
Asserts that the number of entries in the givenMap
has the same size as the otherIterable
.- Parameters:
info
- contains information about the assertion.map
- the givenMap
.other
- the group to compare- Throws:
AssertionError
- if the givenMap
isnull
.AssertionError
- if the givenIterable
isnull
.AssertionError
- if the number of entries in the givenMap
does not have the same size.
-
assertHasSameSizeAs
public void assertHasSameSizeAs(AssertionInfo info, Map<?,?> map, Object other)
Asserts that the number of entries in the givenMap
has the same size as the other array.- Parameters:
info
- contains information about the assertion.map
- the givenMap
.other
- the group to compare- Throws:
AssertionError
- if the givenMap
isnull
.AssertionError
- if the given array isnull
.AssertionError
- if the number of entries in the givenMap
does not have the same size.
-
assertHasSameSizeAs
public void assertHasSameSizeAs(AssertionInfo info, Map<?,?> map, Map<?,?> other)
Asserts that the size of the givenMap
is equal to the size of the otherMap
.- Parameters:
info
- contains information about the assertion.map
- the givenMap
.other
- the otherMap
to compare- Throws:
NullPointerException
- if the otherMap
isnull
.AssertionError
- if the givenMap
isnull
.AssertionError
- if the size of the givenMap
is not equal to the otherMap
size
-
assertContains
public <K,V> void assertContains(AssertionInfo info, Map<K,V> actual, Map.Entry<? extends K,? extends V>[] entries)
Asserts that the givenMap
contains the given entries, in any order.- Type Parameters:
K
- key typeV
- value type- Parameters:
info
- contains information about the assertion.actual
- the givenMap
.entries
- the entries that are expected to be in the givenMap
.- Throws:
NullPointerException
- if the array of entries isnull
.IllegalArgumentException
- if the array of entries is empty.NullPointerException
- if any of the entries in the given array isnull
.AssertionError
- if the givenMap
isnull
.AssertionError
- if the givenMap
does not contain the given entries.
-
assertContainsAnyOf
public <K,V> void assertContainsAnyOf(AssertionInfo info, Map<K,V> actual, Map.Entry<? extends K,? extends V>[] entries)
-
assertHasEntrySatisfying
public <K,V> void assertHasEntrySatisfying(AssertionInfo info, Map<K,V> actual, K key, Condition<? super V> valueCondition)
Verifies that the givenMap
contains the value for givenkey
that satisfy givenvalueCondition
.- Type Parameters:
K
- key typeV
- value type- Parameters:
info
- contains information about the assertion.actual
- the givenMap
.key
- he given key to check.valueCondition
- the given condition for check value.- Throws:
NullPointerException
- if the given values isnull
.AssertionError
- if the actual map isnull
.AssertionError
- if the actual map not contains the givenkey
.AssertionError
- if the actual map contains the given key, but value not match the givenvalueCondition
.- Since:
- 2.6.0 / 3.6.0
-
assertHasEntrySatisfying
public <K,V> void assertHasEntrySatisfying(AssertionInfo info, Map<K,V> actual, K key, Consumer<? super V> valueRequirements)
Verifies that theMap
contains the value for givenkey
that satisfy givenvalueRequirements
.- Type Parameters:
K
- key typeV
- value type- Parameters:
info
- contains information about the assertion.actual
- the givenMap
.key
- he given key to check.valueRequirements
- the given requirements for check value.- Throws:
NullPointerException
- if the given values isnull
.AssertionError
- if the actual map isnull
.AssertionError
- if the actual map not contains the givenkey
.AssertionError
- if the actual map contains the given key, but value not pass the givenvalueRequirements
.
-
assertHasEntrySatisfying
public <K,V> void assertHasEntrySatisfying(AssertionInfo info, Map<K,V> actual, Condition<? super Map.Entry<K,V>> entryCondition)
Verifies that the givenMap
contains an entry satisfying givenentryCondition
.- Type Parameters:
K
- key typeV
- value type- Parameters:
info
- contains information about the assertion.actual
- the givenMap
.entryCondition
- the condition for searching entry.- Throws:
NullPointerException
- if the given condition isnull
.AssertionError
- if the actual map isnull
.AssertionError
- if there is no entry matching givenentryCondition
.- Since:
- 2.7.0 / 3.7.0
-
assertHasEntrySatisfyingConditions
public <K,V> void assertHasEntrySatisfyingConditions(AssertionInfo info, Map<K,V> actual, Condition<? super K> keyCondition, Condition<? super V> valueCondition)
Verifies that the givenMap
contains an entry with key satisfyingkeyCondition
and value satisfyingvalueCondition
.- Type Parameters:
K
- key typeV
- value type- Parameters:
info
- contains information about the assertion.actual
- the givenMap
.keyCondition
- the condition for entry key.valueCondition
- the condition for entry value.- Throws:
NullPointerException
- if any of the given conditions isnull
.AssertionError
- if the actual map isnull
.AssertionError
- if there is no entry matching givenkeyCondition
andvalueCondition
.- Since:
- 2.7.0 / 3.7.0
-
assertHasKeySatisfying
public <K> void assertHasKeySatisfying(AssertionInfo info, Map<K,?> actual, Condition<? super K> keyCondition)
Verifies that the givenMap
contains an entry with key satisfyingkeyCondition
.- Type Parameters:
K
- key type- Parameters:
info
- contains information about the assertion.actual
- the givenMap
.keyCondition
- the condition for key search.- Throws:
NullPointerException
- if the given condition isnull
.AssertionError
- if the actual map isnull
.AssertionError
- if there is no key matching givenkeyCondition
.- Since:
- 2.7.0 / 3.7.0
-
assertHasValueSatisfying
public <V> void assertHasValueSatisfying(AssertionInfo info, Map<?,V> actual, Condition<? super V> valueCondition)
Verifies that the givenMap
contains an entry with value satisfyingvalueCondition
.- Type Parameters:
V
- value type- Parameters:
info
- contains information about the assertion.actual
- the givenMap
.valueCondition
- the condition for value search.- Throws:
NullPointerException
- if the given condition isnull
.AssertionError
- if the actual map isnull
.AssertionError
- if there is no value matching givenvalueCondition
.- Since:
- 2.7.0 / 3.7.0
-
assertDoesNotContain
public <K,V> void assertDoesNotContain(AssertionInfo info, Map<K,V> actual, Map.Entry<? extends K,? extends V>[] entries)
Asserts that the givenMap
does not contain the given entries.- Type Parameters:
K
- key typeV
- value type- Parameters:
info
- contains information about the assertion.actual
- the givenMap
.entries
- the entries that are expected to be in the givenMap
.- Throws:
NullPointerException
- if the array of entries isnull
.IllegalArgumentException
- if the array of entries is empty.NullPointerException
- if any of the entries in the given array isnull
.AssertionError
- if the givenMap
isnull
.AssertionError
- if the givenMap
contains any of the given entries.
-
assertContainsKeys
public <K,V> void assertContainsKeys(AssertionInfo info, Map<K,V> actual, K... keys)
Verifies that the actual map contain the given key.- Type Parameters:
K
- key typeV
- value type- Parameters:
info
- contains information about the assertion.actual
- the givenMap
.keys
- the given keys- Throws:
AssertionError
- if the actual map isnull
.AssertionError
- if the actual map not contains the given key.
-
assertDoesNotContainKey
public <K,V> void assertDoesNotContainKey(AssertionInfo info, Map<K,V> actual, K key)
Verifies that the actual map not contains the given key.- Type Parameters:
K
- key typeV
- value type- Parameters:
info
- contains information about the assertion.actual
- the givenMap
.key
- the given key- Throws:
AssertionError
- if the actual map isnull
.AssertionError
- if the actual map contains the given key.
-
assertDoesNotContainKeys
public <K,V> void assertDoesNotContainKeys(AssertionInfo info, Map<K,V> actual, K... keys)
Verifies that the actual map not contains all the given keys.- Type Parameters:
K
- key typeV
- value type- Parameters:
info
- contains information about the assertion.actual
- the givenMap
.keys
- the given keys- Throws:
AssertionError
- if the actual map isnull
.AssertionError
- if the actual map contains all the given keys.
-
assertContainsOnlyKeys
public <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.- Type Parameters:
K
- key typeV
- value type- Parameters:
info
- contains information about the assertion.actual
- the givenMap
.keys
- the keys that are expected to be in the givenMap
.- Throws:
NullPointerException
- if the array of keys isnull
.IllegalArgumentException
- if the array of keys is empty.AssertionError
- if the givenMap
isnull
.AssertionError
- if the givenMap
does not contain the given keys or if the givenMap
contains keys that are not in the given array.
-
assertContainsOnlyKeys
public <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.- Type Parameters:
K
- key typeV
- value type- Parameters:
info
- contains information about the assertion.actual
- the givenMap
.keys
- the keys that are expected to be in the givenMap
.- Throws:
NullPointerException
- if the array of keys isnull
.IllegalArgumentException
- if the array of keys is empty.AssertionError
- if the givenMap
isnull
.AssertionError
- if the givenMap
does not contain the given keys or if the givenMap
contains keys that are not in the given array.
-
assertContainsOnlyKeys
public <K,V> void assertContainsOnlyKeys(AssertionInfo info, Map<K,V> actual, String placeholderForErrorMessages, K[] keys)
-
assertContainsValue
public <K,V> void assertContainsValue(AssertionInfo info, Map<K,V> actual, V value)
Verifies that the actual map contain the given value.- Type Parameters:
K
- key typeV
- value type- Parameters:
info
- contains information about the assertion.actual
- the givenMap
.value
- the given value- Throws:
AssertionError
- if the actual map isnull
.AssertionError
- if the actual map not contains the given value.
-
assertContainsValues
public <K,V> void assertContainsValues(AssertionInfo info, Map<K,V> actual, V... values)
Verifies that the actual map contain the given values.- Type Parameters:
K
- key typeV
- value type- Parameters:
info
- contains information about the assertion.actual
- the givenMap
.values
- the given values- Throws:
AssertionError
- if the actual map isnull
.AssertionError
- if the actual map not contains the given values.NullPointerException
- if values vararg isnull
.
-
assertDoesNotContainValue
public <K,V> void assertDoesNotContainValue(AssertionInfo info, Map<K,V> actual, V value)
Verifies that the actual map not contains the given value.- Type Parameters:
K
- key typeV
- value type- Parameters:
info
- contains information about the assertion.actual
- the givenMap
.value
- the given value- Throws:
AssertionError
- if the actual map isnull
.AssertionError
- if the actual map contains the given value.
-
assertContainsOnly
public <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.- Type Parameters:
K
- key typeV
- value type- Parameters:
info
- contains information about the assertion.actual
- the givenMap
.entries
- the entries that should be in the actual map.- Throws:
AssertionError
- if the actual map isnull
.NullPointerException
- if the given entries array isnull
.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.
-
assertContainsExactly
public <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. don't use it withHashMap
).- Type Parameters:
K
- key typeV
- value type- Parameters:
info
- contains information about the assertion.actual
- the givenMap
.entries
- the given entries.- Throws:
NullPointerException
- if the given entries array isnull
.AssertionError
- if the actual map isnull
.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.
-
compareActualMapAndExpectedKeys
private <K,V> void compareActualMapAndExpectedKeys(Map<K,V> actual, K[] keys, Set<K> notExpected, Set<K> notFound)
-
compareActualMapAndExpectedEntries
private <K,V> void compareActualMapAndExpectedEntries(Map<K,V> actual, Map.Entry<? extends K,? extends V>[] entries, Set<Map.Entry<? extends K,? extends V>> notExpected, Set<Map.Entry<? extends K,? extends V>> notFound)
-
doCommonContainsCheck
private <K,V> void doCommonContainsCheck(AssertionInfo info, Map<K,V> actual, Map.Entry<? extends K,? extends V>[] entries)
-
entriesToMap
private static <K,V> Map<K,V> entriesToMap(Map.Entry<? extends K,? extends V>[] entries)
-
failIfEmpty
private static <K> void failIfEmpty(K[] keys, String errorMessage)
-
failIfEmpty
private static <K,V> void failIfEmpty(Map.Entry<? extends K,? extends V>[] entries)
-
failIfNullOrEmpty
private static <K,V> void failIfNullOrEmpty(Map.Entry<? extends K,? extends V>[] entries)
-
failIfNull
private static <K> void failIfNull(K[] keys, String errorMessage)
-
failIfNull
private static <K,V> void failIfNull(Map.Entry<? extends K,? extends V>[] entries)
-
containsEntry
private <K,V> boolean containsEntry(Map<K,V> actual, Map.Entry<? extends K,? extends V> entry)
-
assertNotNull
private void assertNotNull(AssertionInfo info, Map<?,?> actual)
-
failIfEmptySinceActualIsNotEmpty
private static <K,V> void failIfEmptySinceActualIsNotEmpty(Map.Entry<? extends K,? extends V>[] values)
-
-