T
- the type of elements contained in the tested Multiset valuepublic class MultisetAssert<T> extends org.assertj.core.api.AbstractIterableAssert<MultisetAssert<T>,com.google.common.collect.Multiset<? extends T>,T,org.assertj.core.api.ObjectAssert<T>>
Multiset
.
To create an instance of this class, invoke Assertions.assertThat(Multiset)
Modifier | Constructor and Description |
---|---|
protected |
MultisetAssert(com.google.common.collect.Multiset<? extends T> actual) |
Modifier and Type | Method and Description |
---|---|
MultisetAssert<T> |
contains(int expectedCount,
T expected)
Verifies the actual
Multiset contains the given value exactly the given number of times. |
MultisetAssert<T> |
containsAtLeast(int minimumCount,
T expected)
Verifies the actual
Multiset contains the given value at least the given number of times. |
MultisetAssert<T> |
containsAtMost(int maximumCount,
T expected)
Verifies the actual
Multiset contains the given value at most the given number of times. |
protected org.assertj.core.api.ObjectAssert<T> |
toAssert(T value,
String description) |
allMatch, are, areAtLeast, areAtLeastOne, areAtMost, areExactly, areNot, as, as, contains, containsAll, containsExactly, containsExactlyElementsOf, containsExactlyInAnyOrder, containsNull, containsOnly, containsOnlyElementsOf, containsOnlyOnce, containsSequence, containsSubsequence, describedAs, describedAs, doesNotContain, doesNotContainAnyElementsOf, doesNotContainNull, doesNotHave, doesNotHaveDuplicates, doesNotHaveSameClassAs, doNotHave, element, endsWith, extracting, extracting, extracting, extracting, extracting, extractingResultOf, extractingResultOf, filteredOn, filteredOn, filteredOn, filteredOn, filteredOnNull, first, flatExtracting, flatExtracting, flatExtracting, flatExtracting, has, hasAtLeastOneElementOfType, hasOnlyElementsOfType, hasOnlyOneElementSatisfying, hasSameClassAs, hasSameElementsAs, hasSameSizeAs, hasSameSizeAs, hasSize, hasToString, have, haveAtLeast, haveAtLeastOne, haveAtMost, haveExactly, inBinary, inHexadecimal, is, isEmpty, isEqualTo, isExactlyInstanceOf, isIn, isIn, isInstanceOf, isInstanceOfAny, isNot, isNotEmpty, isNotEqualTo, isNotExactlyInstanceOf, isNotIn, isNotIn, isNotInstanceOf, isNotInstanceOfAny, isNotNull, isNotOfAnyClassIn, isNotSameAs, isNullOrEmpty, isOfAnyClassIn, isSameAs, isSubsetOf, isSubsetOf, last, navigationDescription, overridingErrorMessage, size, startsWith, usingComparator, usingComparatorForElementFieldsWithNames, usingComparatorForElementFieldsWithType, usingComparisonStrategy, usingDefaultComparator, usingDefaultElementComparator, usingElementComparator, usingElementComparatorIgnoringFields, usingElementComparatorOnFields, usingFieldByFieldElementComparator, usingRecursiveFieldByFieldElementComparator, withFailMessage, withThreadDumpOnError
protected MultisetAssert(com.google.common.collect.Multiset<? extends T> actual)
public MultisetAssert<T> contains(int expectedCount, T expected)
Multiset
contains the given value exactly the given number of times.
Example :
Multiset<String> actual = HashMultiset.create();
actual.add("shoes", 2);
// assertion succeeds
assertThat(actual).contains(2, "shoes");
// assertions fail
assertThat(actual).contains(1, "shoes");
assertThat(actual).contains(3, "shoes");
expectedCount
- the exact number of times the given value should appear in the setexpected
- the value which to expectMultisetAssert
for fluent chainingAssertionError
- if the actual Multiset
is nullAssertionError
- if the actual Multiset
contains the given value a number of times different to the given countpublic MultisetAssert<T> containsAtLeast(int minimumCount, T expected)
Multiset
contains the given value at least the given number of times.
Example :
Multiset<String> actual = HashMultiset.create();
actual.add("shoes", 2);
// assertions succeed
assertThat(actual).containsAtLeast(1, "shoes");
assertThat(actual).containsAtLeast(2, "shoes");
// assertion fails
assertThat(actual).containsAtLeast(3, "shoes");
minimumCount
- the minimum number of times the given value should appear in the setexpected
- the value which to expectMultisetAssert
for fluent chainingAssertionError
- if the actual Multiset
is nullAssertionError
- if the actual Multiset
contains the given value fewer times than the given countpublic MultisetAssert<T> containsAtMost(int maximumCount, T expected)
Multiset
contains the given value at most the given number of times.
Example :
Multiset<String> actual = HashMultiset.create();
actual.add("shoes", 2);
// assertions succeed
assertThat(actual).containsAtMost(3, "shoes");
assertThat(actual).containsAtMost(2, "shoes");
// assertion fails
assertThat(actual).containsAtMost(1, "shoes");
maximumCount
- the maximum number of times the given value should appear in the setexpected
- the value which to expectMultisetAssert
for fluent chainingAssertionError
- if the actual Multiset
is nullAssertionError
- if the actual Multiset
contains the given value more times than the given countCopyright © 2016 AssertJ. All rights reserved.