Skip to content

Commit

Permalink
Merge pull request #181 from adamecp/JBEAP-14320-master
Browse files Browse the repository at this point in the history
Add test for JBEAP-14320
  • Loading branch information
jamezp authored May 9, 2018
2 parents 42cc18e + 397c1a4 commit 2b11dcd
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 2b11dcd

Please sign in to comment.