LoggerTagToken implements Token { @Override public void render(final LogEntry logEntry, final StringBuilder builder) { String tag = logEntry.getTag(); if (tag == null) { builder.append(empty); } else { builder.append(tag); } } LoggerTagToken();   LoggerTagToken(final String empty); @Override Collection<LogEntryValue> getRequiredLogEntryValues(); @Override void render(final LogEntry logEntry, final StringBuilder builder); @Override void apply(final LogEntry logEntry, final PreparedStatement statement, final int index);  }
@Test public void renderExistingTag() { LoggerTagToken token = new LoggerTagToken(); assertThat(render(token, "test")).isEqualTo("test"); }
@Test public void renderDefaultEmptyTag() { LoggerTagToken token = new LoggerTagToken(); assertThat(render(token, null)).isEmpty(); }
@Test public void renderDefinedEmptyTag() { LoggerTagToken token = new LoggerTagToken("-"); assertThat(render(token, null)).isEqualTo("-"); }