org.hamcrest.CoreMatchers Maven / Gradle / Ivy
Show all versions of virtdata-lib-curves4 Show documentation
// Generated source.
package org.hamcrest;
public class CoreMatchers {
/**
* Creates a matcher that matches if the examined object matches ALL of the specified matchers.
*
* For example:
* assertThat("myValue", allOf(startsWith("my"), containsString("Val")))
*/
public static org.hamcrest.Matcher allOf(java.lang.Iterable> matchers) {
return org.hamcrest.core.AllOf.allOf(matchers);
}
/**
* Creates a matcher that matches if the examined object matches ALL of the specified matchers.
*
* For example:
* assertThat("myValue", allOf(startsWith("my"), containsString("Val")))
*/
public static org.hamcrest.Matcher allOf(org.hamcrest.Matcher super T>... matchers) {
return org.hamcrest.core.AllOf.allOf(matchers);
}
/**
* Creates a matcher that matches if the examined object matches ALL of the specified matchers.
*
* For example:
* assertThat("myValue", allOf(startsWith("my"), containsString("Val")))
*/
public static org.hamcrest.Matcher allOf(org.hamcrest.Matcher super T> first, org.hamcrest.Matcher super T> second) {
return org.hamcrest.core.AllOf.allOf(first, second);
}
/**
* Creates a matcher that matches if the examined object matches ALL of the specified matchers.
*
* For example:
* assertThat("myValue", allOf(startsWith("my"), containsString("Val")))
*/
public static org.hamcrest.Matcher allOf(org.hamcrest.Matcher super T> first, org.hamcrest.Matcher super T> second, org.hamcrest.Matcher super T> third) {
return org.hamcrest.core.AllOf.allOf(first, second, third);
}
/**
* Creates a matcher that matches if the examined object matches ALL of the specified matchers.
*
* For example:
* assertThat("myValue", allOf(startsWith("my"), containsString("Val")))
*/
public static org.hamcrest.Matcher 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.allOf(first, second, third, fourth);
}
/**
* Creates a matcher that matches if the examined object matches ALL of the specified matchers.
*
* For example:
* assertThat("myValue", allOf(startsWith("my"), containsString("Val")))
*/
public static org.hamcrest.Matcher 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) {
return org.hamcrest.core.AllOf.allOf(first, second, third, fourth, fifth);
}
/**
* Creates a matcher that matches if the examined object matches ALL of the specified matchers.
*
* For example:
* assertThat("myValue", allOf(startsWith("my"), containsString("Val")))
*/
public static org.hamcrest.Matcher 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.allOf(first, second, third, fourth, fifth, sixth);
}
/**
* Creates a matcher that matches if the examined object matches ANY of the specified matchers.
*
* For example:
* assertThat("myValue", anyOf(startsWith("foo"), containsString("Val")))
*/
public static org.hamcrest.core.AnyOf anyOf(java.lang.Iterable> matchers) {
return org.hamcrest.core.AnyOf.anyOf(matchers);
}
/**
* Creates a matcher that matches if the examined object matches ANY of the specified matchers.
*
* For example:
* assertThat("myValue", anyOf(startsWith("foo"), containsString("Val")))
*/
public static org.hamcrest.core.AnyOf anyOf(org.hamcrest.Matcher first, org.hamcrest.Matcher super T> second, org.hamcrest.Matcher super T> third) {
return org.hamcrest.core.AnyOf.anyOf(first, second, third);
}
/**
* Creates a matcher that matches if the examined object matches ANY of the specified matchers.
*
* For example:
* assertThat("myValue", anyOf(startsWith("foo"), containsString("Val")))
*/
public static org.hamcrest.core.AnyOf anyOf(org.hamcrest.Matcher first, org.hamcrest.Matcher super T> second, org.hamcrest.Matcher super T> third, org.hamcrest.Matcher super T> fourth) {
return org.hamcrest.core.AnyOf.anyOf(first, second, third, fourth);
}
/**
* Creates a matcher that matches if the examined object matches ANY of the specified matchers.
*
* For example:
* assertThat("myValue", anyOf(startsWith("foo"), containsString("Val")))
*/
public static org.hamcrest.core.AnyOf anyOf(org.hamcrest.Matcher 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) {
return org.hamcrest.core.AnyOf.anyOf(first, second, third, fourth, fifth);
}
/**
* Creates a matcher that matches if the examined object matches ANY of the specified matchers.
*
* For example:
* assertThat("myValue", anyOf(startsWith("foo"), containsString("Val")))
*/
public static org.hamcrest.core.AnyOf anyOf(org.hamcrest.Matcher 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.anyOf(first, second, third, fourth, fifth, sixth);
}
/**
* Creates a matcher that matches if the examined object matches ANY of the specified matchers.
*
* For example:
* assertThat("myValue", anyOf(startsWith("foo"), containsString("Val")))
*/
public static org.hamcrest.core.AnyOf anyOf(org.hamcrest.Matcher first, org.hamcrest.Matcher super T> second) {
return org.hamcrest.core.AnyOf.anyOf(first, second);
}
/**
* Creates a matcher that matches if the examined object matches ANY of the specified matchers.
*
* For example:
* assertThat("myValue", anyOf(startsWith("foo"), containsString("Val")))
*/
public static org.hamcrest.core.AnyOf anyOf(org.hamcrest.Matcher super T>... matchers) {
return org.hamcrest.core.AnyOf.anyOf(matchers);
}
/**
* Creates a matcher that matches when both of the specified matchers match the examined object.
*
* For example:
* assertThat("fab", both(containsString("a")).and(containsString("b")))
*/
public static org.hamcrest.core.CombinableMatcher.CombinableBothMatcher both(org.hamcrest.Matcher super LHS> matcher) {
return org.hamcrest.core.CombinableMatcher.both(matcher);
}
/**
* Creates a matcher that matches when either of the specified matchers match the examined object.
*
* For example:
* assertThat("fan", either(containsString("a")).and(containsString("b")))
*/
public static org.hamcrest.core.CombinableMatcher.CombinableEitherMatcher either(org.hamcrest.Matcher super LHS> matcher) {
return org.hamcrest.core.CombinableMatcher.either(matcher);
}
/**
* Wraps an existing matcher, overriding its description with that specified. All other functions are
* delegated to the decorated matcher, including its mismatch description.
*
* For example:
* describedAs("a big decimal equal to %0", equalTo(myBigDecimal), myBigDecimal.toPlainString())
*
* @param description
* the new description for the wrapped matcher
* @param matcher
* the matcher to wrap
* @param values
* optional values to insert into the tokenised description
*/
public static org.hamcrest.Matcher describedAs(java.lang.String description, org.hamcrest.Matcher matcher, java.lang.Object... values) {
return org.hamcrest.core.DescribedAs.describedAs(description, matcher, values);
}
/**
* Creates a matcher for {@link Iterable}s that only matches when a single pass over the
* examined {@link Iterable} yields items that are all matched by the specified
* itemMatcher
.
*
* For example:
* assertThat(Arrays.asList("bar", "baz"), everyItem(startsWith("ba")))
*
* @param itemMatcher
* the matcher to apply to every item provided by the examined {@link Iterable}
*/
public static org.hamcrest.Matcher> everyItem(org.hamcrest.Matcher itemMatcher) {
return org.hamcrest.core.Every.everyItem(itemMatcher);
}
/**
* A shortcut to the frequently used is(equalTo(x))
.
*
* For example:
* assertThat(cheese, is(smelly))
* instead of:
* assertThat(cheese, is(equalTo(smelly)))
*/
public static org.hamcrest.Matcher is(T value) {
return org.hamcrest.core.Is.is(value);
}
/**
* Decorates another Matcher, retaining its behaviour, but allowing tests
* to be slightly more expressive.
*
* For example:
* assertThat(cheese, is(equalTo(smelly)))
* instead of:
* assertThat(cheese, equalTo(smelly))
*/
public static org.hamcrest.Matcher is(org.hamcrest.Matcher matcher) {
return org.hamcrest.core.Is.is(matcher);
}
/**
* A shortcut to the frequently used is(instanceOf(SomeClass.class))
.
*
* For example:
* assertThat(cheese, is(Cheddar.class))
* instead of:
* assertThat(cheese, is(instanceOf(Cheddar.class)))
*
* @deprecated use isA(Class type) instead.
*/
public static org.hamcrest.Matcher is(java.lang.Class type) {
return org.hamcrest.core.Is.is(type);
}
/**
* A shortcut to the frequently used is(instanceOf(SomeClass.class))
.
*
* For example:
* assertThat(cheese, isA(Cheddar.class))
* instead of:
* assertThat(cheese, is(instanceOf(Cheddar.class)))
*/
public static org.hamcrest.Matcher isA(java.lang.Class type) {
return org.hamcrest.core.Is.isA(type);
}
/**
* Creates a matcher that always matches, regardless of the examined object.
*/
public static org.hamcrest.Matcher anything() {
return org.hamcrest.core.IsAnything.anything();
}
/**
* 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 anything(java.lang.String description) {
return org.hamcrest.core.IsAnything.anything(description);
}
/**
* Creates a matcher for {@link Iterable}s that only matches when a single pass over the
* examined {@link Iterable} yields at least one item that is equal to the specified
* item
. Whilst matching, the traversal of the examined {@link Iterable}
* will stop as soon as a matching item is found.
*
* For example:
* assertThat(Arrays.asList("foo", "bar"), hasItem("bar"))
*
* @param item
* the item to compare against the items provided by the examined {@link Iterable}
*/
public static org.hamcrest.Matcher> hasItem(T item) {
return org.hamcrest.core.IsCollectionContaining.hasItem(item);
}
/**
* Creates a matcher for {@link Iterable}s that only matches when a single pass over the
* examined {@link Iterable} yields at least one item that is matched by the specified
* itemMatcher
. Whilst matching, the traversal of the examined {@link Iterable}
* will stop as soon as a matching item is found.
*
* For example:
* assertThat(Arrays.asList("foo", "bar"), hasItem(startsWith("ba")))
*
* @param itemMatcher
* the matcher to apply to items provided by the examined {@link Iterable}
*/
public static org.hamcrest.Matcher> hasItem(org.hamcrest.Matcher super T> itemMatcher) {
return org.hamcrest.core.IsCollectionContaining.hasItem(itemMatcher);
}
/**
* Creates a matcher for {@link Iterable}s that matches when consecutive passes over the
* examined {@link Iterable} yield at least one item that is equal to the corresponding
* item from the specified items
. Whilst matching, each traversal of the
* examined {@link Iterable} will stop as soon as a matching item is found.
*
* For example:
* assertThat(Arrays.asList("foo", "bar", "baz"), hasItems("baz", "foo"))
*
* @param items
* the items to compare against the items provided by the examined {@link Iterable}
*/
public static org.hamcrest.Matcher> hasItems(T... items) {
return org.hamcrest.core.IsCollectionContaining.hasItems(items);
}
/**
* Creates a matcher for {@link Iterable}s that matches when consecutive passes over the
* examined {@link Iterable} yield at least one item that is matched by the corresponding
* matcher from the specified itemMatchers
. Whilst matching, each traversal of
* the examined {@link Iterable} will stop as soon as a matching item is found.
*
* For example:
* assertThat(Arrays.asList("foo", "bar", "baz"), hasItems(endsWith("z"), endsWith("o")))
*
* @param itemMatchers
* the matchers to apply to items provided by the examined {@link Iterable}
*/
public static org.hamcrest.Matcher> hasItems(org.hamcrest.Matcher super T>... itemMatchers) {
return org.hamcrest.core.IsCollectionContaining.hasItems(itemMatchers);
}
/**
* Creates a matcher that matches when the examined object is logically equal to the specified
* operand
, as determined by calling the {@link java.lang.Object#equals} method on
* the examined object.
*
* If the specified operand is null
then the created matcher will only match if
* the examined object's equals
method returns true
when passed a
* null
(which would be a violation of the equals
contract), unless the
* examined object itself is null
, in which case the matcher will return a positive
* match.
*
* The created matcher provides a special behaviour when examining Array
s, whereby
* it will match if both the operand and the examined object are arrays of the same length and
* contain items that are equal to each other (according to the above rules) in the same
* indexes.
*
* For example:
*
* assertThat("foo", equalTo("foo"));
* assertThat(new String[] {"foo", "bar"}, equalTo(new String[] {"foo", "bar"}));
*
*/
public static org.hamcrest.Matcher equalTo(T operand) {
return org.hamcrest.core.IsEqual.equalTo(operand);
}
/**
* Creates a matcher that matches when the examined object is an instance of the specified type
,
* as determined by calling the {@link java.lang.Class#isInstance(Object)} method on that type, passing the
* the examined object.
*
* The created matcher forces a relationship between specified type and the examined object, and should be
* used when it is necessary to make generics conform, for example in the JMock clause
* with(any(Thing.class))
*
* For example:
* assertThat(new Canoe(), instanceOf(Canoe.class));
*/
public static org.hamcrest.Matcher any(java.lang.Class type) {
return org.hamcrest.core.IsInstanceOf.any(type);
}
/**
* Creates a matcher that matches when the examined object is an instance of the specified type
,
* as determined by calling the {@link java.lang.Class#isInstance(Object)} method on that type, passing the
* the examined object.
*
* The created matcher assumes no relationship between specified type and the examined object.
*
* For example:
* assertThat(new Canoe(), instanceOf(Paddlable.class));
*/
public static org.hamcrest.Matcher instanceOf(java.lang.Class> type) {
return org.hamcrest.core.IsInstanceOf.instanceOf(type);
}
/**
* Creates a matcher that wraps an existing matcher, but inverts the logic by which
* it will match.
*
* For example:
* assertThat(cheese, is(not(equalTo(smelly))))
*
* @param matcher
* the matcher whose sense should be inverted
*/
public static org.hamcrest.Matcher not(org.hamcrest.Matcher matcher) {
return org.hamcrest.core.IsNot.not(matcher);
}
/**
* A shortcut to the frequently used not(equalTo(x))
.
*
* For example:
* assertThat(cheese, is(not(smelly)))
* instead of:
* assertThat(cheese, is(not(equalTo(smelly))))
*
* @param value
* the value that any examined object should not equal
*/
public static org.hamcrest.Matcher not(T value) {
return org.hamcrest.core.IsNot.not(value);
}
/**
* Creates a matcher that matches if examined object is null
.
*
* For example:
* assertThat(cheese, is(nullValue())
*/
public static org.hamcrest.Matcher nullValue() {
return org.hamcrest.core.IsNull.nullValue();
}
/**
* Creates a matcher that matches if examined object is null
. Accepts a
* single dummy argument to facilitate type inference.
*
* For example:
* assertThat(cheese, is(nullValue(Cheese.class))
*
* @param type
* dummy parameter used to infer the generic type of the returned matcher
*/
public static org.hamcrest.Matcher nullValue(java.lang.Class type) {
return org.hamcrest.core.IsNull.nullValue(type);
}
/**
* A shortcut to the frequently used not(nullValue())
.
*
* For example:
* assertThat(cheese, is(notNullValue()))
* instead of:
* assertThat(cheese, is(not(nullValue())))
*/
public static org.hamcrest.Matcher notNullValue() {
return org.hamcrest.core.IsNull.notNullValue();
}
/**
* A shortcut to the frequently used not(nullValue(X.class)). Accepts a
* single dummy argument to facilitate type inference.
.
*
* For example:
* assertThat(cheese, is(notNullValue(X.class)))
* instead of:
* assertThat(cheese, is(not(nullValue(X.class))))
*
* @param type
* dummy parameter used to infer the generic type of the returned matcher
*/
public static org.hamcrest.Matcher notNullValue(java.lang.Class type) {
return org.hamcrest.core.IsNull.notNullValue(type);
}
/**
* 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 org.hamcrest.Matcher sameInstance(T target) {
return org.hamcrest.core.IsSame.sameInstance(target);
}
/**
* 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 org.hamcrest.Matcher theInstance(T target) {
return org.hamcrest.core.IsSame.theInstance(target);
}
/**
* Creates a matcher that matches if the examined {@link String} contains the specified
* {@link String} anywhere.
*
* For example:
* assertThat("myStringOfNote", containsString("ring"))
*
* @param substring
* the substring that the returned matcher will expect to find within any examined string
*/
public static org.hamcrest.Matcher containsString(java.lang.String substring) {
return org.hamcrest.core.StringContains.containsString(substring);
}
/**
* Creates a matcher that matches if the examined {@link String} starts with the specified
* {@link String}.
*
* For example:
* assertThat("myStringOfNote", startsWith("my"))
*
* @param prefix
* the substring that the returned matcher will expect at the start of any examined string
*/
public static org.hamcrest.Matcher startsWith(java.lang.String prefix) {
return org.hamcrest.core.StringStartsWith.startsWith(prefix);
}
/**
* Creates a matcher that matches if the examined {@link String} ends with the specified
* {@link String}.
*
* For example:
* assertThat("myStringOfNote", endsWith("Note"))
*
* @param suffix
* the substring that the returned matcher will expect at the end of any examined string
*/
public static org.hamcrest.Matcher endsWith(java.lang.String suffix) {
return org.hamcrest.core.StringEndsWith.endsWith(suffix);
}
}