Package org.assertj.guava.api
Class MultisetAssert<T>
- java.lang.Object
-
- org.assertj.core.api.AbstractAssert<SELF,ACTUAL>
-
- org.assertj.core.api.AbstractIterableAssert<MultisetAssert<T>,com.google.common.collect.Multiset<? extends T>,T,org.assertj.core.api.ObjectAssert<T>>
-
- org.assertj.guava.api.MultisetAssert<T>
-
- Type Parameters:
T
- the type of elements contained in the tested Multiset value
- All Implemented Interfaces:
org.assertj.core.api.Assert<MultisetAssert<T>,com.google.common.collect.Multiset<? extends T>>
,org.assertj.core.api.Descriptable<MultisetAssert<T>>
,org.assertj.core.api.EnumerableAssert<MultisetAssert<T>,T>
,org.assertj.core.api.ExtensionPoints<MultisetAssert<T>,com.google.common.collect.Multiset<? extends T>>
,org.assertj.core.api.ObjectEnumerableAssert<MultisetAssert<T>,T>
public 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>>
Assertions for guavaMultiset
.To create an instance of this class, invoke
Assertions.assertThat(Multiset)
- Author:
- Max Daniline
-
-
Field Summary
Fields Modifier and Type Field Description (package private) org.assertj.core.internal.Failures
failures
-
Constructor Summary
Constructors Modifier Constructor Description protected
MultisetAssert(com.google.common.collect.Multiset<? extends T> actual)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description MultisetAssert<T>
contains(int expectedCount, T expected)
Verifies the actualMultiset
contains the given value exactly the given number of times.MultisetAssert<T>
containsAtLeast(int minimumCount, T expected)
Verifies the actualMultiset
contains the given value at least the given number of times.MultisetAssert<T>
containsAtMost(int maximumCount, T expected)
Verifies the actualMultiset
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)
-
Methods inherited from class org.assertj.core.api.AbstractIterableAssert
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, element, endsWith, endsWith, extracting, extracting, extracting, extracting, extracting, extracting, extractingResultOf, extractingResultOf, filteredOn, filteredOn, filteredOn, filteredOn, filteredOnAssertions, filteredOnNull, first, first, flatExtracting, flatExtracting, flatExtracting, flatExtracting, flatExtracting, flatExtracting, getComparatorsByType, getComparatorsForElementPropertyOrFieldTypes, has, hasAtLeastOneElementOfType, hasOnlyElementsOfType, hasOnlyElementsOfTypes, hasOnlyOneElementSatisfying, hasSameClassAs, hasSameElementsAs, hasSameSizeAs, hasSameSizeAs, hasSize, hasSizeBetween, hasSizeGreaterThan, hasSizeGreaterThanOrEqualTo, hasSizeLessThan, hasSizeLessThanOrEqualTo, 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, last, navigationDescription, noneMatch, noneSatisfy, overridingErrorMessage, size, startsWith, usingComparator, usingComparator, usingComparatorForElementFieldsWithNames, usingComparatorForElementFieldsWithType, usingComparatorForType, usingComparisonStrategy, usingDefaultComparator, usingDefaultElementComparator, usingElementComparator, usingElementComparatorIgnoringFields, usingElementComparatorOnFields, usingFieldByFieldElementComparator, usingRecursiveComparison, usingRecursiveComparison, usingRecursiveFieldByFieldElementComparator, withFailMessage, withThreadDumpOnError, zipSatisfy
-
Methods inherited from class org.assertj.core.api.AbstractAssert
asInstanceOf, asList, assertionError, asString, descriptionText, equals, failWithMessage, getWritableAssertionInfo, hashCode, hasSameHashCodeAs, isInstanceOfSatisfying, isNull, matches, matches, newListAssertInstance, satisfies, satisfies, satisfiesAnyOf, satisfiesAnyOf, setCustomRepresentation, throwAssertionError, withRepresentation
-
-
-
-
Constructor Detail
-
MultisetAssert
protected MultisetAssert(com.google.common.collect.Multiset<? extends T> actual)
-
-
Method Detail
-
contains
public MultisetAssert<T> contains(int expectedCount, T expected)
Verifies the actualMultiset
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");
- Parameters:
expectedCount
- the exact number of times the given value should appear in the setexpected
- the value which to expect- Returns:
- this
MultisetAssert
for fluent chaining - Throws:
AssertionError
- if the actualMultiset
is nullAssertionError
- if the actualMultiset
contains the given value a number of times different to the given count
-
containsAtLeast
public MultisetAssert<T> containsAtLeast(int minimumCount, T expected)
Verifies the actualMultiset
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");
- Parameters:
minimumCount
- the minimum number of times the given value should appear in the setexpected
- the value which to expect- Returns:
- this
MultisetAssert
for fluent chaining - Throws:
AssertionError
- if the actualMultiset
is nullAssertionError
- if the actualMultiset
contains the given value fewer times than the given count
-
containsAtMost
public MultisetAssert<T> containsAtMost(int maximumCount, T expected)
Verifies the actualMultiset
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");
- Parameters:
maximumCount
- the maximum number of times the given value should appear in the setexpected
- the value which to expect- Returns:
- this
MultisetAssert
for fluent chaining - Throws:
AssertionError
- if the actualMultiset
is nullAssertionError
- if the actualMultiset
contains the given value more times than the given count
-
toAssert
protected org.assertj.core.api.ObjectAssert<T> toAssert(T value, String description)
- Specified by:
toAssert
in classorg.assertj.core.api.AbstractIterableAssert<MultisetAssert<T>,com.google.common.collect.Multiset<? extends T>,T,org.assertj.core.api.ObjectAssert<T>>
-
newAbstractIterableAssert
protected MultisetAssert<T> newAbstractIterableAssert(Iterable<? extends T> iterable)
- Specified by:
newAbstractIterableAssert
in classorg.assertj.core.api.AbstractIterableAssert<MultisetAssert<T>,com.google.common.collect.Multiset<? extends T>,T,org.assertj.core.api.ObjectAssert<T>>
-
-