diff options
author | Belen Pruvost <belen.pruvost@sonarsource.com> | 2022-07-05 14:03:34 +0200 |
---|---|---|
committer | sonartech <sonartech@sonarsource.com> | 2022-07-05 20:02:54 +0000 |
commit | 5a2393a0cd4503d84e42631abdde086bfbfb3901 (patch) | |
tree | 33fce2c9169a71c103a6b2e89db5f59cff1ca3aa /server/sonar-process | |
parent | bb411d21619c2aeadcd31df5ab1f68e8d819ac09 (diff) | |
download | sonarqube-5a2393a0cd4503d84e42631abdde086bfbfb3901.tar.gz sonarqube-5a2393a0cd4503d84e42631abdde086bfbfb3901.zip |
[NO JIRA] Fix LogbackHelperTest
Diffstat (limited to 'server/sonar-process')
-rw-r--r-- | server/sonar-process/src/test/java/org/sonar/process/logging/LogbackHelperTest.java | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/server/sonar-process/src/test/java/org/sonar/process/logging/LogbackHelperTest.java b/server/sonar-process/src/test/java/org/sonar/process/logging/LogbackHelperTest.java index d5c365f8a78..805e95e3c46 100644 --- a/server/sonar-process/src/test/java/org/sonar/process/logging/LogbackHelperTest.java +++ b/server/sonar-process/src/test/java/org/sonar/process/logging/LogbackHelperTest.java @@ -55,6 +55,7 @@ import org.sonar.process.MessageException; import org.sonar.process.ProcessId; import org.sonar.process.Props; +import static java.util.stream.Collectors.toList; import static org.apache.commons.lang.RandomStringUtils.randomAlphanumeric; import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThatThrownBy; @@ -173,7 +174,7 @@ public class LogbackHelperTest { julLogger.severe("Message1"); // JUL bridge has not been initialized, nothing in logs - assertThat(memoryAppender.getLogs()).isEmpty(); + assertThat(memoryAppender.getLogs().stream().filter(l -> l.getMessage().equals("Message1")).collect(toList())).isEmpty(); // Enabling JUL bridge LoggerContextListener propagator = underTest.enableJulChangePropagation(ctx); @@ -193,7 +194,7 @@ public class LogbackHelperTest { assertThat(julLogger.isLoggable(java.util.logging.Level.WARNING)).isTrue(); // We are expecting messages from info to severe - assertThat(memoryAppender.getLogs()).hasSize(6); + assertThat(memoryAppender.getLogs().stream().filter(l -> l.getMessage().equals("Message2")).collect(toList())).hasSize(6); memoryAppender.clear(); ctx.getLogger(logbackRootLoggerName).setLevel(Level.INFO); @@ -206,7 +207,7 @@ public class LogbackHelperTest { julLogger.severe("Message3"); // We are expecting messages from finest to severe in TRACE mode - assertThat(memoryAppender.getLogs()).hasSize(3); + assertThat(memoryAppender.getLogs().stream().filter(l -> l.getMessage().equals("Message3")).collect(toList())).hasSize(3); memoryAppender.clear(); memoryAppender.stop(); |