/** * Verifies that the given {@code CharSequence} ends with the given suffix. * * @param info contains information about the assertion. * @param actual the actual {@code CharSequence}. * @param suffix the given suffix. * @throws NullPointerException if the given sequence is {@code null}. * @throws AssertionError if the given {@code CharSequence} is {@code null}. * @throws AssertionError if the actual {@code CharSequence} does not end with the given suffix. */ public void assertEndsWith(AssertionInfo info, CharSequence actual, CharSequence suffix) { failIfSuffixIsNull(suffix); assertNotNull(info, actual); if (!comparisonStrategy.stringEndsWith(actual.toString(), suffix.toString())) throw failures.failure(info, shouldEndWith(actual, suffix, comparisonStrategy)); }
/** * Verifies that the given {@code CharSequence} does not end with the given suffix. * * @param info contains information about the assertion. * @param actual the actual {@code CharSequence}. * @param suffix the given suffix. * @throws NullPointerException if the given sequence is {@code null}. * @throws AssertionError if the given {@code CharSequence} is {@code null}. * @throws AssertionError if the actual {@code CharSequence} ends with the given suffix. */ public void assertDoesNotEndWith(AssertionInfo info, CharSequence actual, CharSequence suffix) { failIfSuffixIsNull(suffix); assertNotNull(info, actual); if (comparisonStrategy.stringEndsWith(actual.toString(), suffix.toString())) throw failures.failure(info, shouldNotEndWith(actual, suffix, comparisonStrategy)); }
/** * Verifies that the given {@code CharSequence} does not end with the given suffix. * * @param info contains information about the assertion. * @param actual the actual {@code CharSequence}. * @param suffix the given suffix. * @throws NullPointerException if the given sequence is {@code null}. * @throws AssertionError if the given {@code CharSequence} is {@code null}. * @throws AssertionError if the actual {@code CharSequence} ends with the given suffix. */ public void assertDoesNotEndWith(AssertionInfo info, CharSequence actual, CharSequence suffix) { failIfSuffixIsNull(suffix); assertNotNull(info, actual); if (comparisonStrategy.stringEndsWith(actual.toString(), suffix.toString())) throw failures.failure(info, shouldNotEndWith(actual, suffix, comparisonStrategy)); }
/** * Verifies that the given {@code CharSequence} ends with the given suffix. * * @param info contains information about the assertion. * @param actual the actual {@code CharSequence}. * @param suffix the given suffix. * @throws NullPointerException if the given sequence is {@code null}. * @throws AssertionError if the given {@code CharSequence} is {@code null}. * @throws AssertionError if the actual {@code CharSequence} does not end with the given suffix. */ public void assertEndsWith(AssertionInfo info, CharSequence actual, CharSequence suffix) { failIfSuffixIsNull(suffix); assertNotNull(info, actual); if (!comparisonStrategy.stringEndsWith(actual.toString(), suffix.toString())) throw failures.failure(info, shouldEndWith(actual, suffix, comparisonStrategy)); }
/** * Verifies that the given {@code CharSequence} ends with the given suffix. * * @param info contains information about the assertion. * @param actual the actual {@code CharSequence}. * @param suffix the given suffix. * @throws NullPointerException if the given sequence is {@code null}. * @throws AssertionError if the given {@code CharSequence} is {@code null}. * @throws AssertionError if the actual {@code CharSequence} does not end with the given suffix. */ public void assertEndsWith(AssertionInfo info, CharSequence actual, CharSequence suffix) { if (suffix == null) { throw new NullPointerException("The given suffix should not be null"); } assertNotNull(info, actual); if (comparisonStrategy.stringEndsWith(actual.toString(), suffix.toString())) { return; } throw failures.failure(info, shouldEndWith(actual, suffix, comparisonStrategy)); }