public class MultimapAssert<K,V> extends org.assertj.core.api.AbstractAssert<MultimapAssert<K,V>,com.google.common.collect.Multimap<K,V>>
Multimap.| Modifier | Constructor and Description |
|---|---|
protected |
MultimapAssert(com.google.common.collect.Multimap<K,V> actual) |
| Modifier and Type | Method and Description |
|---|---|
MultimapAssert<K,V> |
contains(org.assertj.core.data.MapEntry... entries)
Verifies that the actual
Multimap contains the given entries. |
MultimapAssert<K,V> |
containsKeys(K... keys)
Verifies that the actual
Multimap contains the given keys. |
MultimapAssert<K,V> |
containsValues(V... values)
Verifies that the actual
Multimap contains the given values for any key. |
protected com.google.common.collect.Multimap<K,V> |
getActual() |
MultimapAssert<K,V> |
hasSize(int expectedSize)
Verifies that the number of values in the actual
Multimap is equal to the given one. |
void |
isEmpty()
Verifies that the actual
Multimap is empty. |
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, usingDefaultComparatorpublic MultimapAssert<K,V> containsKeys(K... keys)
Multimap contains the given keys.Example :
Multimap<String, String> actual = ArrayListMultimap.create();
// add several values for each key.
actual.putAll("Lakers", newArrayList("Kobe Bryant", "Magic Johnson", "Kareem Abdul Jabbar"));
actual.putAll("Spurs", newArrayList("Tony Parker", "Tim Duncan", "Manu Ginobili"));
actual.putAll("Bulls", newArrayList("Michael Jordan", "Scottie Pippen", "Derrick Rose"));
assertThat(actual).containsKeys("Lakers", "Bulls");
If the keys argument is null or empty, an IllegalArgumentException is thrown.
keys - the keys to look for in actual Multimap.MultimapAssert for assertions chaining.IllegalArgumentException - if no param keys have been set.AssertionError - if the actual Multimap is null.AssertionError - if the actual Multimap does not contain the given keys.public MultimapAssert<K,V> contains(org.assertj.core.data.MapEntry... entries)
Multimap contains the given entries.Example :
Multimap<String, String> actual = ArrayListMultimap.create();
// add several values for each entrie.
actual.putAll("Lakers", newArrayList("Kobe Bryant", "Magic Johnson", "Kareem Abdul Jabbar"));
actual.putAll("Spurs", newArrayList("Tony Parker", "Tim Duncan", "Manu Ginobili"));
actual.putAll("Bulls", newArrayList("Michael Jordan", "Scottie Pippen", "Derrick Rose"));
// entry can be statically imported from org.assertj.guava.api.Assertions or org.assertj.guava.data.MapEntry
assertThat(actual).contains(entry("Lakers", "Kobe Bryant"), entry("Spurs", "Tim Duncan"));
If the entries argument is null or empty, an IllegalArgumentException is thrown.
entries - the entries to look for in actual Multimap.MultimapAssert for assertions chaining.IllegalArgumentException - if no param entries have been set.AssertionError - if the actual Multimap is null.AssertionError - if the actual Multimap does not contain the given entries.public MultimapAssert<K,V> containsValues(V... values)
Multimap contains the given values for any key.Example :
Multimap<String, String> actual = ArrayListMultimap.create();
// add several values for each value.
actual.putAll("Lakers", newArrayList("Kobe Bryant", "Magic Johnson", "Kareem Abdul Jabbar"));
actual.putAll("Spurs", newArrayList("Tony Parker", "Tim Duncan", "Manu Ginobili"));
actual.putAll("Bulls", newArrayList("Michael Jordan", "Scottie Pippen", "Derrick Rose"));
// note that given values are not linked to same key
assertThat(actual).containsValues("Kobe Bryant", "Michael Jordan");
If the values argument is null or empty, an IllegalArgumentException is thrown.
values - the values to look for in actual Multimap.MultimapAssert for assertions chaining.IllegalArgumentException - if no param values have been set.AssertionError - if the actual Multimap is null.AssertionError - if the actual Multimap does not contain the given values.public void isEmpty()
Multimap is empty.AssertionError - if the actual Multimap is null.AssertionError - if the actual Multimap is not empty.public MultimapAssert<K,V> hasSize(int expectedSize)
Multimap is equal to the given one.expectedSize - the expected size of actual Multimap.MultimapAssert for assertions chaining.AssertionError - if the actual Multimap is null.AssertionError - if the number of values of the actual Multimap is not equal to the given one.Copyright © 2013 AssertJ. All Rights Reserved.