"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "log4j-core/src/test/java/org/apache/logging/log4j/core/layout/Log4j2_2195_Test.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).

Log4j2_2195_Test.java  (apache-log4j-2.11.1-src):Log4j2_2195_Test.java  (apache-log4j-2.11.2-src)
skipping to change at line 44 skipping to change at line 44
@ClassRule @ClassRule
public static final LoggerContextRule loggerContextRule = new LoggerContextR ule( public static final LoggerContextRule loggerContextRule = new LoggerContextR ule(
"src/test/resources/LOG4J-2195/log4j2.xml"); "src/test/resources/LOG4J-2195/log4j2.xml");
private static final Logger logger = LogManager.getLogger(Log4j2_2195_Test.c lass); private static final Logger logger = LogManager.getLogger(Log4j2_2195_Test.c lass);
@Test @Test
public void test() { public void test() {
logger.info("This is a test.", new Exception("Test exception!")); logger.info("This is a test.", new Exception("Test exception!"));
ListAppender listAppender = loggerContextRule.getListAppender("ListAppen der"); final ListAppender listAppender = loggerContextRule.getListAppender("Lis tAppender");
Assert.assertNotNull(listAppender); Assert.assertNotNull(listAppender);
List<String> events = listAppender.getMessages(); final List<String> events = listAppender.getMessages();
Assert.assertNotNull(events); Assert.assertNotNull(events);
Assert.assertEquals(1, events.size()); Assert.assertEquals(1, events.size());
String logEvent = events.get(0); final String logEvent = events.get(0);
Assert.assertNotNull(logEvent); Assert.assertNotNull(logEvent);
Assert.assertFalse("\"org.junit\" should not be here", logEvent.contains ("org.junit")); Assert.assertFalse("\"org.junit\" should not be here", logEvent.contains ("org.junit"));
Assert.assertFalse("\"org.eclipse\" should not be here", logEvent.contai ns("org.eclipse")); Assert.assertFalse("\"org.eclipse\" should not be here", logEvent.contai ns("org.eclipse"));
// //
Layout<? extends Serializable> layout = listAppender.getLayout(); final Layout<? extends Serializable> layout = listAppender.getLayout();
PatternLayout pLayout = (PatternLayout) layout; final PatternLayout pLayout = (PatternLayout) layout;
Assert.assertNotNull(pLayout); Assert.assertNotNull(pLayout);
Serializer eventSerializer = pLayout.getEventSerializer(); final Serializer eventSerializer = pLayout.getEventSerializer();
Assert.assertNotNull(eventSerializer); Assert.assertNotNull(eventSerializer);
// //
Assert.assertTrue("Missing \"|\"", logEvent.contains("|")); Assert.assertTrue("Missing \"|\"", logEvent.contains("|"));
} }
} }
 End of changes. 5 change blocks. 
6 lines changed or deleted 6 lines changed or added

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