AbstractActionTest.java (apache-log4j-2.12.3-src) | : | AbstractActionTest.java (apache-log4j-2.12.4-src) | ||
---|---|---|---|---|
skipping to change at line 48 | skipping to change at line 48 | |||
@Test | @Test | |||
public void testExceptionsAreLoggedToStatusLogger() { | public void testExceptionsAreLoggedToStatusLogger() { | |||
StatusLogger statusLogger = StatusLogger.getLogger(); | StatusLogger statusLogger = StatusLogger.getLogger(); | |||
statusLogger.clear(); | statusLogger.clear(); | |||
new TestAction().run(); | new TestAction().run(); | |||
List<StatusData> statusDataList = statusLogger.getStatusData(); | List<StatusData> statusDataList = statusLogger.getStatusData(); | |||
assertEquals(1, statusDataList.size()); | assertEquals(1, statusDataList.size()); | |||
StatusData statusData = statusDataList.get(0); | StatusData statusData = statusDataList.get(0); | |||
assertEquals(Level.WARN, statusData.getLevel()); | assertEquals(Level.WARN, statusData.getLevel()); | |||
String formattedMessage = statusData.getFormattedStatus(); | String formattedMessage = statusData.getFormattedStatus(); | |||
assertTrue(formattedMessage.contains("Exception reported by action 'clas s org.apache." + | String expected = String.format("Exception reported by action 'class org .apache." + | |||
"logging.log4j.core.appender.rolling.action.AbstractActionTest$T estAction' java.io.IOException: " + | "logging.log4j.core.appender.rolling.action.AbstractActionTest$T estAction' java.io.IOException: " + | |||
"failed\n\tat org.apache.logging.log4j.core.appender.rolling.act | "failed%n\tat org.apache.logging.log4j.core.appender.rolling.act | |||
ion.AbstractActionTest" + | ion.AbstractActionTest" + | |||
"$TestAction.execute(AbstractActionTest.java:")); | "$TestAction.execute(AbstractActionTest.java:"); | |||
assertTrue(formattedMessage.contains(expected)); | ||||
} | } | |||
@Test | @Test | |||
public void testRuntimeExceptionsAreLoggedToStatusLogger() { | public void testRuntimeExceptionsAreLoggedToStatusLogger() { | |||
StatusLogger statusLogger = StatusLogger.getLogger(); | StatusLogger statusLogger = StatusLogger.getLogger(); | |||
statusLogger.clear(); | statusLogger.clear(); | |||
new AbstractAction() { | new AbstractAction() { | |||
@Override | @Override | |||
public boolean execute() { | public boolean execute() { | |||
throw new IllegalStateException(); | throw new IllegalStateException(); | |||
End of changes. 2 change blocks. | ||||
4 lines changed or deleted | 5 lines changed or added |