@Override public StepVerifier.Assertions hasDroppedErrorOfType(Class<? extends Throwable> clazz) { //noinspection ConstantConditions satisfies(() -> clazz != null, () -> "Require non-null clazz"); hasDroppedErrors(1); return satisfies( () -> clazz.isInstance(hookRecorder.droppedErrors.peek()), () -> String.format("Expected dropped error to be of type %s, was %s.", clazz.getCanonicalName(), hookRecorder.droppedErrors.peek().getClass().getCanonicalName())); }
@Override public StepVerifier.Assertions hasDroppedErrorMatching(Predicate<Throwable> matcher) { //noinspection ConstantConditions satisfies(() -> matcher != null, () -> "Require non-null matcher"); hasDroppedErrors(1); return satisfies(() -> matcher.test(hookRecorder.droppedErrors.peek()), () -> String.format( "Expected dropped error matching the given predicate, did not match: <%s>.", hookRecorder.droppedErrors.peek())); }
@Override public StepVerifier.Assertions hasDroppedErrorWithMessageContaining( String messagePart) { //noinspection ConstantConditions satisfies(() -> messagePart != null, () -> "Require non-null messagePart"); hasDroppedErrors(1); String actual = hookRecorder.droppedErrors.peek().getMessage(); return satisfies(() -> actual != null && actual.contains(messagePart), () -> String.format("Expected dropped error with message containing <\"%s\">, was <\"%s\">.", messagePart, actual)); }
@Override public StepVerifier.Assertions hasDroppedErrorsSatisfying(Consumer<Collection<Throwable>> asserter) { //noinspection ConstantConditions satisfies(() -> asserter != null, () -> "Require non-null asserter"); hasDroppedErrors(); asserter.accept(hookRecorder.droppedErrors); return this; }
@Override public StepVerifier.Assertions hasDroppedErrorsMatching(Predicate<Collection<Throwable>> matcher) { //noinspection ConstantConditions satisfies(() -> matcher != null, () -> "Require non-null matcher"); hasDroppedErrors(); return satisfies(() -> matcher.test(hookRecorder.droppedErrors), () -> String.format( "Expected collection of dropped errors matching the given predicate, did not match: <%s>.", hookRecorder.droppedErrors)); }
@Override public StepVerifier.Assertions hasDroppedErrorWithMessageContaining( String messagePart) { //noinspection ConstantConditions satisfies(() -> messagePart != null, () -> "Require non-null messagePart"); hasDroppedErrors(1); String actual = hookRecorder.droppedErrors.peek().getMessage(); return satisfies(() -> actual != null && actual.contains(messagePart), () -> String.format("Expected dropped error with message containing <\"%s\">, was <\"%s\">.", messagePart, actual)); }
@Override public StepVerifier.Assertions hasDroppedErrorMatching(Predicate<Throwable> matcher) { //noinspection ConstantConditions satisfies(() -> matcher != null, () -> "Require non-null matcher"); hasDroppedErrors(1); return satisfies(() -> matcher.test(hookRecorder.droppedErrors.peek()), () -> String.format( "Expected dropped error matching the given predicate, did not match: <%s>.", hookRecorder.droppedErrors.peek())); }
@Override public StepVerifier.Assertions hasDroppedErrorOfType(Class<? extends Throwable> clazz) { //noinspection ConstantConditions satisfies(() -> clazz != null, () -> "Require non-null clazz"); hasDroppedErrors(1); return satisfies( () -> clazz.isInstance(hookRecorder.droppedErrors.peek()), () -> String.format("Expected dropped error to be of type %s, was %s.", clazz.getCanonicalName(), hookRecorder.droppedErrors.peek().getClass().getCanonicalName())); }
@Override public StepVerifier.Assertions hasDroppedErrorWithMessage(String message) { //noinspection ConstantConditions satisfies(() -> message != null, () -> "Require non-null message"); hasDroppedErrors(1); String actual = hookRecorder.droppedErrors.peek().getMessage(); return satisfies(() -> message.equals(actual), () -> String.format("Expected dropped error with message <\"%s\">, was <\"%s\">.", message, actual)); }
@Override public StepVerifier.Assertions hasDroppedErrorWithMessage(String message) { //noinspection ConstantConditions satisfies(() -> message != null, () -> "Require non-null message"); hasDroppedErrors(1); String actual = hookRecorder.droppedErrors.peek().getMessage(); return satisfies(() -> message.equals(actual), () -> String.format("Expected dropped error with message <\"%s\">, was <\"%s\">.", message, actual)); }
@Override public StepVerifier.Assertions hasDroppedErrorsSatisfying(Consumer<Collection<Throwable>> asserter) { //noinspection ConstantConditions satisfies(() -> asserter != null, () -> "Require non-null asserter"); hasDroppedErrors(); asserter.accept(hookRecorder.droppedErrors); return this; }
@Override public StepVerifier.Assertions hasDroppedErrorsMatching(Predicate<Collection<Throwable>> matcher) { //noinspection ConstantConditions satisfies(() -> matcher != null, () -> "Require non-null matcher"); hasDroppedErrors(); return satisfies(() -> matcher.test(hookRecorder.droppedErrors), () -> String.format( "Expected collection of dropped errors matching the given predicate, did not match: <%s>.", hookRecorder.droppedErrors)); }