Skip to content

Commit e158b76

Browse files
committed
Make assertion stronger to assert that each message appears twice because we configured two appenders as proxies.
1 parent 447633f commit e158b76

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

  • powertools-logging/powertools-logging-log4j/src/test/java/software/amazon/lambda/powertools/logging/log4j/internal

powertools-logging/powertools-logging-log4j/src/test/java/software/amazon/lambda/powertools/logging/log4j/internal/Log4jLoggingManagerTest.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -93,9 +93,10 @@ void shouldDetectMultipleBufferingAppendersRegardlessOfName() throws IOException
9393
// Then - both appenders should have flushed their buffers
9494
File logFile = new File("target/logfile.json");
9595
assertThat(logFile).exists();
96-
assertThat(contentOf(logFile))
97-
.contains("Test message 1")
98-
.contains("Test message 2");
96+
String content = contentOf(logFile);
97+
// Each message should appear twice (once from each BufferingAppender)
98+
assertThat(content.split("Test message 1", -1)).hasSize(3); // 2 occurrences = 3 parts
99+
assertThat(content.split("Test message 2", -1)).hasSize(3); // 2 occurrences = 3 parts
99100
}
100101

101102
@AfterEach

0 commit comments

Comments
 (0)