@Test
void shouldLogInfoAndErrorMessage() {

    ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
    PrintStream printStream = new PrintStream(outputStream);
    TaskListener taskListener = createTaskListener(printStream);
    Report report = new Report();
    report.logInfo(NOT_SHOWN);
    report.logError(NOT_SHOWN);
    LogHandler logHandler = new LogHandler(taskListener, LOG_HANDLER_NAME, report);
    report.logInfo(MESSAGE);
    report.logError(MESSAGE);
    logHandler.log(report);
    assertThat(outputStream.toString()).isEqualTo(String.format(
            "[%s] [-ERROR-] %s%n"
                    + "[%s] %s%n",
            LOG_HANDLER_NAME, MESSAGE, LOG_HANDLER_NAME, MESSAGE));
    report.logInfo(ADDITIONAL_MESSAGE);
    report.logError(ADDITIONAL_MESSAGE);
    logHandler.log(report);
    assertThat(outputStream.toString()).isEqualTo(String.format(
            "[%s] [-ERROR-] %s%n"
                    + "[%s] %s%n"
                    + "[%s] [-ERROR-] %s%n"
                    + "[%s] %s%n",
            LOG_HANDLER_NAME, MESSAGE, LOG_HANDLER_NAME, MESSAGE, LOG_HANDLER_NAME,
            ADDITIONAL_MESSAGE, LOG_HANDLER_NAME, ADDITIONAL_MESSAGE));
}