public CombinableMatcher<T> and(Matcher<? super T> other) { return new CombinableMatcher<T>(new AllOf<T>(templatedListWith(other))); }
/** * Creates a matcher that matches if examined object is <code>null</code>. * <p/> * For example: * <pre>assertThat(cheese, is(nullValue())</pre> */ public static org.hamcrest.Matcher<java.lang.Object> nullValue() { return org.hamcrest.core.IsNull.nullValue(); }
/** * Creates a matcher that matches if the examined object matches <b>ALL</b> of the specified matchers. * <p/> * For example: * <pre>assertThat("myValue", allOf(startsWith("my"), containsString("Val")))</pre> */ public static <T> org.hamcrest.Matcher<T> allOf(java.lang.Iterable<org.hamcrest.Matcher<? super T>> matchers) { return org.hamcrest.core.AllOf.<T>allOf(matchers); }
/** * Decorates another Matcher, retaining its behaviour, but allowing tests * to be slightly more expressive. * <p/> * For example: * <pre>assertThat(cheese, is(equalTo(smelly)))</pre> * instead of: * <pre>assertThat(cheese, equalTo(smelly))</pre> */ public static <T> org.hamcrest.Matcher<T> is(org.hamcrest.Matcher<T> matcher) { return org.hamcrest.core.Is.<T>is(matcher); }
/** * Creates a matcher that matches if the examined object matches <b>ANY</b> of the specified matchers. * <p/> * For example: * <pre>assertThat("myValue", anyOf(startsWith("foo"), containsString("Val")))</pre> */ public static <T> org.hamcrest.core.AnyOf<T> anyOf(org.hamcrest.Matcher<T> first, org.hamcrest.Matcher<? super T> second) { return org.hamcrest.core.AnyOf.<T>anyOf(first, second); }
public CombinableMatcher<T> or(Matcher<? super T> other) { return new CombinableMatcher<T>(new AnyOf<T>(templatedListWith(other))); }
/** * Creates a matcher that matches only when the examined object is the same instance as * the specified target object. * * @param target * the target instance against which others should be assessed */ public static <T> org.hamcrest.Matcher<T> sameInstance(T target) { return org.hamcrest.core.IsSame.<T>sameInstance(target); }
/** * A shortcut to the frequently used <code>is(instanceOf(SomeClass.class))</code>. * <p/> * For example: * <pre>assertThat(cheese, isA(Cheddar.class))</pre> * instead of: * <pre>assertThat(cheese, is(instanceOf(Cheddar.class)))</pre> */ public static <T> org.hamcrest.Matcher<T> isA(java.lang.Class<T> type) { return org.hamcrest.core.Is.<T>isA(type); }
/** * Creates a matcher that always matches, regardless of the examined object, but describes * itself with the specified {@link String}. * * @param description * a meaningful {@link String} used when describing itself */ public static org.hamcrest.Matcher<java.lang.Object> anything(java.lang.String description) { return org.hamcrest.core.IsAnything.anything(description); }
/** * Creates a matcher that matches when both of the specified matchers match the examined object. * <p/> * For example: * <pre>assertThat("fab", both(containsString("a")).and(containsString("b")))</pre> */ public static <LHS> org.hamcrest.core.CombinableMatcher.CombinableBothMatcher<LHS> both(org.hamcrest.Matcher<? super LHS> matcher) { return org.hamcrest.core.CombinableMatcher.<LHS>both(matcher); }
/** * Creates a matcher that matches only when the examined object is the same instance as * the specified target object. * * @param target * the target instance against which others should be assessed */ public static <T> org.hamcrest.Matcher<T> theInstance(T target) { return org.hamcrest.core.IsSame.<T>theInstance(target); }
/** * Creates a matcher that matches if the examined object matches <b>ALL</b> of the specified matchers. * <p/> * For example: * <pre>assertThat("myValue", allOf(startsWith("my"), containsString("Val")))</pre> */ public static <T> org.hamcrest.Matcher<T> allOf(org.hamcrest.Matcher<? super T> first, org.hamcrest.Matcher<? super T> second, org.hamcrest.Matcher<? super T> third) { return org.hamcrest.core.AllOf.<T>allOf(first, second, third); }
/** * Creates a matcher that matches if the examined object matches <b>ANY</b> of the specified matchers. * <p/> * For example: * <pre>assertThat("myValue", anyOf(startsWith("foo"), containsString("Val")))</pre> */ public static <T> org.hamcrest.core.AnyOf<T> anyOf(org.hamcrest.Matcher<T> first, org.hamcrest.Matcher<? super T> second, org.hamcrest.Matcher<? super T> third) { return org.hamcrest.core.AnyOf.<T>anyOf(first, second, third); }
/** * Creates a matcher that always matches, regardless of the examined object. */ public static org.hamcrest.Matcher<java.lang.Object> anything() { return org.hamcrest.core.IsAnything.anything(); }
/** * Creates a matcher that matches if the examined object matches <b>ALL</b> of the specified matchers. * <p/> * For example: * <pre>assertThat("myValue", allOf(startsWith("my"), containsString("Val")))</pre> */ public static <T> org.hamcrest.Matcher<T> allOf(org.hamcrest.Matcher<? super T> first, org.hamcrest.Matcher<? super T> second, org.hamcrest.Matcher<? super T> third, org.hamcrest.Matcher<? super T> fourth) { return org.hamcrest.core.AllOf.<T>allOf(first, second, third, fourth); }
/** * Creates a matcher that matches if the examined object matches <b>ANY</b> of the specified matchers. * <p/> * For example: * <pre>assertThat("myValue", anyOf(startsWith("foo"), containsString("Val")))</pre> */ public static <T> org.hamcrest.core.AnyOf<T> anyOf(org.hamcrest.Matcher<? super T>... matchers) { return org.hamcrest.core.AnyOf.<T>anyOf(matchers); }
/** * Creates a matcher that matches if the examined object matches <b>ALL</b> of the specified matchers. * <p/> * For example: * <pre>assertThat("myValue", allOf(startsWith("my"), containsString("Val")))</pre> */ public static <T> org.hamcrest.Matcher<T> allOf(org.hamcrest.Matcher<? super T> first, org.hamcrest.Matcher<? super T> second, org.hamcrest.Matcher<? super T> third, org.hamcrest.Matcher<? super T> fourth, org.hamcrest.Matcher<? super T> fifth, org.hamcrest.Matcher<? super T> sixth) { return org.hamcrest.core.AllOf.<T>allOf(first, second, third, fourth, fifth, sixth); }
/** * Creates a matcher that matches if the examined object matches <b>ANY</b> of the specified matchers. * <p/> * For example: * <pre>assertThat("myValue", anyOf(startsWith("foo"), containsString("Val")))</pre> */ public static <T> org.hamcrest.core.AnyOf<T> anyOf(org.hamcrest.Matcher<T> first, org.hamcrest.Matcher<? super T> second, org.hamcrest.Matcher<? super T> third, org.hamcrest.Matcher<? super T> fourth) { return org.hamcrest.core.AnyOf.<T>anyOf(first, second, third, fourth); }
/** * Creates a matcher that matches if the examined object matches <b>ANY</b> of the specified matchers. * <p/> * For example: * <pre>assertThat("myValue", anyOf(startsWith("foo"), containsString("Val")))</pre> */ public static <T> org.hamcrest.core.AnyOf<T> anyOf(org.hamcrest.Matcher<T> first, org.hamcrest.Matcher<? super T> second, org.hamcrest.Matcher<? super T> third, org.hamcrest.Matcher<? super T> fourth, org.hamcrest.Matcher<? super T> fifth, org.hamcrest.Matcher<? super T> sixth) { return org.hamcrest.core.AnyOf.<T>anyOf(first, second, third, fourth, fifth, sixth); }