Package org.fest.assertions.internal
Class Maps
- java.lang.Object
-
- org.fest.assertions.internal.Maps
-
public class Maps extends java.lang.ObjectReusable assertions fors.Map- Author:
- Alex Ruiz, Nicolas François
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidassertContains(AssertionInfo info, java.util.Map<?,?> actual, MapEntry[] entries)Asserts that the givenMapcontains the given entries, in any order.<K,V>
voidassertContainsKey(AssertionInfo info, java.util.Map<K,V> actual, K key)Verifies that the actual map contain the given key.<K,V>
voidassertContainsValue(AssertionInfo info, java.util.Map<K,V> actual, V value)Verifies that the actual map contain the given value.voidassertDoesNotContain(AssertionInfo info, java.util.Map<?,?> actual, MapEntry[] entries)Asserts that the givenMapdoes not contain the given entries.<K,V>
voidassertDoesNotContainKey(AssertionInfo info, java.util.Map<K,V> actual, K key)Verifies that the actual map not contains the given key.<K,V>
voidassertDoesNotContainValue(AssertionInfo info, java.util.Map<K,V> actual, V value)Verifies that the actual map not contains the given value.voidassertEmpty(AssertionInfo info, java.util.Map<?,?> actual)Asserts that the givenMapis empty.voidassertHasSameSizeAs(AssertionInfo info, java.util.Map<?,?> map, java.lang.Iterable<?> other)Asserts that the number of entries in the givenMaphas the same size as the otherIterable.voidassertHasSameSizeAs(AssertionInfo info, java.util.Map<?,?> map, java.lang.Object[] other)Asserts that the number of entries in the givenMaphas the same size as the other array.voidassertHasSize(AssertionInfo info, java.util.Map<?,?> actual, int expectedSize)Asserts that the number of entries in the givenMapis equal to the expected one.voidassertNotEmpty(AssertionInfo info, java.util.Map<?,?> actual)Asserts that the givenMapis not empty.voidassertNullOrEmpty(AssertionInfo info, java.util.Map<?,?> actual)Asserts that the givenMapisnullor empty.static Mapsinstance()Returns the singleton instance of this class.
-
-
-
Method Detail
-
instance
public static Maps instance()
Returns the singleton instance of this class.- Returns:
- the singleton instance of this class.
-
assertNullOrEmpty
public void assertNullOrEmpty(AssertionInfo info, java.util.Map<?,?> actual)
Asserts that the givenMapisnullor empty.- Parameters:
info- contains information about the assertion.actual- the given map.- Throws:
java.lang.AssertionError- if the givenMapis notnull*and* contains one or more entries.
-
assertEmpty
public void assertEmpty(AssertionInfo info, java.util.Map<?,?> actual)
Asserts that the givenMapis empty.- Parameters:
info- contains information about the assertion.actual- the givenMap.- Throws:
java.lang.AssertionError- if the givenMapisnull.java.lang.AssertionError- if the givenMapis not empty.
-
assertNotEmpty
public void assertNotEmpty(AssertionInfo info, java.util.Map<?,?> actual)
Asserts that the givenMapis not empty.- Parameters:
info- contains information about the assertion.actual- the givenMap.- Throws:
java.lang.AssertionError- if the givenMapisnull.java.lang.AssertionError- if the givenMapis empty.
-
assertHasSize
public void assertHasSize(AssertionInfo info, java.util.Map<?,?> actual, int expectedSize)
Asserts that the number of entries in the givenMapis equal to the expected one.- Parameters:
info- contains information about the assertion.actual- the givenMap.expectedSize- the expected size ofactual.- Throws:
java.lang.AssertionError- if the givenMapisnull.java.lang.AssertionError- if the number of entries in the givenMapis different than the expected one.
-
assertHasSameSizeAs
public void assertHasSameSizeAs(AssertionInfo info, java.util.Map<?,?> map, java.lang.Iterable<?> other)
Asserts that the number of entries in the givenMaphas the same size as the otherIterable.- Parameters:
info- contains information about the assertion.map- the givenMap.other- the group to compare- Throws:
java.lang.AssertionError- if the givenMapisnull.java.lang.AssertionError- if the givenIterableisnull.java.lang.AssertionError- if the number of entries in the givenMapdoes not have the same size.
-
assertHasSameSizeAs
public void assertHasSameSizeAs(AssertionInfo info, java.util.Map<?,?> map, java.lang.Object[] other)
Asserts that the number of entries in the givenMaphas the same size as the other array.- Parameters:
info- contains information about the assertion.map- the givenMap.other- the group to compare- Throws:
java.lang.AssertionError- if the givenMapisnull.java.lang.AssertionError- if the given array isnull.java.lang.AssertionError- if the number of entries in the givenMapdoes not have the same size.
-
assertContains
public void assertContains(AssertionInfo info, java.util.Map<?,?> actual, MapEntry[] entries)
Asserts that the givenMapcontains 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:
java.lang.NullPointerException- if the array of entries isnull.java.lang.IllegalArgumentException- if the array of entries is empty.java.lang.NullPointerException- if any of the entries in the given array isnull.java.lang.AssertionError- if the givenMapisnull.java.lang.AssertionError- if the givenMapdoes not contain the given entries.
-
assertDoesNotContain
public void assertDoesNotContain(AssertionInfo info, java.util.Map<?,?> actual, MapEntry[] entries)
Asserts that the givenMapdoes 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:
java.lang.NullPointerException- if the array of entries isnull.java.lang.IllegalArgumentException- if the array of entries is empty.java.lang.NullPointerException- if any of the entries in the given array isnull.java.lang.AssertionError- if the givenMapisnull.java.lang.AssertionError- if the givenMapcontains any of the given entries.
-
assertContainsKey
public <K,V> void assertContainsKey(AssertionInfo info, java.util.Map<K,V> actual, K key)
Verifies that the actual map contain the given key.- Parameters:
info- contains information about the assertion.actual- the givenMap.key- the given key- Throws:
java.lang.AssertionError- if the actual map isnull.java.lang.AssertionError- if the actual map not contains the given key.
-
assertDoesNotContainKey
public <K,V> void assertDoesNotContainKey(AssertionInfo info, java.util.Map<K,V> actual, K key)
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:
java.lang.AssertionError- if the actual map isnull.java.lang.AssertionError- if the actual map contains the given key.
-
assertContainsValue
public <K,V> void assertContainsValue(AssertionInfo info, java.util.Map<K,V> actual, V value)
Verifies that the actual map contain the given value.- Parameters:
info- contains information about the assertion.actual- the givenMap.value- the given value- Throws:
java.lang.AssertionError- if the actual map isnull.java.lang.AssertionError- if the actual map not contains the given value.
-
assertDoesNotContainValue
public <K,V> void assertDoesNotContainValue(AssertionInfo info, java.util.Map<K,V> actual, V value)
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:
java.lang.AssertionError- if the actual map isnull.java.lang.AssertionError- if the actual map contains the given value.
-
-