Package org.hamcrest.core
Class AllOf<T>
java.lang.Object
org.hamcrest.BaseMatcher<T>
org.hamcrest.DiagnosingMatcher<T>
org.hamcrest.core.AllOf<T>
- Type Parameters:
T
- the matched value type
- All Implemented Interfaces:
Matcher<T>
,SelfDescribing
Calculates the logical conjunction of multiple matchers. Evaluation is shortcut, so
subsequent matchers are not called if an earlier matcher returns
false
.-
Constructor Summary
ConstructorDescriptionConstructor, best called fromallOf(Iterable)
.Constructor, best called fromallOf(Matcher[])
. -
Method Summary
Modifier 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.void
describeTo
(Description description) Generates a description of the object.boolean
matches
(Object o, Description mismatch) Evaluates the matcher for argument item.Methods inherited from class org.hamcrest.DiagnosingMatcher
describeMismatch, matches
Methods inherited from class org.hamcrest.BaseMatcher
_dont_implement_Matcher___instead_extend_BaseMatcher_, isNotNull, toString
-
Constructor Details
-
AllOf
Constructor, best called fromallOf(Matcher[])
.- Parameters:
matchers
- the matchers- See Also:
-
AllOf
Constructor, best called fromallOf(Iterable)
.- Parameters:
matchers
- the matchers- See Also:
-
-
Method Details
-
matches
Description copied from class:DiagnosingMatcher
Evaluates the matcher for argument item.- Specified by:
matches
in classDiagnosingMatcher<T>
- Parameters:
o
- the value to checkmismatch
- the description for the matcher- Returns:
true
if item matches, otherwisefalse
.
-
describeTo
Description copied from interface:SelfDescribing
Generates a description of the object. The description may be part of a description of a larger object of which this is just a component, so it should be worded appropriately.- Parameters:
description
- The description to be built or appended to.
-
allOf
Creates a matcher that matches if the examined object matches ALL of the specified matchers. For example:assertThat("myValue", allOf(startsWith("my"), containsString("Val")))
- Type Parameters:
T
- the matcher type.- Parameters:
matchers
- all the matchers must pass.- Returns:
- The matcher.
-
allOf
Creates a matcher that matches if the examined object matches ALL of the specified matchers. For example:assertThat("myValue", allOf(startsWith("my"), containsString("Val")))
- Type Parameters:
T
- the matcher type.- Parameters:
matchers
- all the matchers must pass.- Returns:
- The matcher.
-