This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class TestStaticAppender { | |
@BeforeEach | |
public void clearLoggingStatements() { | |
StaticAppender.clearEvents(); | |
} | |
@Test | |
public void testAssertingLoggingStatementsA() { | |
LogProducingService service = new LogProducingService(); | |
service.writeSomeLoggingStatements("A"); | |
assertThat(StaticAppender.getEvents()).extracting("message").containsOnly("Let's assert some logs! A", | |
"This message is in a separate thread"); | |
} | |
@Test | |
public void testAssertingLoggingStatementsB() { | |
LogProducingService service = new LogProducingService(); | |
service.writeSomeLoggingStatements("B"); | |
assertThat(StaticAppender.getEvents()).extracting("message").containsOnly("Let's assert some logs! B", | |
"This message is in a separate thread"); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment