Created
August 6, 2018 20:25
-
-
Save wkorando/f431be5c28531063c3e4055cc13353ea to your computer and use it in GitHub Desktop.
This file contains hidden or 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 TestThreadSafeAppender { | |
@BeforeEach | |
public void clearLoggingStatements() { | |
ThreadSafeAppender.clearEvents(); | |
} | |
@Test | |
public void testAssertingLoggingStatementsA() { | |
LogProducingService service = new LogProducingService(); | |
service.writeSomeLoggingStatements("A"); | |
assertThat(ThreadSafeAppender.getEvents()).extracting("message").containsOnly("Let's assert some logs! A"); | |
} | |
@Test | |
public void testAssertingLoggingStatementsB() { | |
LogProducingService service = new LogProducingService(); | |
service.writeSomeLoggingStatements("B"); | |
assertThat(ThreadSafeAppender.getEvents()).extracting("message").containsOnly("Let's assert some logs! B"); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment