### Question:
ConsoleFilter implements Filter { @Override public boolean isLoggable(LogRecord record) { if (record == null || record.getMessage() == null) { return true; } if (LogFilterHelper.isSensitiveAuthMeCommand(record.getMessage())) { String playerName = record.getMessage().split(" ")[0]; record.setMessage(playerName + " issued an AuthMe command"); } return true; }  @Override boolean isLoggable(LogRecord record);  }### Answer:
@Test public void shouldReplaceSensitiveRecord() { LogRecord record = createRecord(SENSITIVE_COMMAND); boolean result = filter.isLoggable(record); assertThat(result, equalTo(true)); verify(record).setMessage("User issued an AuthMe command"); }
@Test public void shouldNotFilterRegularCommand() { LogRecord record = createRecord(NORMAL_COMMAND); boolean result = filter.isLoggable(record); assertThat(result, equalTo(true)); verify(record, never()).setMessage("User issued an AuthMe command"); }
@Test public void shouldManageRecordWithNullMessage() { LogRecord record = createRecord(null); boolean result = filter.isLoggable(record); assertThat(result, equalTo(true)); verify(record, never()).setMessage("User issued an AuthMe command"); }