Skip to content

Commit

Permalink
fix a test asserting no log content now that throwIfFatal logs
Browse files Browse the repository at this point in the history
  • Loading branch information
simonbasle committed Jul 22, 2022
1 parent 864a888 commit 151c6c6
Showing 1 changed file with 3 additions and 3 deletions.
Expand Up @@ -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<String> tested = new LambdaMonoSubscriber<>(
Expand All @@ -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();
Expand Down

0 comments on commit 151c6c6

Please sign in to comment.