Package org.fest.assertions.internal
Class Maps
java.lang.Object
org.fest.assertions.internal.Maps
Reusable assertions for
Map
s.- Author:
- Alex Ruiz, Nicolas François
-
Method Summary
Modifier and TypeMethodDescriptionvoid
assertContains
(AssertionInfo info, Map<?, ?> actual, MapEntry[] entries) Asserts that the givenMap
contains the given entries, in any order.<K,
V> void assertContainsKey
(AssertionInfo info, Map<K, V> actual, K key) Verifies that the actual map contain the given key.<K,
V> void assertContainsValue
(AssertionInfo info, Map<K, V> actual, V value) Verifies that the actual map contain the given value.void
assertDoesNotContain
(AssertionInfo info, Map<?, ?> actual, MapEntry[] entries) Asserts that the givenMap
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 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 givenMap
is empty.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
assertHasSize
(AssertionInfo info, Map<?, ?> actual, int expectedSize) Asserts that the number of entries in the givenMap
is equal to the expected one.void
assertNotEmpty
(AssertionInfo info, Map<?, ?> actual) Asserts that the givenMap
is not empty.void
assertNullOrEmpty
(AssertionInfo info, Map<?, ?> actual) Asserts that the givenMap
isnull
or empty.static Maps
instance()
Returns the singleton instance of this class.
-
Method Details
-
instance
Returns the singleton instance of this class.- Returns:
- the singleton instance of this class.
-
assertNullOrEmpty
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
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
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
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.
-
assertHasSameSizeAs
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
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.
-
assertContains
Asserts that the givenMap
contains the given entries, in any order.- 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.
-
assertDoesNotContain
Asserts that the givenMap
does not contain the given entries.- 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.
-
assertContainsKey
Verifies that the actual map contain the given key.- 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 not contains the given key.
-
assertDoesNotContainKey
Verifies that the actual map not contains the given key.- 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.
-
assertContainsValue
Verifies that the actual map contain the given value.- 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.
-
assertDoesNotContainValue
Verifies that the actual map not contains the given value.- 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.
-