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
@LogbackInitializer | |
public class TestLocalAppender { | |
@Test | |
@ResourceLock(value = "LOGGING", mode = ResourceAccessMode.READ_WRITE) | |
public void testLocalAppenderA() { | |
OtherLogProducingService service = new OtherLogProducingService(); | |
LocalAppender localAppender = LocalAppender.initialize("com.bk.logging.OtherLogProducingService"); | |
service.writeSomeLoggingStatements("Other logging servie A"); | |
assertThat(localAppender.getEvents()).extracting("message") | |
.containsOnly("Let's assert some logs! Other logging servie A", "This message is in a separate thread"); | |
localAppender.cleanup(); | |
} | |
@Test | |
@ResourceLock(value = "LOGGING", mode = ResourceAccessMode.READ_WRITE) | |
public void testLocalAppenderB() { | |
OtherLogProducingService service = new OtherLogProducingService(); | |
LocalAppender localAppender = LocalAppender.initialize("com.bk.logging.OtherLogProducingService"); | |
service.writeSomeLoggingStatements("Other logging servie B"); | |
assertThat(localAppender.getEvents()).extracting("message") | |
.containsOnly("Let's assert some logs! Other logging servie B", "This message is in a separate thread"); | |
localAppender.cleanup(); | |
} | |
@Test | |
@ResourceLock(value = "LOGGING", mode = ResourceAccessMode.READ) | |
public void justAnotherTest() { | |
OtherLogProducingService service = new OtherLogProducingService(); | |
service.writeSomeLoggingStatements("Local appender"); | |
// Executing just to add some logs | |
} | |
@Test | |
@ResourceLock(value = "LOGGING", mode = ResourceAccessMode.READ) | |
public void yetAnotherTest() { | |
OtherLogProducingService service = new OtherLogProducingService(); | |
service.writeSomeLoggingStatements("Local appender"); | |
// Executing just to add some logs | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment