class MavenColorRenderer extends PatternRenderer {

    @Override
    protected void renderMessage(Event event, StringBuilder buff) {
        if (!isActivated) {
            super.renderMessage(event, buff);
            return;
        }

        if (event.getLevel() == WARN) {
            buff.append(colorize(event, YELLOW));
        } else if (event.getLevel() == INFO) {
            buff.append(colorizer.colorize(event.getMessage()));
        } else {
            super.renderMessage(event, buff);
        }
    }

}

class MavenColorRendererTest {

    @Rule
    public ClearSystemProperties myPropertyIsCleared;
    private static final Logger LOGGER;

    @Test
    public void do_not_colorize_when_colorization_is_deactivated() {

        StringBuilder result = new StringBuilder();

        new MavenColorRenderer(false).renderMessage(event(WARN, "warning message"), result);

        assertThat(result.toString()).isEqualTo("warning message");
    }

}