diff options
author | Matteo Mara <matteo.mara@sonarsource.com> | 2024-02-23 15:26:37 +0100 |
---|---|---|
committer | sonartech <sonartech@sonarsource.com> | 2024-02-23 20:02:36 +0000 |
commit | a7e89a359288462eed1bff906f5203b0d8e59de9 (patch) | |
tree | 3f5f944af7544b57730c46aa9561261041c5301e | |
parent | ecae0ab5ff9df5c0aac1f252dd9a976f0b673475 (diff) | |
download | sonarqube-a7e89a359288462eed1bff906f5203b0d8e59de9.tar.gz sonarqube-a7e89a359288462eed1bff906f5203b0d8e59de9.zip |
SGB-6 improve assertion in order to check only the entries for relevant logger
-rw-r--r-- | server/sonar-webserver-core/src/test/java/org/sonar/server/app/WebServerProcessLoggingTest.java | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/server/sonar-webserver-core/src/test/java/org/sonar/server/app/WebServerProcessLoggingTest.java b/server/sonar-webserver-core/src/test/java/org/sonar/server/app/WebServerProcessLoggingTest.java index 1b79e31203f..dedaffe6fd7 100644 --- a/server/sonar-webserver-core/src/test/java/org/sonar/server/app/WebServerProcessLoggingTest.java +++ b/server/sonar-webserver-core/src/test/java/org/sonar/server/app/WebServerProcessLoggingTest.java @@ -42,6 +42,7 @@ import java.util.List; import java.util.Map; import java.util.Properties; import java.util.stream.Stream; +import org.assertj.core.groups.Tuple; import org.junit.AfterClass; import org.junit.Before; import org.junit.Rule; @@ -104,7 +105,10 @@ public class WebServerProcessLoggingTest { java.util.logging.Logger logger = java.util.logging.Logger.getLogger("com.ms.sqlserver.jdbc.DTV"); logger.finest("Test"); memoryAppender.stop(); - assertThat(memoryAppender.getLogs()).hasSize(1); + assertThat(memoryAppender.getLogs()) + .filteredOn(ILoggingEvent::getLoggerName, "com.ms.sqlserver.jdbc.DTV") + .extracting(ILoggingEvent::getLevel, ILoggingEvent::getMessage) + .containsOnly(new Tuple(Level.TRACE, "Test")); } @Test |