Skip to content

Commit

Permalink
Add test for JBEAP-14320
Browse files Browse the repository at this point in the history
  • Loading branch information
adamecp authored and jamezp committed May 9, 2018
1 parent 42cc18e commit 397c1a4
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions src/test/java/org/jboss/logmanager/FilterTests.java
Original file line number Diff line number Diff line change
Expand Up @@ -436,6 +436,15 @@ public void testRegexFilter3() {
assertFalse("Handler was run", ran.get());
}

@Test
public void regexFilterExceptionNullMessageTest(){
final ExtLogRecord logRecord = new ExtLogRecord(Level.ALL, null, null);
final Filter filter = new RegexFilter("test");
boolean isLoggable = filter.isLoggable(logRecord);
assertFalse(isLoggable);
assertNull(logRecord.getFormattedMessage());
}

@Test
public void testSubstitueFilter0() {
final Filter filter = new SubstituteFilter(Pattern.compile("test"), "lunch", true);
Expand Down Expand Up @@ -490,6 +499,14 @@ public void testSubstituteFilter3() {
assertEquals("Substitution was not correctly applied", "This is a lunches lunches", record.getFormattedMessage());
}

@Test
public void substituteFilterExceptionNullMessageTest(){
final ExtLogRecord logRecord = new ExtLogRecord(Level.ALL, null, null);
final Filter filter = new SubstituteFilter(Pattern.compile("test"), "lunch", true);
filter.isLoggable(logRecord);
assertEquals("null", logRecord.getFormattedMessage());
}



private static final class MessageCheckingHandler extends Handler {
Expand Down

0 comments on commit 397c1a4

Please sign in to comment.