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 MultisetAssert<T> |
newAbstractIterableAssert(Iterable<? extends T> iterable) |
protected org.assertj.core.api.ObjectAssert<T> |
toAssert(T value,
String description) |
allMatch, allMatch, allSatisfy, anyMatch, anySatisfy, are, areAtLeast, areAtLeastOne, areAtMost, areExactly, areNot, as, as, contains, containsAll, containsAnyElementsOf, containsAnyOf, containsExactly, containsExactlyElementsOf, containsExactlyInAnyOrder, containsExactlyInAnyOrderElementsOf, containsNull, containsOnly, containsOnlyElementsOf, containsOnlyNulls, containsOnlyOnce, containsSequence, containsSequence, containsSubsequence, containsSubsequence, describedAs, describedAs, doesNotContain, doesNotContainAnyElementsOf, doesNotContainNull, doesNotContainSequence, doesNotContainSequence, doesNotContainSubsequence, doesNotContainSubsequence, doesNotHave, doesNotHaveAnyElementsOfTypes, doesNotHaveDuplicates, doesNotHaveSameClassAs, doNotHave, element, endsWith, endsWith, extracting, extracting, extracting, extracting, extracting, extracting, extractingResultOf, extractingResultOf, filteredOn, filteredOn, filteredOn, filteredOn, filteredOnAssertions, filteredOnNull, first, flatExtracting, flatExtracting, flatExtracting, flatExtracting, flatExtracting, flatExtracting, getComparatorsByType, getComparatorsForElementPropertyOrFieldTypes, has, hasAtLeastOneElementOfType, hasOnlyElementsOfType, hasOnlyElementsOfTypes, 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, noneMatch, noneSatisfy, overridingErrorMessage, size, startsWith, toLazyIterable, usingComparator, usingComparator, usingComparatorForElementFieldsWithNames, usingComparatorForElementFieldsWithType, usingComparatorForType, usingComparisonStrategy, usingDefaultComparator, usingDefaultElementComparator, usingElementComparator, usingElementComparatorIgnoringFields, usingElementComparatorOnFields, usingFieldByFieldElementComparator, usingRecursiveFieldByFieldElementComparator, withFailMessage, withThreadDumpOnError, zipSatisfy
asList, asString, descriptionText, equals, failWithMessage, getWritableAssertionInfo, hashCode, hasSameHashCodeAs, isInstanceOfSatisfying, isNull, matches, matches, newListAssertInstance, satisfies, satisfies, setCustomRepresentation, throwAssertionError, withRepresentation
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 countprotected org.assertj.core.api.ObjectAssert<T> toAssert(T value, String description)
toAssert
in class org.assertj.core.api.AbstractIterableAssert<MultisetAssert<T>,com.google.common.collect.Multiset<? extends T>,T,org.assertj.core.api.ObjectAssert<T>>
protected MultisetAssert<T> newAbstractIterableAssert(Iterable<? extends T> iterable)
newAbstractIterableAssert
in class org.assertj.core.api.AbstractIterableAssert<MultisetAssert<T>,com.google.common.collect.Multiset<? extends T>,T,org.assertj.core.api.ObjectAssert<T>>
Copyright © 2018 AssertJ. All rights reserved.