use of reactor.test.util.TestLogger in project reactor-core by reactor.
the class FluxZipTest method failDoubleErrorHide.
// FIXME use Violation.NO_CLEANUP_ON_TERMINATE
@Test
public void failDoubleErrorHide() {
TestLogger testLogger = new TestLogger();
LoggerUtils.enableCaptureWith(testLogger);
try {
StepVerifier.create(Flux.zip(obj -> 0, Flux.just(1).hide(), Flux.never(), s -> {
s.onSubscribe(Operators.emptySubscription());
s.onError(new Exception("test"));
s.onError(new Exception("test2"));
})).verifyErrorMessage("test");
Assertions.assertThat(testLogger.getErrContent()).contains("Operator called default onErrorDropped").contains("test2");
} finally {
LoggerUtils.disableCapture();
}
}
use of reactor.test.util.TestLogger in project reactor-core by reactor.
the class LambdaMonoSubscriberTest method noErrorHookThrowsCallbackNotImplemented.
@Test
public void noErrorHookThrowsCallbackNotImplemented() {
TestLogger testLogger = new TestLogger();
LoggerUtils.enableCaptureWith(testLogger);
try {
RuntimeException boom = new IllegalArgumentException("boom");
Mono.error(boom).subscribe(v -> {
});
assertThat(testLogger.getErrContent()).contains("Operator called default onErrorDropped").contains("reactor.core.Exceptions$ErrorCallbackNotImplemented: java.lang.IllegalArgumentException: boom");
} finally {
LoggerUtils.disableCapture();
}
}
use of reactor.test.util.TestLogger in project reactor-core by reactor.
the class BaseSubscriberTest method finallyExecutesWhenHookOnErrorFails.
@Test
public void finallyExecutesWhenHookOnErrorFails() {
TestLogger testLogger = new TestLogger();
LoggerUtils.enableCaptureWith(testLogger);
try {
RuntimeException error = new IllegalArgumentException("hookOnError");
AtomicReference<SignalType> checkFinally = new AtomicReference<>();
Flux.<String>error(new IllegalStateException("someError")).subscribe(new BaseSubscriber<String>() {
@Override
protected void hookOnSubscribe(Subscription subscription) {
requestUnbounded();
}
@Override
protected void hookOnNext(String value) {
}
@Override
protected void hookOnError(Throwable throwable) {
throw error;
}
@Override
protected void hookFinally(SignalType type) {
checkFinally.set(type);
}
});
Assertions.assertThat(testLogger.getErrContent()).contains("Operator called default onErrorDropped").contains(error.getMessage());
assertThat(checkFinally).hasValue(SignalType.ON_ERROR);
} finally {
LoggerUtils.disableCapture();
}
}
use of reactor.test.util.TestLogger in project reactor-core by reactor.
the class BaseSubscriberTest method onErrorCallbackNotImplemented.
@Test
public void onErrorCallbackNotImplemented() {
TestLogger testLogger = new TestLogger();
LoggerUtils.enableCaptureWith(testLogger);
try {
Flux<String> flux = Flux.error(new IllegalStateException());
flux.subscribe(new BaseSubscriber<String>() {
@Override
protected void hookOnSubscribe(Subscription subscription) {
request(1);
}
@Override
protected void hookOnNext(String value) {
// NO-OP
}
});
Assertions.assertThat(testLogger.getErrContent()).contains("Operator called default onErrorDropped").contains("reactor.core.Exceptions$ErrorCallbackNotImplemented: java.lang.IllegalStateException");
} finally {
LoggerUtils.disableCapture();
}
}
use of reactor.test.util.TestLogger in project reactor-core by reactor.
the class MonoPeekTest method testErrorWithDoOnSuccess.
@Test
public void testErrorWithDoOnSuccess() {
TestLogger testLogger = new TestLogger();
LoggerUtils.enableCaptureWith(testLogger);
try {
Mono.error(new NullPointerException("boom")).doOnSuccess(aValue -> {
}).subscribe();
Assertions.assertThat(testLogger.getErrContent()).contains("Operator called default onErrorDropped").contains("reactor.core.Exceptions$ErrorCallbackNotImplemented: java.lang.NullPointerException: boom");
} finally {
LoggerUtils.disableCapture();
}
}
Aggregations