Class Matchers
java.lang.Object
org.hamcrest.CoreMatchers
com.onenetwork.platform.tools.test.Matchers
public class Matchers
extends org.hamcrest.CoreMatchers
Hookpoint class enabling use of org.hamcrest Matchers in test framework.
Example usage:
Example usage:
import static com.onenetwork.platform.tools.test.Matchers.assertThat; import static com.onenetwork.platform.tools.test.Matchers.equalTo; import static com.onenetwork.platform.tools.test.Matchers.not; ... assertThat(1, not(equalTo(2)));
-
Constructor Summary
Constructors Constructor Description Matchers()
-
Method Summary
Modifier and Type Method Description static <T> org.hamcrest.Matcher<T>
anyOf(T... values)
Matches if value is equal to any ofvalues
providedstatic <T> void
assertThat(java.lang.String message, T actual, org.hamcrest.Matcher<T> matcher)
Deprecated.useMatcherAssert.assertThat(String, Object, Matcher)
directlystatic <T> void
assertThat(T actual, org.hamcrest.Matcher<T> matcher)
Deprecated.useorg.hamcrest.MatcherAssert#assertThat(String, Matcher)
directlyMethods inherited from class org.hamcrest.CoreMatchers
allOf, allOf, allOf, allOf, allOf, allOf, allOf, any, anyOf, anyOf, anyOf, anyOf, anyOf, anyOf, anyOf, anything, anything, both, containsString, describedAs, either, endsWith, equalTo, everyItem, hasItem, hasItem, hasItems, hasItems, instanceOf, is, is, is, isA, not, not, notNullValue, notNullValue, nullValue, nullValue, sameInstance, startsWith, theInstance
-
Constructor Details
-
Matchers
public Matchers()
-
-
Method Details
-
assertThat
public static <T> void assertThat(T actual, org.hamcrest.Matcher<T> matcher)Deprecated.useorg.hamcrest.MatcherAssert#assertThat(String, Matcher)
directlyTests thatactual
object matches the {@code matcher- Type Parameters:
T
-- Parameters:
actual
-matcher
-- Throws:
java.lang.AssertionError
- if actual object does not match- See Also:
Matchers
-
assertThat
public static <T> void assertThat(java.lang.String message, T actual, org.hamcrest.Matcher<T> matcher)Deprecated.useMatcherAssert.assertThat(String, Object, Matcher)
directlyTests thatactual
object matches thematcher
- Type Parameters:
T
-- Parameters:
message
-actual
-matcher
-- Throws:
java.lang.AssertionError
- if actual object does not match- See Also:
Matchers
-
anyOf
@SafeVarargs public static <T> org.hamcrest.Matcher<T> anyOf(T... values)Matches if value is equal to any ofvalues
provided- Type Parameters:
T
-- Parameters:
values
-- Returns:
-