Uses of Interface
org.hamcrest.Matcher
Packages that use Matcher
Package
Description
Matchers of Java Bean properties and their values.
Matchers of arrays and collections.
Fundamental matchers of objects and values, and composite matchers.
Matchers that perform numeric comparisons.
Matchers that inspect objects and classes.
Matchers that perform text comparisons.
Matchers of XML documents.
-
Uses of Matcher in org.hamcrest
Classes in org.hamcrest that implement MatcherModifier and TypeClassDescriptionclassBaseMatcher<T>BaseClass for all Matcher implementations.classUtility class for writing one off matchers.classUtility class for writing one off matchers.classTODO(ngd): Document.classFeatureMatcher<T,U> Supporting class for matching a feature of an object.classConvenient base class for Matchers that require a non-null value of a specific type and that will report why the received value has been rejected.classConvenient base class for Matchers that require a non-null value of a specific type.Fields in org.hamcrest declared as MatcherMethods in org.hamcrest that return MatcherModifier and TypeMethodDescriptionstatic <T> Matcher<T> Creates a matcher that matches if the examined object matches ALL of the specified matchers.static <T> Matcher<T> Creates a matcher that matches if the examined object matches ALL of the specified matchers.static <T> Matcher<T> Creates a matcher that matches if the examined object matches ALL of the specified matchers.static <T> Matcher<T> Creates a matcher that matches if the examined object matches ALL of the specified matchers.static <T> Matcher<T> Creates a matcher that matches if the examined object matches ALL of the specified matchers.static <T> Matcher<T> Creates a matcher that matches if the examined object matches ALL of the specified matchers.static <T> Matcher<T> Matchers.allOf(Matcher<? super T> first, Matcher<? super T> second, Matcher<? super T> third, Matcher<? super T> fourth) Creates a matcher that matches if the examined object matches ALL of the specified matchers.static <T> Matcher<T> Matchers.allOf(Matcher<? super T> first, Matcher<? super T> second, Matcher<? super T> third, Matcher<? super T> fourth, Matcher<? super T> fifth) Creates a matcher that matches if the examined object matches ALL of the specified matchers.static <T> Matcher<T> Matchers.allOf(Matcher<? super T> first, Matcher<? super T> second, Matcher<? super T> third, Matcher<? super T> fourth, Matcher<? super T> fifth, Matcher<? super T> sixth) Creates a matcher that matches if the examined object matches ALL of the specified matchers.Matchers.aMapWithSize(int size) Creates a matcher forMaps that matches when thesize()method returns a value equal to the specifiedsize.Matchers.aMapWithSize(Matcher<? super Integer> sizeMatcher) Creates a matcher forMaps that matches when thesize()method returns a value that satisfies the specified matcher.Matchers.anEmptyMap()Creates a matcher forMaps that matches when thesize()method returns zero.static <T> Matcher<T> Creates a matcher that matches when the examined object is an instance of the specifiedtype, as determined by calling theClass.isInstance(Object)method on that type, passing the the examined object.static <T> Matcher<T> Creates a matcher that matches when the examined object is an instance of the specifiedtype, as determined by calling theClass.isInstance(Object)method on that type, passing the the examined object.CoreMatchers.anything()Creates a matcher that always matches, regardless of the examined object.Creates a matcher that always matches, regardless of the examined object, but describes itself with the specifiedString.Matchers.anything()Creates a matcher that always matches, regardless of the examined object.Creates a matcher that always matches, regardless of the examined object, but describes itself with the specifiedString.static <E> Matcher<E[]> Matchers.arrayContaining(E... items) Creates a matcher for arrays that matches when each item in the examined array is logically equal to the corresponding item in the specified items.static <E> Matcher<E[]> Matchers.arrayContaining(List<Matcher<? super E>> itemMatchers) Creates a matcher for arrays that matches when each item in the examined array satisfies the corresponding matcher in the specified list of matchers.static <E> Matcher<E[]> Matchers.arrayContaining(Matcher<? super E>... itemMatchers) Creates a matcher for arrays that matches when each item in the examined array satisfies the corresponding matcher in the specified matchers.static <E> Matcher<E[]> Matchers.arrayContainingInAnyOrder(E... items) Creates an order agnostic matcher for arrays that matches when each item in the examined array is logically equal to one item anywhere in the specified items.static <E> Matcher<E[]> Matchers.arrayContainingInAnyOrder(Collection<Matcher<? super E>> itemMatchers) Creates an order agnostic matcher for arrays that matches when each item in the examined array satisfies one matcher anywhere in the specified collection of matchers.static <E> Matcher<E[]> Matchers.arrayContainingInAnyOrder(Matcher<? super E>... itemMatchers) Creates an order agnostic matcher for arrays that matches when each item in the examined array satisfies one matcher anywhere in the specified matchers.static <E> Matcher<E[]> Matchers.arrayWithSize(int size) Creates a matcher for arrays that matches when thelengthof the array equals the specifiedsize.static <E> Matcher<E[]> Matchers.arrayWithSize(Matcher<? super Integer> sizeMatcher) Creates a matcher for arrays that matches when thelengthof the array satisfies the specified matcher.Matchers.blankOrNullString()Creates a matcher ofStringthat matches when the examined string isnull, or contains zero or more whitespace characters and nothing else.Matchers.blankString()Creates a matcher ofStringthat matches when the examined string contains zero or more whitespace characters and nothing else.Matchers.closeTo(double operand, double error) Creates a matcher ofDoubles that matches when an examined double is equal to the specifiedoperand, within a range of +/-error.static Matcher<BigDecimal> Matchers.closeTo(BigDecimal operand, BigDecimal error) Creates a matcher ofBigDecimals that matches when an examined BigDecimal is equal to the specifiedoperand, within a range of +/-error.static <T extends Comparable<T>>
Matcher<T> Matchers.comparesEqualTo(T value) Creates a matcher ofComparableobject that matches when the examined object is equal to the specified value, as reported by thecompareTomethod of the examined object.Matchers.contains(E... items) Matchers.containsInAnyOrder(Collection<Matcher<? super T>> itemMatchers) Matchers.containsInAnyOrder(Matcher<? super T>... itemMatchers) Matchers.containsInAnyOrder(T... items) Matchers.containsInRelativeOrder(E... items) Matchers.containsInRelativeOrder(List<Matcher<? super E>> itemMatchers) Matchers.containsInRelativeOrder(Matcher<? super E>... itemMatchers) CoreMatchers.containsString(String substring) Matchers.containsString(String substring) CoreMatchers.containsStringIgnoringCase(String substring) Matchers.containsStringIgnoringCase(String substring) static <T> Matcher<T> CoreMatchers.describedAs(String description, Matcher<T> matcher, Object... values) Wraps an existing matcher, overriding its description with that specified.static <T> Matcher<T> Matchers.describedAs(String description, Matcher<T> matcher, Object... values) Wraps an existing matcher, overriding its description with that specified.static <E> Matcher<Collection<? extends E>> Matchers.empty()static <E> Matcher<E[]> Matchers.emptyArray()Creates a matcher for arrays that matches when thelengthof the array is zero.static <E> Matcher<Collection<E>> Matchers.emptyCollectionOf(Class<E> unusedToForceReturnType) Matchers.emptyIterable()Creates a matcher forIterables matching examined iterables that yield no items.Matchers.emptyIterableOf(Class<E> unusedToForceReturnType) Creates a matcher forIterables matching examined iterables that yield no items.Matchers.emptyOrNullString()Creates a matcher ofStringthat matches when the examined string isnull, or has zero length.Matchers.emptyString()Creates a matcher ofStringthat matches when the examined string has zero length.CoreMatchers.endsWithIgnoringCase(String suffix) Matchers.endsWithIgnoringCase(String suffix) static <T> Matcher<T> CoreMatchers.equalTo(T operand) Creates a matcher that matches when the examined object is logically equal to the specifiedoperand, as determined by calling theObject.equals(java.lang.Object)method on the examined object.static <T> Matcher<T> Matchers.equalTo(T operand) Creates a matcher that matches when the examined object is logically equal to the specifiedoperand, as determined by calling theObject.equals(java.lang.Object)method on the examined object.Matchers.equalToCompressingWhiteSpace(String expectedString) Creates a matcher ofStringthat matches when the examined string is equal to the specified expectedString, when whitespace differences are (mostly) ignored.Matchers.equalToIgnoringCase(String expectedString) Creates a matcher ofStringthat matches when the examined string is equal to the specified expectedString, ignoring case.Matchers.equalToIgnoringWhiteSpace(String expectedString) Deprecated.CoreMatchers.equalToObject(Object operand) Creates anIsEqualmatcher that does not enforce the values being compared to be of the same static type.Matchers.equalToObject(Object operand) Creates anIsEqualmatcher that does not enforce the values being compared to be of the same static type.static Matcher<EventObject> Matchers.eventFrom(Class<? extends EventObject> eventClass, Object source) Creates a matcher ofEventObjectthat matches any object derived from eventClass announced by source.static Matcher<EventObject> Creates a matcher ofEventObjectthat matches any EventObject announced by source.static <T extends Comparable<T>>
Matcher<T> Matchers.greaterThan(T value) Creates a matcher ofComparableobject that matches when the examined object is greater than the specified value, as reported by thecompareTomethod of the examined object.static <T extends Comparable<T>>
Matcher<T> Matchers.greaterThanOrEqualTo(T value) Creates a matcher ofComparableobject that matches when the examined object is greater than or equal to the specified value, as reported by thecompareTomethod of the examined object.Matchers.hasEntry(K key, V value) CoreMatchers.hasItem(T item) Matchers.hasItem(T item) static <T> Matcher<T[]> Matchers.hasItemInArray(Matcher<? super T> elementMatcher) Creates a matcher for arrays that matches when the examined array contains at least one item that is matched by the specifiedelementMatcher.static <T> Matcher<T[]> Matchers.hasItemInArray(T element) A shortcut to the frequently usedhasItemInArray(equalTo(x)).CoreMatchers.hasItems(T... items) Matchers.hasItems(T... items) Matchers.hasKey(K key) static Matcher<CharSequence> Matchers.hasLength(int length) Creates a matcher ofCharSequencethat matches when a char sequence has the length of the specifiedargument.static <T> Matcher<T> Matchers.hasProperty(String propertyName) Creates a matcher that matches when the examined object has a JavaBean property with the specified name.static <T> Matcher<T> Matchers.hasProperty(String propertyName, Matcher<?> valueMatcher) Creates a matcher that matches when the examined object has a JavaBean property with the specified name whose value satisfies the specified matcher.static <E> Matcher<Collection<? extends E>> Matchers.hasSize(int size) Creates a matcher forCollections that matches when thesize()method returns a value equal to the specifiedsize.static <E> Matcher<Collection<? extends E>> Creates a matcher forCollections that matches when thesize()method returns a value that satisfies the specified matcher.static <T> Matcher<T> Matchers.hasToString(String expectedToString) Creates a matcher that matches any examined object whosetoStringmethod returns a value equalTo the specified string.static <T> Matcher<T> Matchers.hasToString(Matcher<? super String> toStringMatcher) Creates a matcher that matches any examined object whosetoStringmethod returns a value that satisfies the specified matcher.Matchers.hasValue(V value) Creates a matcher ofNodes that matches when the examined node contains a node at the specifiedxPath, with any content.Matchers.hasXPath(String xPath, NamespaceContext namespaceContext) Creates a matcher ofNodes that matches when the examined node contains a node at the specifiedxPathwithin the specified namespace context, with any content.Matchers.hasXPath(String xPath, NamespaceContext namespaceContext, Matcher<String> valueMatcher) Creates a matcher ofNodes that matches when the examined node has a value at the specifiedxPath, within the specifiednamespaceContext, that satisfies the specifiedvalueMatcher.Creates a matcher ofNodes that matches when the examined node has a value at the specifiedxPaththat satisfies the specifiedvalueMatcher.static <T> Matcher<T> Matchers.in(Collection<T> collection) Creates a matcher that matches when the examined object is found within the specified collection.static <T> Matcher<T> Matchers.in(T[] elements) Creates a matcher that matches when the examined object is found within the specified array.static <T> Matcher<T> CoreMatchers.instanceOf(Class<?> type) Creates a matcher that matches when the examined object is an instance of the specifiedtype, as determined by calling theClass.isInstance(Object)method on that type, passing the the examined object.static <T> Matcher<T> Matchers.instanceOf(Class<?> type) Creates a matcher that matches when the examined object is an instance of the specifiedtype, as determined by calling theClass.isInstance(Object)method on that type, passing the the examined object.static <T> Matcher<T> Decorates another Matcher, retaining its behaviour, but allowing tests to be slightly more expressive.static <T> Matcher<T> CoreMatchers.is(T value) A shortcut to the frequently usedis(equalTo(x)).static <T> Matcher<T> Decorates another Matcher, retaining its behaviour, but allowing tests to be slightly more expressive.static <T> Matcher<T> Matchers.is(T value) A shortcut to the frequently usedis(equalTo(x)).static <T> Matcher<T> A shortcut to the frequently usedis(instanceOf(SomeClass.class)).static <T> Matcher<T> A shortcut to the frequently usedis(instanceOf(SomeClass.class)).Matchers.isEmptyOrNullString()Deprecated.use is(emptyOrNullString()) insteadMatchers.isEmptyString()Deprecated.use is(emptyString()) insteadstatic <T> Matcher<T> Matchers.isIn(Collection<T> collection) Deprecated.use is(in(...)) insteadstatic <T> Matcher<T> Matchers.isIn(T[] elements) Deprecated.use is(in(...)) insteadstatic <T> Matcher<T> Matchers.isOneOf(T... elements) Deprecated.use is(oneOf(...)) insteadMatchers.iterableWithSize(int size) Matchers.iterableWithSize(Matcher<? super Integer> sizeMatcher) static <T extends Comparable<T>>
Matcher<T> Matchers.lessThan(T value) Creates a matcher ofComparableobject that matches when the examined object is less than the specified value, as reported by thecompareTomethod of the examined object.static <T extends Comparable<T>>
Matcher<T> Matchers.lessThanOrEqualTo(T value) Creates a matcher ofComparableobject that matches when the examined object is less than or equal to the specified value, as reported by thecompareTomethod of the examined object.Matchers.matchesPattern(String regex) Matchers.matchesPattern(Pattern pattern) Matchers.matchesRegex(String regex) Validate a string with a regex.Matchers.matchesRegex(Pattern pattern) Validate a string with aPattern.static <T> Matcher<T> Creates a matcher that wraps an existing matcher, but inverts the logic by which it will match.static <T> Matcher<T> CoreMatchers.not(T value) A shortcut to the frequently usednot(equalTo(x)).static <T> Matcher<T> Creates a matcher that wraps an existing matcher, but inverts the logic by which it will match.static <T> Matcher<T> Matchers.not(T value) A shortcut to the frequently usednot(equalTo(x)).Matchers.notANumber()Creates a matcher ofDoubles that matches when an examined double is not a number.CoreMatchers.notNullValue()A shortcut to the frequently usednot(nullValue()).static <T> Matcher<T> CoreMatchers.notNullValue(Class<T> type) A shortcut to the frequently usednot(nullValue(X.class)).Matchers.notNullValue()A shortcut to the frequently usednot(nullValue()).static <T> Matcher<T> Matchers.notNullValue(Class<T> type) A shortcut to the frequently usednot(nullValue(X.class)).CoreMatchers.nullValue()Creates a matcher that matches if examined object isnull.static <T> Matcher<T> Creates a matcher that matches if examined object isnull.Matchers.nullValue()Creates a matcher that matches if examined object isnull.static <T> Matcher<T> Creates a matcher that matches if examined object isnull.static <T> Matcher<T> Matchers.oneOf(T... elements) Creates a matcher that matches when the examined object is equal to one of the specified elements.static <T> Matcher<T> CoreMatchers.sameInstance(T target) Creates a matcher that matches only when the examined object is the same instance as the specified target object.static <T> Matcher<T> Matchers.sameInstance(T target) Creates a matcher that matches only when the examined object is the same instance as the specified target object.static <B> Matcher<B> Matchers.samePropertyValuesAs(B expectedBean, String... ignoredProperties) Creates a matcher that matches when the examined object has values for all of its JavaBean properties that are equal to the corresponding values of the specified bean.CoreMatchers.startsWith(String prefix) Matchers.startsWith(String prefix) CoreMatchers.startsWithIgnoringCase(String prefix) Matchers.startsWithIgnoringCase(String prefix) Matchers.stringContainsInOrder(Iterable<String> substrings) Creates a matcher ofStringthat matches when the examined string contains all of the specified substrings, considering the order of their appearance.Matchers.stringContainsInOrder(String... substrings) Creates a matcher ofStringthat matches when the examined string contains all of the specified substrings, considering the order of their appearance.static <T> Matcher<T> CoreMatchers.theInstance(T target) Creates a matcher that matches only when the examined object is the same instance as the specified target object.static <T> Matcher<T> Matchers.theInstance(T target) Creates a matcher that matches only when the examined object is the same instance as the specified target object.Matchers.typeCompatibleWith(Class<T> baseType) Creates a matcher ofClassthat matches when the specified baseType is assignable from the examined class.Methods in org.hamcrest with parameters of type MatcherModifier and TypeMethodDescriptionstatic <T> Matcher<T> Creates a matcher that matches if the examined object matches ALL of the specified matchers.static <T> Matcher<T> Creates a matcher that matches if the examined object matches ALL of the specified matchers.static <T> Matcher<T> Creates a matcher that matches if the examined object matches ALL of the specified matchers.static <T> Matcher<T> Creates a matcher that matches if the examined object matches ALL of the specified matchers.static <T> Matcher<T> Matchers.allOf(Matcher<? super T> first, Matcher<? super T> second, Matcher<? super T> third, Matcher<? super T> fourth) Creates a matcher that matches if the examined object matches ALL of the specified matchers.static <T> Matcher<T> Matchers.allOf(Matcher<? super T> first, Matcher<? super T> second, Matcher<? super T> third, Matcher<? super T> fourth, Matcher<? super T> fifth) Creates a matcher that matches if the examined object matches ALL of the specified matchers.static <T> Matcher<T> Matchers.allOf(Matcher<? super T> first, Matcher<? super T> second, Matcher<? super T> third, Matcher<? super T> fourth, Matcher<? super T> fifth, Matcher<? super T> sixth) Creates a matcher that matches if the examined object matches ALL of the specified matchers.Matchers.aMapWithSize(Matcher<? super Integer> sizeMatcher) Creates a matcher forMaps that matches when thesize()method returns a value that satisfies the specified matcher.static <T> AnyOf<T> Creates a matcher that matches if the examined object matches ANY of the specified matchers.static <T> AnyOf<T> Creates a matcher that matches if the examined object matches ANY of the specified matchers.static <T> AnyOf<T> Creates a matcher that matches if the examined object matches ANY of the specified matchers.static <T> AnyOf<T> Creates a matcher that matches if the examined object matches ANY of the specified matchers.static <T> AnyOf<T> Matchers.anyOf(Matcher<? super T> first, Matcher<? super T> second, Matcher<? super T> third, Matcher<? super T> fourth) Creates a matcher that matches if the examined object matches ANY of the specified matchers.static <T> AnyOf<T> Matchers.anyOf(Matcher<? super T> first, Matcher<? super T> second, Matcher<? super T> third, Matcher<? super T> fourth, Matcher<? super T> fifth) Creates a matcher that matches if the examined object matches ANY of the specified matchers.static <T> AnyOf<T> Matchers.anyOf(Matcher<? super T> first, Matcher<? super T> second, Matcher<? super T> third, Matcher<? super T> fourth, Matcher<? super T> fifth, Matcher<? super T> sixth) Creates a matcher that matches if the examined object matches ANY of the specified matchers.static <T> IsArray<T> Creates a matcher that matches arrays whose elements are satisfied by the specified matchers.static <E> Matcher<E[]> Matchers.arrayContaining(Matcher<? super E>... itemMatchers) Creates a matcher for arrays that matches when each item in the examined array satisfies the corresponding matcher in the specified matchers.static <E> Matcher<E[]> Matchers.arrayContainingInAnyOrder(Matcher<? super E>... itemMatchers) Creates an order agnostic matcher for arrays that matches when each item in the examined array satisfies one matcher anywhere in the specified matchers.static <E> Matcher<E[]> Matchers.arrayWithSize(Matcher<? super Integer> sizeMatcher) Creates a matcher for arrays that matches when thelengthof the array satisfies the specified matcher.static <T> voidMatcherAssert.assertThat(String reason, T actual, Matcher<? super T> matcher) static <T> voidMatcherAssert.assertThat(T actual, Matcher<? super T> matcher) static <LHS> CombinableMatcher.CombinableBothMatcher<LHS> Creates a matcher that matches when both of the specified matchers match the examined object.static <LHS> CombinableMatcher.CombinableBothMatcher<LHS> Creates a matcher that matches when both of the specified matchers match the examined object.Matchers.containsInAnyOrder(Matcher<? super T>... itemMatchers) Matchers.containsInRelativeOrder(Matcher<? super E>... itemMatchers) static <T> Matcher<T> CoreMatchers.describedAs(String description, Matcher<T> matcher, Object... values) Wraps an existing matcher, overriding its description with that specified.static <T> Matcher<T> Matchers.describedAs(String description, Matcher<T> matcher, Object... values) Wraps an existing matcher, overriding its description with that specified.static <LHS> CombinableMatcher.CombinableEitherMatcher<LHS> Creates a matcher that matches when either of the specified matchers match the examined object.static <LHS> CombinableMatcher.CombinableEitherMatcher<LHS> Creates a matcher that matches when either of the specified matchers match the examined object.static <T> Matcher<T[]> Matchers.hasItemInArray(Matcher<? super T> elementMatcher) Creates a matcher for arrays that matches when the examined array contains at least one item that is matched by the specifiedelementMatcher.static <T> Matcher<T> Matchers.hasProperty(String propertyName, Matcher<?> valueMatcher) Creates a matcher that matches when the examined object has a JavaBean property with the specified name whose value satisfies the specified matcher.static <E> Matcher<Collection<? extends E>> Creates a matcher forCollections that matches when thesize()method returns a value that satisfies the specified matcher.static <T> Matcher<T> Matchers.hasToString(Matcher<? super String> toStringMatcher) Creates a matcher that matches any examined object whosetoStringmethod returns a value that satisfies the specified matcher.Matchers.hasXPath(String xPath, NamespaceContext namespaceContext, Matcher<String> valueMatcher) Creates a matcher ofNodes that matches when the examined node has a value at the specifiedxPath, within the specifiednamespaceContext, that satisfies the specifiedvalueMatcher.Creates a matcher ofNodes that matches when the examined node has a value at the specifiedxPaththat satisfies the specifiedvalueMatcher.static <T> Matcher<T> Decorates another Matcher, retaining its behaviour, but allowing tests to be slightly more expressive.static <T> Matcher<T> Decorates another Matcher, retaining its behaviour, but allowing tests to be slightly more expressive.Matchers.iterableWithSize(Matcher<? super Integer> sizeMatcher) booleanfinal booleanabstract booleanbooleanstatic <T> Matcher<T> Creates a matcher that wraps an existing matcher, but inverts the logic by which it will match.static <T> Matcher<T> Creates a matcher that wraps an existing matcher, but inverts the logic by which it will match.Method parameters in org.hamcrest with type arguments of type MatcherModifier and TypeMethodDescriptionstatic <T> Matcher<T> Creates a matcher that matches if the examined object matches ALL of the specified matchers.static <T> Matcher<T> Creates a matcher that matches if the examined object matches ALL of the specified matchers.static <T> AnyOf<T> Creates a matcher that matches if the examined object matches ANY of the specified matchers.static <T> AnyOf<T> Creates a matcher that matches if the examined object matches ANY of the specified matchers.static <E> Matcher<E[]> Matchers.arrayContaining(List<Matcher<? super E>> itemMatchers) Creates a matcher for arrays that matches when each item in the examined array satisfies the corresponding matcher in the specified list of matchers.static <E> Matcher<E[]> Matchers.arrayContainingInAnyOrder(Collection<Matcher<? super E>> itemMatchers) Creates an order agnostic matcher for arrays that matches when each item in the examined array satisfies one matcher anywhere in the specified collection of matchers.Matchers.containsInAnyOrder(Collection<Matcher<? super T>> itemMatchers) Matchers.containsInRelativeOrder(List<Matcher<? super E>> itemMatchers) Constructors in org.hamcrest with parameters of type MatcherModifierConstructorDescriptionFeatureMatcher(Matcher<? super U> subMatcher, String featureDescription, String featureName) Constructor -
Uses of Matcher in org.hamcrest.beans
Classes in org.hamcrest.beans that implement MatcherModifier and TypeClassDescriptionclassHasProperty<T>A Matcher that checks that an object has a JavaBean property with the specified name.classMatcher that asserts that a JavaBean property on an argument passed to the mock object meets the provided matcher.classprivate static classFields in org.hamcrest.beans declared as MatcherModifier and TypeFieldDescriptionSamePropertyValuesAs.PropertyMatcher.matcherHasPropertyWithValue.valueMatcherMethods in org.hamcrest.beans that return MatcherModifier and TypeMethodDescriptionstatic <T> Matcher<T> HasProperty.hasProperty(String propertyName) Creates a matcher that matches when the examined object has a JavaBean property with the specified name.static <T> Matcher<T> HasPropertyWithValue.hasProperty(String propertyName, Matcher<?> valueMatcher) Creates a matcher that matches when the examined object has a JavaBean property with the specified name whose value satisfies the specified matcher.static <T> Matcher<T> HasPropertyWithValue.hasPropertyAtPath(String path, Matcher<T> valueMatcher) Creates a matcher that matches when the examined object is a graph of JavaBean objects that can be navigated along the declared dot-separated path and the final element of that path is a JavaBean property whose value satisfies the specified matcher.HasPropertyWithValue.nastyGenericsWorkaround(Matcher<?> valueMatcher) static <B> Matcher<B> SamePropertyValuesAs.samePropertyValuesAs(B expectedBean, String... ignoredProperties) Creates a matcher that matches when the examined object has values for all of its JavaBean properties that are equal to the corresponding values of the specified bean.Methods in org.hamcrest.beans with parameters of type MatcherModifier and TypeMethodDescriptionstatic <T> Matcher<T> HasPropertyWithValue.hasProperty(String propertyName, Matcher<?> valueMatcher) Creates a matcher that matches when the examined object has a JavaBean property with the specified name whose value satisfies the specified matcher.static <T> Matcher<T> HasPropertyWithValue.hasPropertyAtPath(String path, Matcher<T> valueMatcher) Creates a matcher that matches when the examined object is a graph of JavaBean objects that can be navigated along the declared dot-separated path and the final element of that path is a JavaBean property whose value satisfies the specified matcher.HasPropertyWithValue.nastyGenericsWorkaround(Matcher<?> valueMatcher) Constructors in org.hamcrest.beans with parameters of type MatcherModifierConstructorDescriptionHasPropertyWithValue(String propertyName, Matcher<?> valueMatcher) HasPropertyWithValue(String propertyName, Matcher<?> valueMatcher, String messageFormat) -
Uses of Matcher in org.hamcrest.collection
Classes in org.hamcrest.collection that implement MatcherModifier and TypeClassDescriptionclassclassMatches if an array contains an item satisfying a nested matcher.classIsArray<T>Matcher for array whose elements satisfy a sequence of matchers.classDeprecated.As of release 2.1, replaced byArrayMatching.classDeprecated.As of release 2.1, replaced byArrayMatching.classMatches if array size satisfies a nested matcher.classMatches if collection size satisfies a nested matcher.classTests if collection is empty.classTests if collection is empty.classIsIn<T>classclassclassclassclassIsMapContaining<K,V> final classIsMapWithSize<K,V> Matches if map size satisfies a nested matcher.Fields in org.hamcrest.collection declared as MatcherModifier and TypeFieldDescriptionHasItemInArray.elementMatcherIsArray.elementMatchersIsMapContaining.keyMatcherIsMapContaining.valueMatcherFields in org.hamcrest.collection with type parameters of type MatcherModifier and TypeFieldDescriptionprotected final Collection<Matcher<? super E>> ArrayAsIterableMatcher.matchersprivate final Collection<Matcher<? super E>> IsArrayContainingInAnyOrder.matchersDeprecated.private final Collection<Matcher<? super E>> IsArrayContainingInOrder.matchersDeprecated.private final Collection<Matcher<? super T>> IsIterableContainingInAnyOrder.matchersprivate final Collection<Matcher<? super S>> IsIterableContainingInAnyOrder.Matching.matchersIsIterableContainingInOrder.matchersIsIterableContainingInOrder.MatchSeries.matchersIsIterableContainingInRelativeOrder.matchersIsIterableContainingInRelativeOrder.MatchSeriesInRelativeOrder.matchersMethods in org.hamcrest.collection that return MatcherModifier and TypeMethodDescriptionIsMapWithSize.aMapWithSize(int size) Creates a matcher forMaps that matches when thesize()method returns a value equal to the specifiedsize.IsMapWithSize.aMapWithSize(Matcher<? super Integer> sizeMatcher) Creates a matcher forMaps that matches when thesize()method returns a value that satisfies the specified matcher.IsMapWithSize.anEmptyMap()Creates a matcher forMaps that matches when thesize()method returns zero.static <E> Matcher<E[]> ArrayMatching.arrayContaining(E... items) Creates a matcher for arrays that matches when each item in the examined array is logically equal to the corresponding item in the specified items.static <E> Matcher<E[]> ArrayMatching.arrayContaining(List<Matcher<? super E>> itemMatchers) Creates a matcher for arrays that matches when each item in the examined array satisfies the corresponding matcher in the specified list of matchers.static <E> Matcher<E[]> ArrayMatching.arrayContaining(Matcher<? super E>... itemMatchers) Creates a matcher for arrays that matches when each item in the examined array satisfies the corresponding matcher in the specified matchers.static <E> Matcher<E[]> IsArrayContainingInOrder.arrayContaining(E... items) Deprecated.As of version 2.1, useArrayMatching.arrayContaining(Object[]).static <E> Matcher<E[]> IsArrayContainingInOrder.arrayContaining(List<Matcher<? super E>> itemMatchers) Deprecated.As of version 2.1, useArrayMatching.arrayContaining(List).static <E> Matcher<E[]> IsArrayContainingInOrder.arrayContaining(Matcher<? super E>... itemMatchers) Deprecated.As of version 2.1, useArrayMatching.arrayContaining(Matcher[]).static <E> Matcher<E[]> ArrayMatching.arrayContainingInAnyOrder(E... items) Creates an order agnostic matcher for arrays that matches when each item in the examined array is logically equal to one item anywhere in the specified items.static <E> Matcher<E[]> ArrayMatching.arrayContainingInAnyOrder(Collection<Matcher<? super E>> itemMatchers) Creates an order agnostic matcher for arrays that matches when each item in the examined array satisfies one matcher anywhere in the specified collection of matchers.static <E> Matcher<E[]> ArrayMatching.arrayContainingInAnyOrder(Matcher<? super E>... itemMatchers) Creates an order agnostic matcher for arrays that matches when each item in the examined array satisfies one matcher anywhere in the specified matchers.static <E> Matcher<E[]> IsArrayContainingInAnyOrder.arrayContainingInAnyOrder(E... items) Deprecated.As of version 2.1, useArrayMatching.arrayContainingInAnyOrder(Object[]).static <E> Matcher<E[]> IsArrayContainingInAnyOrder.arrayContainingInAnyOrder(Collection<Matcher<? super E>> itemMatchers) Deprecated.As of version 2.1, useArrayMatching.arrayContainingInAnyOrder(Collection).static <E> Matcher<E[]> IsArrayContainingInAnyOrder.arrayContainingInAnyOrder(Matcher<? super E>... itemMatchers) Deprecated.As of version 2.1, useArrayMatching.arrayContainingInAnyOrder(Matcher[]).static <E> Matcher<E[]> IsArrayWithSize.arrayWithSize(int size) Creates a matcher for arrays that matches when thelengthof the array equals the specifiedsize.static <E> Matcher<E[]> IsArrayWithSize.arrayWithSize(Matcher<? super Integer> sizeMatcher) Creates a matcher for arrays that matches when thelengthof the array satisfies the specified matcher.IsIterableContainingInOrder.contains(E... items) IsIterableContainingInAnyOrder.containsInAnyOrder(Collection<Matcher<? super T>> itemMatchers) IsIterableContainingInAnyOrder.containsInAnyOrder(Matcher<? super T>... itemMatchers) IsIterableContainingInAnyOrder.containsInAnyOrder(T... items) IsIterableContainingInRelativeOrder.containsInRelativeOrder(E... items) IsIterableContainingInRelativeOrder.containsInRelativeOrder(List<Matcher<? super E>> itemMatchers) IsIterableContainingInRelativeOrder.containsInRelativeOrder(Matcher<? super E>... itemMatchers) static <E> Matcher<Collection<? extends E>> IsEmptyCollection.empty()static <E> Matcher<E[]> IsArrayWithSize.emptyArray()Creates a matcher for arrays that matches when thelengthof the array is zero.static <E> Matcher<Collection<E>> IsEmptyCollection.emptyCollectionOf(Class<E> unusedToForceReturnType) IsEmptyIterable.emptyIterable()Creates a matcher forIterables matching examined iterables that yield no items.IsEmptyIterable.emptyIterableOf(Class<E> unusedToForceReturnType) Creates a matcher forIterables matching examined iterables that yield no items.IsMapContaining.hasEntry(K key, V value) static <T> Matcher<T[]> ArrayMatching.hasItemInArray(Matcher<? super T> elementMatcher) Creates a matcher for arrays that matches when the examined array contains at least one item that is matched by the specifiedelementMatcher.static <T> Matcher<T[]> ArrayMatching.hasItemInArray(T element) A shortcut to the frequently usedhasItemInArray(equalTo(x)).IsMapContaining.hasKey(K key) static <E> Matcher<Collection<? extends E>> IsCollectionWithSize.hasSize(int size) Creates a matcher forCollections that matches when thesize()method returns a value equal to the specifiedsize.static <E> Matcher<Collection<? extends E>> Creates a matcher forCollections that matches when thesize()method returns a value that satisfies the specified matcher.IsMapContaining.hasValue(V value) static <T> Matcher<T> IsIn.in(Collection<T> collection) Creates a matcher that matches when the examined object is found within the specified collection.static <T> Matcher<T> IsIn.in(T[] elements) Creates a matcher that matches when the examined object is found within the specified array.static <T> Matcher<T> IsIn.isIn(Collection<T> collection) Deprecated.use is(in(...)) insteadstatic <T> Matcher<T> IsIn.isIn(T[] elements) Deprecated.use is(in(...)) insteadstatic <T> Matcher<T> IsIn.isOneOf(T... elements) Deprecated.use is(oneOf(...)) insteadIsIterableWithSize.iterableWithSize(int size) IsIterableWithSize.iterableWithSize(Matcher<? super Integer> sizeMatcher) static <T> Matcher<T> IsIn.oneOf(T... elements) Creates a matcher that matches when the examined object is equal to one of the specified elements.Methods in org.hamcrest.collection that return types with arguments of type MatcherMethods in org.hamcrest.collection with parameters of type MatcherModifier and TypeMethodDescriptionIsMapWithSize.aMapWithSize(Matcher<? super Integer> sizeMatcher) Creates a matcher forMaps that matches when thesize()method returns a value that satisfies the specified matcher.static <T> IsArray<T> Creates a matcher that matches arrays whose elements are satisfied by the specified matchers.static <E> Matcher<E[]> ArrayMatching.arrayContaining(Matcher<? super E>... itemMatchers) Creates a matcher for arrays that matches when each item in the examined array satisfies the corresponding matcher in the specified matchers.static <E> Matcher<E[]> IsArrayContainingInOrder.arrayContaining(Matcher<? super E>... itemMatchers) Deprecated.As of version 2.1, useArrayMatching.arrayContaining(Matcher[]).static <E> Matcher<E[]> ArrayMatching.arrayContainingInAnyOrder(Matcher<? super E>... itemMatchers) Creates an order agnostic matcher for arrays that matches when each item in the examined array satisfies one matcher anywhere in the specified matchers.static <E> Matcher<E[]> IsArrayContainingInAnyOrder.arrayContainingInAnyOrder(Matcher<? super E>... itemMatchers) Deprecated.As of version 2.1, useArrayMatching.arrayContainingInAnyOrder(Matcher[]).static <E> Matcher<E[]> IsArrayWithSize.arrayWithSize(Matcher<? super Integer> sizeMatcher) Creates a matcher for arrays that matches when thelengthof the array satisfies the specified matcher.IsIterableContainingInAnyOrder.containsInAnyOrder(Matcher<? super T>... itemMatchers) IsIterableContainingInRelativeOrder.containsInRelativeOrder(Matcher<? super E>... itemMatchers) private voidIsIterableContainingInOrder.MatchSeries.describeMismatch(Matcher<? super F> matcher, F item) static <T> Matcher<T[]> ArrayMatching.hasItemInArray(Matcher<? super T> elementMatcher) Creates a matcher for arrays that matches when the examined array contains at least one item that is matched by the specifiedelementMatcher.static <E> Matcher<Collection<? extends E>> Creates a matcher forCollections that matches when thesize()method returns a value that satisfies the specified matcher.IsIterableWithSize.iterableWithSize(Matcher<? super Integer> sizeMatcher) Method parameters in org.hamcrest.collection with type arguments of type MatcherModifier and TypeMethodDescriptionstatic <E> Matcher<E[]> ArrayMatching.arrayContaining(List<Matcher<? super E>> itemMatchers) Creates a matcher for arrays that matches when each item in the examined array satisfies the corresponding matcher in the specified list of matchers.static <E> Matcher<E[]> IsArrayContainingInOrder.arrayContaining(List<Matcher<? super E>> itemMatchers) Deprecated.As of version 2.1, useArrayMatching.arrayContaining(List).static <E> Matcher<E[]> ArrayMatching.arrayContainingInAnyOrder(Collection<Matcher<? super E>> itemMatchers) Creates an order agnostic matcher for arrays that matches when each item in the examined array satisfies one matcher anywhere in the specified collection of matchers.static <E> Matcher<E[]> IsArrayContainingInAnyOrder.arrayContainingInAnyOrder(Collection<Matcher<? super E>> itemMatchers) Deprecated.As of version 2.1, useArrayMatching.arrayContainingInAnyOrder(Collection).IsIterableContainingInAnyOrder.containsInAnyOrder(Collection<Matcher<? super T>> itemMatchers) IsIterableContainingInRelativeOrder.containsInRelativeOrder(List<Matcher<? super E>> itemMatchers) Constructors in org.hamcrest.collection with parameters of type MatcherModifierConstructorDescriptionHasItemInArray(Matcher<? super T> elementMatcher) IsArrayWithSize(Matcher<? super Integer> sizeMatcher) IsCollectionWithSize(Matcher<? super Integer> sizeMatcher) IsIterableWithSize(Matcher<? super Integer> sizeMatcher) IsMapContaining(Matcher<? super K> keyMatcher, Matcher<? super V> valueMatcher) IsMapWithSize(Matcher<? super Integer> sizeMatcher) Constructor parameters in org.hamcrest.collection with type arguments of type MatcherModifierConstructorDescriptionArrayAsIterableMatcher(TypeSafeDiagnosingMatcher<Iterable<? extends E>> iterableMatcher, Collection<Matcher<? super E>> matchers, String message) IsArrayContainingInAnyOrder(Collection<Matcher<? super E>> matchers) Deprecated.IsArrayContainingInOrder(List<Matcher<? super E>> matchers) Deprecated.IsIterableContainingInAnyOrder(Collection<Matcher<? super T>> matchers) IsIterableContainingInOrder(List<Matcher<? super E>> matchers) IsIterableContainingInRelativeOrder(List<Matcher<? super E>> matchers) Matching(Collection<Matcher<? super S>> matchers, Description mismatchDescription) MatchSeries(List<Matcher<? super F>> matchers, Description mismatchDescription) MatchSeriesInRelativeOrder(List<Matcher<? super F>> matchers, Description mismatchDescription) -
Uses of Matcher in org.hamcrest.comparator
Classes in org.hamcrest.comparator that implement MatcherModifier and TypeClassDescriptionprivate static final classMethods in org.hamcrest.comparator that return MatcherModifier and TypeMethodDescriptionComparatorMatcherBuilder.comparesEqualTo(T value) Creates a matcher ofTobject that matches when the examined object is equal to the specified value, as reported by theComparatorused to create this builder.ComparatorMatcherBuilder.greaterThan(T value) Creates a matcher ofTobject that matches when the examined object is greater than the specified value, as reported by theComparatorused to create this builder.ComparatorMatcherBuilder.greaterThanOrEqualTo(T value) Creates a matcher ofTobject that matches when the examined object is greater than or equal to the specified value, as reported by theComparatorused to create this builder.Creates a matcher ofTobject that matches when the examined object is less than the specified value, as reported by theComparatorused to create this builder.ComparatorMatcherBuilder.lessThanOrEqualTo(T value) Creates a matcher ofTobject that matches when the examined object is less than or equal to the specified value, as reported by theComparatorused to create this builder. -
Uses of Matcher in org.hamcrest.core
Classes in org.hamcrest.core that implement MatcherModifier and TypeClassDescriptionclassAllOf<T>Calculates the logical conjunction of multiple matchers.classAnyOf<T>Calculates the logical disjunction of multiple matchers.classclassDescribedAs<T>Provides a custom description to another matcher.classEvery<T>classIs<T>Decorates another Matcher, retaining the behaviour but allowing tests to be slightly more expressive.classIsAnything<T>A matcher that always returnstrue.classDeprecated.As of release 2.1, replaced byIsIterableContaining.classIsEqual<T>Is the value equal to another value, as tested by theObject.equals(java.lang.Object)invokedMethod?classTests whether the value is an instance of a class.classclassIsNot<T>Calculates the logical negation of a matcher.classIsNull<T>Is the value null?classIsSame<T>Is the value the same object as another value?(package private) classclassTests if the argument is a string that contains a specific substring.classTests if the argument is a string that ends with a specific substring.classclassTests if the argument is a string that starts with a specific substring.classFields in org.hamcrest.core declared as MatcherModifier and TypeFieldDescriptionIsIterableContaining.elementMatcherCombinableMatcher.CombinableBothMatcher.firstCombinableMatcher.CombinableEitherMatcher.firstCombinableMatcher.matcherDescribedAs.matcherEvery.matcherIs.matcherIsNot.matcherFields in org.hamcrest.core with type parameters of type MatcherMethods in org.hamcrest.core that return MatcherModifier and TypeMethodDescriptionstatic <T> Matcher<T> Creates a matcher that matches if the examined object matches ALL of the specified matchers.static <T> Matcher<T> Creates a matcher that matches if the examined object matches ALL of the specified matchers.static <T> Matcher<T> Creates a matcher that matches when the examined object is an instance of the specifiedtype, as determined by calling theClass.isInstance(Object)method on that type, passing the the examined object.IsAnything.anything()Creates a matcher that always matches, regardless of the examined object.Creates a matcher that always matches, regardless of the examined object, but describes itself with the specifiedString.StringContains.containsString(String substring) StringContains.containsStringIgnoringCase(String substring) static <T> Matcher<T> DescribedAs.describedAs(String description, Matcher<T> matcher, Object... values) Wraps an existing matcher, overriding its description with that specified.StringEndsWith.endsWithIgnoringCase(String suffix) static <T> Matcher<T> IsEqual.equalTo(T operand) Creates a matcher that matches when the examined object is logically equal to the specifiedoperand, as determined by calling theObject.equals(java.lang.Object)method on the examined object.IsEqual.equalToObject(Object operand) Creates anIsEqualmatcher that does not enforce the values being compared to be of the same static type.Deprecated.As of version 2.1, useIsIterableContaining.hasItem(Matcher).IsCollectionContaining.hasItem(T item) Deprecated.As of version 2.1, useIsIterableContaining.hasItem(Object).IsIterableContaining.hasItem(T item) Deprecated.As of version 2.1, useIsIterableContaining.hasItems(Matcher[])}.IsCollectionContaining.hasItems(T... items) Deprecated.As of version 2.1, useIsIterableContaining.hasItems(Object[])}.IsIterableContaining.hasItems(T... items) static <T> Matcher<T> IsInstanceOf.instanceOf(Class<?> type) Creates a matcher that matches when the examined object is an instance of the specifiedtype, as determined by calling theClass.isInstance(Object)method on that type, passing the the examined object.static <T> Matcher<T> Decorates another Matcher, retaining its behaviour, but allowing tests to be slightly more expressive.static <T> Matcher<T> Is.is(T value) A shortcut to the frequently usedis(equalTo(x)).static <T> Matcher<T> A shortcut to the frequently usedis(instanceOf(SomeClass.class)).StringRegularExpression.matchesRegex(String regex) Creates a matcher that checks if the examined string matches a specified regex.StringRegularExpression.matchesRegex(Pattern pattern) Creates a matcher that checks if the examined string matches a specifiedPattern.static <T> Matcher<T> Creates a matcher that wraps an existing matcher, but inverts the logic by which it will match.static <T> Matcher<T> IsNot.not(T value) A shortcut to the frequently usednot(equalTo(x)).IsNull.notNullValue()A shortcut to the frequently usednot(nullValue()).static <T> Matcher<T> IsNull.notNullValue(Class<T> type) A shortcut to the frequently usednot(nullValue(X.class)).IsNull.nullValue()Creates a matcher that matches if examined object isnull.static <T> Matcher<T> Creates a matcher that matches if examined object isnull.static <T> Matcher<T> IsSame.sameInstance(T target) Creates a matcher that matches only when the examined object is the same instance as the specified target object.StringStartsWith.startsWith(String prefix) StringStartsWith.startsWithIgnoringCase(String prefix) static <T> Matcher<T> IsSame.theInstance(T target) Creates a matcher that matches only when the examined object is the same instance as the specified target object.Methods in org.hamcrest.core that return types with arguments of type MatcherMethods in org.hamcrest.core with parameters of type MatcherModifier and TypeMethodDescriptionstatic <T> Matcher<T> Creates a matcher that matches if the examined object matches ALL of the specified matchers.static <T> AnyOf<T> Creates a matcher that matches if the examined object matches ANY of the specified matchers.static <LHS> CombinableMatcher.CombinableBothMatcher<LHS> Creates a matcher that matches when both of the specified matchers match the examined object.static <T> Matcher<T> DescribedAs.describedAs(String description, Matcher<T> matcher, Object... values) Wraps an existing matcher, overriding its description with that specified.static <LHS> CombinableMatcher.CombinableEitherMatcher<LHS> Creates a matcher that matches when either of the specified matchers match the examined object.Deprecated.As of version 2.1, useIsIterableContaining.hasItem(Matcher).Deprecated.As of version 2.1, useIsIterableContaining.hasItems(Matcher[])}.static <T> Matcher<T> Decorates another Matcher, retaining its behaviour, but allowing tests to be slightly more expressive.static <T> Matcher<T> Creates a matcher that wraps an existing matcher, but inverts the logic by which it will match.CombinableMatcher.templatedListWith(Matcher<? super T> other) Method parameters in org.hamcrest.core with type arguments of type MatcherModifier and TypeMethodDescriptionstatic <T> Matcher<T> Creates a matcher that matches if the examined object matches ALL of the specified matchers.static <T> AnyOf<T> Creates a matcher that matches if the examined object matches ANY of the specified matchers.Constructors in org.hamcrest.core with parameters of type MatcherModifierConstructorDescriptionCombinableBothMatcher(Matcher<? super X> matcher) CombinableEitherMatcher(Matcher<? super X> matcher) CombinableMatcher(Matcher<? super T> matcher) DescribedAs(String descriptionTemplate, Matcher<T> matcher, Object[] values) IsCollectionContaining(Matcher<? super T> elementMatcher) Deprecated.IsIterableContaining(Matcher<? super T> elementMatcher) Constructor parameters in org.hamcrest.core with type arguments of type Matcher -
Uses of Matcher in org.hamcrest.internal
Methods in org.hamcrest.internal that return types with arguments of type MatcherModifier and TypeMethodDescriptionMethods in org.hamcrest.internal with parameters of type Matcher -
Uses of Matcher in org.hamcrest.io
Methods in org.hamcrest.io that return MatcherModifier and TypeMethodDescriptionFileMatchers.aFileNamed(Matcher<String> expected) FileMatchers.aFileWithAbsolutePath(Matcher<String> expected) FileMatchers.aFileWithCanonicalPath(Matcher<String> expected) FileMatchers.aFileWithSize(long size) FileMatchers.aFileWithSize(Matcher<Long> expected) FileMatchers.anExistingDirectory()FileMatchers.anExistingFile()FileMatchers.anExistingFileOrDirectory()FileMatchers.aReadableFile()FileMatchers.aWritableFile()FileMatchers.fileChecker(FileMatchers.FileStatus fileStatus, String successDescription, String failureDescription) Methods in org.hamcrest.io with parameters of type MatcherModifier and TypeMethodDescriptionFileMatchers.aFileNamed(Matcher<String> expected) FileMatchers.aFileWithAbsolutePath(Matcher<String> expected) FileMatchers.aFileWithCanonicalPath(Matcher<String> expected) FileMatchers.aFileWithSize(Matcher<Long> expected) -
Uses of Matcher in org.hamcrest.number
Classes in org.hamcrest.number that implement MatcherModifier and TypeClassDescriptionclassclassIs the value a number equal to a value within some range of acceptable error?final classIs the value a number actually not a number (NaN)?Methods in org.hamcrest.number that return MatcherModifier and TypeMethodDescriptionstatic Matcher<BigDecimal> BigDecimalCloseTo.closeTo(BigDecimal operand, BigDecimal error) Creates a matcher ofBigDecimals that matches when an examined BigDecimal is equal to the specifiedoperand, within a range of +/-error.IsCloseTo.closeTo(double operand, double error) Creates a matcher ofDoubles that matches when an examined double is equal to the specifiedoperand, within a range of +/-error.static <T extends Comparable<T>>
Matcher<T> OrderingComparison.comparesEqualTo(T value) Creates a matcher ofComparableobject that matches when the examined object is equal to the specified value, as reported by thecompareTomethod of the examined object.static <T extends Comparable<T>>
Matcher<T> OrderingComparison.greaterThan(T value) Creates a matcher ofComparableobject that matches when the examined object is greater than the specified value, as reported by thecompareTomethod of the examined object.static <T extends Comparable<T>>
Matcher<T> OrderingComparison.greaterThanOrEqualTo(T value) Creates a matcher ofComparableobject that matches when the examined object is greater than or equal to the specified value, as reported by thecompareTomethod of the examined object.static <T extends Comparable<T>>
Matcher<T> OrderingComparison.lessThan(T value) Creates a matcher ofComparableobject that matches when the examined object is less than the specified value, as reported by thecompareTomethod of the examined object.static <T extends Comparable<T>>
Matcher<T> OrderingComparison.lessThanOrEqualTo(T value) Creates a matcher ofComparableobject that matches when the examined object is less than or equal to the specified value, as reported by thecompareTomethod of the examined object.IsNaN.notANumber()Creates a matcher ofDoubles that matches when an examined double is not a number. -
Uses of Matcher in org.hamcrest.object
Classes in org.hamcrest.object that implement MatcherModifier and TypeClassDescriptionclassprivate static classclassHasToString<T>classclassTests if the value is an event announced by a specific object.Fields in org.hamcrest.object declared as MatcherMethods in org.hamcrest.object that return MatcherModifier and TypeMethodDescriptionstatic Matcher<EventObject> IsEventFrom.eventFrom(Class<? extends EventObject> eventClass, Object source) Creates a matcher ofEventObjectthat matches any object derived from eventClass announced by source.static Matcher<EventObject> Creates a matcher ofEventObjectthat matches any EventObject announced by source.static <T> Matcher<T> HasToString.hasToString(String expectedToString) Creates a matcher that matches any examined object whosetoStringmethod returns a value equalTo the specified string.static <T> Matcher<T> HasToString.hasToString(Matcher<? super String> toStringMatcher) Creates a matcher that matches any examined object whosetoStringmethod returns a value that satisfies the specified matcher.IsCompatibleType.typeCompatibleWith(Class<T> baseType) Creates a matcher ofClassthat matches when the specified baseType is assignable from the examined class.Methods in org.hamcrest.object with parameters of type MatcherModifier and TypeMethodDescriptionstatic <T> Matcher<T> HasToString.hasToString(Matcher<? super String> toStringMatcher) Creates a matcher that matches any examined object whosetoStringmethod returns a value that satisfies the specified matcher.Constructors in org.hamcrest.object with parameters of type Matcher -
Uses of Matcher in org.hamcrest.text
Classes in org.hamcrest.text that implement MatcherModifier and TypeClassDescriptionclassfinal classMatches blank Strings (and null).final classMatches empty Strings (and null).classTests if a string is equal to another string, compressing any changes in whitespace.classTests if a string is equal to another string, regardless of the case.classclassFields in org.hamcrest.text declared as MatcherModifier and TypeFieldDescriptionIsBlankString.NULL_OR_BLANK_INSTANCEIsEmptyString.NULL_OR_EMPTY_INSTANCEMethods in org.hamcrest.text that return MatcherModifier and TypeMethodDescriptionIsBlankString.blankOrNullString()Creates a matcher ofStringthat matches when the examined string isnull, or contains zero or more whitespace characters and nothing else.IsBlankString.blankString()Creates a matcher ofStringthat matches when the examined string contains zero or more whitespace characters and nothing else.IsEmptyString.emptyOrNullString()Creates a matcher ofStringthat matches when the examined string isnull, or has zero length.IsEmptyString.emptyString()Creates a matcher ofStringthat matches when the examined string has zero length.IsEqualCompressingWhiteSpace.equalToCompressingWhiteSpace(String expectedString) Creates a matcher ofStringthat matches when the examined string is equal to the specified expectedString, when whitespace differences are (mostly) ignored.IsEqualIgnoringCase.equalToIgnoringCase(String expectedString) Creates a matcher ofStringthat matches when the examined string is equal to the specified expectedString, ignoring case.IsEqualCompressingWhiteSpace.equalToIgnoringWhiteSpace(String expectedString) static Matcher<CharSequence> CharSequenceLength.hasLength(int length) Creates a matcher ofCharSequencethat matches when a char sequence has the given length For example:static Matcher<CharSequence> Creates a matcher ofCharSequencethat matches when a char sequence has the given length For example:IsEmptyString.isEmptyOrNullString()Deprecated.use is(emptyOrNullString()) insteadIsEmptyString.isEmptyString()Deprecated.use is(emptyString()) insteadMatchesPattern.matchesPattern(String regex) MatchesPattern.matchesPattern(Pattern pattern) StringContainsInOrder.stringContainsInOrder(Iterable<String> substrings) Creates a matcher ofStringthat matches when the examined string contains all of the specified substrings, considering the order of their appearance.StringContainsInOrder.stringContainsInOrder(String... substrings) Creates a matcher ofStringthat matches when the examined string contains all of the specified substrings, considering the order of their appearance.Methods in org.hamcrest.text with parameters of type MatcherModifier and TypeMethodDescriptionstatic Matcher<CharSequence> Creates a matcher ofCharSequencethat matches when a char sequence has the given length For example:Constructors in org.hamcrest.text with parameters of type Matcher -
Uses of Matcher in org.hamcrest.xml
Classes in org.hamcrest.xml that implement MatcherModifier and TypeClassDescriptionclassApplies a Matcher to a given XML Node in an existing XML Node tree, specified by an XPath expression.Fields in org.hamcrest.xml declared as MatcherMethods in org.hamcrest.xml that return MatcherModifier and TypeMethodDescriptionCreates a matcher ofNodes that matches when the examined node contains a node at the specifiedxPath, with any content.HasXPath.hasXPath(String xPath, NamespaceContext namespaceContext) Creates a matcher ofNodes that matches when the examined node contains a node at the specifiedxPathwithin the specified namespace context, with any content.HasXPath.hasXPath(String xPath, NamespaceContext namespaceContext, Matcher<String> valueMatcher) Creates a matcher ofNodes that matches when the examined node has a value at the specifiedxPath, within the specifiednamespaceContext, that satisfies the specifiedvalueMatcher.Creates a matcher ofNodes that matches when the examined node has a value at the specifiedxPaththat satisfies the specifiedvalueMatcher.Methods in org.hamcrest.xml with parameters of type MatcherModifier and TypeMethodDescriptionHasXPath.hasXPath(String xPath, NamespaceContext namespaceContext, Matcher<String> valueMatcher) Creates a matcher ofNodes that matches when the examined node has a value at the specifiedxPath, within the specifiednamespaceContext, that satisfies the specifiedvalueMatcher.Creates a matcher ofNodes that matches when the examined node has a value at the specifiedxPaththat satisfies the specifiedvalueMatcher.Constructors in org.hamcrest.xml with parameters of type Matcher
Matchers.equalToCompressingWhiteSpace(String)