From 151c6c655e2e902cda48bea01efdd626c1ee7113 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Simon=20Basl=C3=A9?= Date: Fri, 22 Jul 2022 17:44:26 +0200 Subject: [PATCH] fix a test asserting no log content now that throwIfFatal logs --- .../reactor/core/publisher/LambdaMonoSubscriberTest.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/reactor-core/src/test/java/reactor/core/publisher/LambdaMonoSubscriberTest.java b/reactor-core/src/test/java/reactor/core/publisher/LambdaMonoSubscriberTest.java index 5f1e26ecbe..3be6bb7766 100644 --- a/reactor-core/src/test/java/reactor/core/publisher/LambdaMonoSubscriberTest.java +++ b/reactor-core/src/test/java/reactor/core/publisher/LambdaMonoSubscriberTest.java @@ -205,7 +205,7 @@ public void onNextConsumerExceptionNonFatalTriggersCancellation() { @Test public void onNextConsumerFatalDoesntTriggerCancellation() { - TestLogger testLogger = new TestLogger(); + TestLogger testLogger = new TestLogger(false); LoggerUtils.enableCaptureWith(testLogger); try { LambdaMonoSubscriber tested = new LambdaMonoSubscriber<>( @@ -216,9 +216,9 @@ public void onNextConsumerFatalDoesntTriggerCancellation() { TestSubscription testSubscription = new TestSubscription(); tested.onSubscribe(testSubscription); - //the error is expected to be thrown as it is fatal, so it doesn't go through onErrorDropped + //the error is expected to be thrown as it is fatal, so it doesn't go through onErrorDropped. However, throwIfJvmFatal now logs it. assertThatExceptionOfType(OutOfMemoryError.class).isThrownBy(() -> tested.onNext("foo")); - Assertions.assertThat(testLogger.getErrContent()).isEmpty(); + Assertions.assertThat(testLogger.getErrContent()).startsWith("[ WARN] throwIfFatal detected a jvm fatal exception, which is thrown and logged below: - java.lang.OutOfMemoryError"); assertThat(testSubscription.isCancelled).as("subscription isCancelled") .isFalse();