/** * Creates a new <code>{@link ShouldContainSubsequence}</code>. * * @param actual the actual value in the failed assertion. * @param subsequence the subsequence of values expected to be in {@code actual}. * @return the created {@code ErrorMessageFactory}. */ public static ErrorMessageFactory shouldContainSubsequence(Object actual, Object subsequence) { return new ShouldContainSubsequence(actual, subsequence, StandardComparisonStrategy.instance()); }
/** * Creates a new <code>{@link ShouldBeInThePast}</code>. * @param actual the actual value in the failed assertion. * @return the created {@code ErrorMessageFactory}. */ public static ErrorMessageFactory shouldBeInThePast(Date actual) { return new ShouldBeInThePast(actual, StandardComparisonStrategy.instance()); }
/** * Creates a new <code>{@link ShouldBeLess}</code>. * @param <T> guarantees that the values used in this factory have the same type. * @param actual the actual value in the failed assertion. * @param other the value used in the failed assertion to compare the actual value to. * @return the created {@code ErrorMessageFactory}. */ public static <T extends Comparable<? super T>> ErrorMessageFactory shouldBeLess(T actual, T other) { return new ShouldBeLess(actual, other, StandardComparisonStrategy.instance()); }
/** * Creates a new <code>{@link ShouldBeAfterYear}</code>. * @param actual the actual value in the failed assertion. * @param year the year to compare the actual date's year to. * @return the created {@code ErrorMessageFactory}. */ public static ErrorMessageFactory shouldBeAfterYear(Date actual, int year) { return new ShouldBeAfterYear(actual, year, StandardComparisonStrategy.instance()); }
/** * Creates a new <code>{@link ShouldContainAtIndex}</code>. * @param actual the actual value in the failed assertion. * @param expected value expected to be in {@code actual}. * @param index the index of the expected value. * @param found the value in {@code actual} stored under {@code index}. * @return the created {@code ErrorMessageFactory}. */ public static ErrorMessageFactory shouldContainAtIndex(Object actual, Object expected, Index index, Object found) { return new ShouldContainAtIndex(actual, expected, index, found, StandardComparisonStrategy.instance()); }
/** * Creates a new <code>{@link ShouldContainCharSequence}</code>. * * @param actual the actual value in the failed assertion. * @param strings the sequence of values expected to be in {@code actual}. * @param notFound the values not found. * @return the created {@code ErrorMessageFactory}. */ public static ErrorMessageFactory shouldContain(CharSequence actual, CharSequence[] strings, Set<? extends CharSequence> notFound) { return shouldContain(actual, strings, notFound, StandardComparisonStrategy.instance()); }
/** * Creates a new <code>{@link ShouldContainCharSequence}</code>. * * @param actual the actual value in the failed assertion. * @param sequence the sequence of values expected to be in {@code actual}. * @return the created {@code ErrorMessageFactory}. */ public static ErrorMessageFactory shouldContainIgnoringCase(CharSequence actual, CharSequence sequence) { return new ShouldContainCharSequence("%nExpecting:%n <%s>%nto contain:%n <%s>%n (ignoring case)", actual, sequence, StandardComparisonStrategy.instance()); }
/** * Creates a new <code>{@link ShouldNotEndWith}</code>. * * @param actual the actual value in the failed assertion. * @param expected the value or sequence of values that {@code actual} is expected to not end with. * @return the created {@code ErrorMessageFactory}. */ public static ErrorMessageFactory shouldNotEndWith(Object actual, Object expected) { return new ShouldNotEndWith(actual, expected, StandardComparisonStrategy.instance()); }
/** * Creates a new <code>{@link ShouldBeBeforeOrEqualsTo}</code>. * @param actual the actual value in the failed assertion. * @param other the value used in the failed assertion to compare the actual value to. * @return the created {@code ErrorMessageFactory}. */ public static ErrorMessageFactory shouldBeBeforeOrEqualsTo(Object actual, Object other) { return new ShouldBeBeforeOrEqualsTo(actual, other, StandardComparisonStrategy.instance()); }
/** * Creates a new <code>{@link ShouldBeToday}</code>. * @param actual the actual value in the failed assertion. * @return the created {@code ErrorMessageFactory}. */ public static ErrorMessageFactory shouldBeToday(Date actual) { return new ShouldBeToday(actual, StandardComparisonStrategy.instance()); }
/** * Build a {@link Comparables} using a {@link StandardComparisonStrategy}. */ @VisibleForTesting public Comparables() { this(StandardComparisonStrategy.instance()); }
/** * Creates a new <code>{@link ShouldContainSubsequenceOfCharSequence}</code>. * * @param actual the actual value in the failed assertion. * @param strings the sequence of values expected to be in {@code actual}. * @param firstBadOrderIndex first index failing the subsequence. * @return the created {@code ErrorMessageFactory}. */ public static ErrorMessageFactory shouldContainSubsequence(CharSequence actual, CharSequence[] strings, int firstBadOrderIndex) { return shouldContainSubsequence(actual, strings, firstBadOrderIndex, StandardComparisonStrategy.instance()); }
/** * Creates a new <code>{@link ShouldBeIn}</code>. * @param actual the actual value in the failed assertion. * @param values the group of values where {@code actual} is expected to be in. * @return the created {@code ErrorMessageFactory}. */ public static ErrorMessageFactory shouldBeIn(Object actual, Object values) { return new ShouldBeIn(actual, values, StandardComparisonStrategy.instance()); }
/** * Creates a new <code>{@link ShouldBeEqual}</code>. * * @param actual the actual value in the failed assertion. * @param expected the expected value in the failed assertion. * @param representation the {@link Representation} used to format values. * @return the created {@code AssertionErrorFactory}. */ public static AssertionErrorFactory shouldBeEqual(Object actual, Object expected, Representation representation) { return new ShouldBeEqual(actual, expected, StandardComparisonStrategy.instance(), representation); }
/** * Creates a new <code>{@link ShouldNotHaveDuplicates}</code>. * @param actual the actual value in the failed assertion. * @param duplicates the duplicate values found in {@code actual}. * @return an instance of {@code ErrorMessageFactory}. */ public static ErrorMessageFactory shouldNotHaveDuplicates(Object actual, Object duplicates) { return new ShouldNotHaveDuplicates(actual, duplicates, StandardComparisonStrategy.instance()); }
/** * Creates a new <code>{@link ShouldBeBefore}</code>. * @param actual the actual value in the failed assertion. * @param other the value used in the failed assertion to compare the actual value to. * @return the created {@code ErrorMessageFactory}. */ public static ErrorMessageFactory shouldBeBefore(Object actual, Object other) { return new ShouldBeBefore(actual, other, StandardComparisonStrategy.instance()); }
/** * Creates a new <code>{@link ShouldNotContainSequence}</code>. * @param actual the actual value in the failed assertion. * @param sequence the sequence of values expected to be in {@code actual}. * @param index the index where the sequence was found. * @return the created {@code ErrorMessageFactory}. */ public static ErrorMessageFactory shouldNotContainSequence(Object actual, Object sequence, int index) { return new ShouldNotContainSequence(actual, sequence, index, StandardComparisonStrategy.instance()); }
/** * Creates a new <code>{@link ShouldBeSubsetOf}</code>. * @param actual the actual set * @param values the expected superset * @param unexpected the unexpected value * @return the created {@code ErrorMessageFactory}. */ public static ErrorMessageFactory shouldBeSubsetOf(Object actual, Object values, Iterable<?> unexpected) { return new ShouldBeSubsetOf(actual, values, unexpected, StandardComparisonStrategy.instance()); }
/** * Creates a new <code>{@link ShouldNotContain}</code>. * @param actual the actual value in the failed assertion. * @param expected values expected not to be contained in {@code actual}. * @param found the values in {@code expected} found in {@code actual}. * @return the created {@code ErrorMessageFactory}. */ public static ErrorMessageFactory shouldNotContain(Object actual, Object expected, Object found) { return new ShouldNotContain(actual, expected, found, StandardComparisonStrategy.instance()); }
/** * Creates a new <code>{@link ShouldBeInTheFuture}</code>. * @param actual the actual value in the failed assertion. * @return the created {@code ErrorMessageFactory}. */ public static ErrorMessageFactory shouldBeInTheFuture(Date actual) { return new ShouldBeInTheFuture(actual, StandardComparisonStrategy.instance()); }