"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "log4j-core/src/test/java/org/apache/logging/log4j/core/appender/SmtpAppenderAsyncTest.java" between
apache-log4j-2.11.1-src.tar.gz and apache-log4j-2.11.2-src.tar.gz

About: Apache Log4j 2 is a logging library for Java. Source distribution (Java).

SmtpAppenderAsyncTest.java  (apache-log4j-2.11.1-src):SmtpAppenderAsyncTest.java  (apache-log4j-2.11.2-src)
skipping to change at line 67 skipping to change at line 67
@Test @Test
public void testSync() { public void testSync() {
testSmtpAppender(ctx.getLogger("sync")); testSmtpAppender(ctx.getLogger("sync"));
} }
@Test @Test
public void testAsync() { public void testAsync() {
testSmtpAppender(ctx.getLogger("async")); testSmtpAppender(ctx.getLogger("async"));
} }
private void testSmtpAppender(Logger logger) { private void testSmtpAppender(final Logger logger) {
ThreadContext.put("MDC1", "mdc1"); ThreadContext.put("MDC1", "mdc1");
logger.error("the message"); logger.error("the message");
ctx.getLoggerContext().stop(); ctx.getLoggerContext().stop();
smtpServer.stop(); smtpServer.stop();
assertEquals(1, smtpServer.getReceivedEmailSize()); assertEquals(1, smtpServer.getReceivedEmailSize());
final Iterator<SmtpMessage> messages = smtpServer.getReceivedEmail(); final Iterator<SmtpMessage> messages = smtpServer.getReceivedEmail();
final SmtpMessage email = messages.next(); final SmtpMessage email = messages.next();
assertEquals("to@example.com", email.getHeaderValue("To")); assertEquals("to@example.com", email.getHeaderValue("To"));
assertEquals("from@example.com", email.getHeaderValue("From")); assertEquals("from@example.com", email.getHeaderValue("From"));
assertEquals("[mdc1]", email.getHeaderValue("Subject")); assertEquals("[mdc1]", email.getHeaderValue("Subject"));
String body = email.getBody(); final String body = email.getBody();
if (!body.contains("Body:[mdc1]")) { if (!body.contains("Body:[mdc1]")) {
fail(body); fail(body);
} }
} }
@After @After
public void teardown() { public void teardown() {
if (smtpServer != null) { if (smtpServer != null) {
smtpServer.stop(); smtpServer.stop();
} }
 End of changes. 2 change blocks. 
2 lines changed or deleted 2 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)