ReportAppender { public static StringBuilder appendCompletedMessage(String message, StringBuilder report, JobStatus status) { if (status == JobStatus.PASSED) { message = MessageConstants.CONSOLE_GREEN + message; } else { message = MessageConstants.CONSOLE_RED + message; } report.append(message).append(System.lineSeparator()); return report; }  static StringBuilder appendStartedMessage(String message, StringBuilder report, Class classType); static StringBuilder appendCompletedMessage(String message, StringBuilder report, JobStatus status); static StringBuilder appendCompletedMessage(String message, StringBuilder report, TaskStatus status); static StringBuilder appendInfoMessage(String message, StringBuilder report);  }
@Test public void appendCompletedMessage_jobCompletedWithStatusPassed_correctMessage() { String message = "Test message"; StringBuilder report = new StringBuilder(); JobStatus status = JobStatus.PASSED; String expectedResult = MessageConstants.CONSOLE_GREEN + message + System.lineSeparator(); String actualResult = ReportAppender.appendCompletedMessage(message, report, status).toString(); Assert.assertEquals(expectedResult, actualResult); }
@Test public void appendCompletedMessage_jobCompletedWithStatusFailed_correctMessage() { String message = "Test message"; StringBuilder report = new StringBuilder(); JobStatus status = JobStatus.FAILED; String expectedResult = MessageConstants.CONSOLE_RED + message + System.lineSeparator(); String actualResult = ReportAppender.appendCompletedMessage(message, report, status).toString(); Assert.assertEquals(expectedResult, actualResult); }
@Test public void appendCompletedMessage_taskCompletedWithStatusPassed_correctMessage() { String message = "Test message"; StringBuilder report = new StringBuilder(); TaskStatus status = TaskStatus.PASSED; String expectedResult = MessageConstants.CONSOLE_GREEN + message + System.lineSeparator(); String actualResult = ReportAppender.appendCompletedMessage(message, report, status).toString(); Assert.assertEquals(expectedResult, actualResult); }
@Test public void appendCompletedMessage_taskCompletedWithStatusFailed_correctMessage() { String message = "Test message"; StringBuilder report = new StringBuilder(); TaskStatus status = TaskStatus.FAILED; String expectedResult = MessageConstants.CONSOLE_RED + message + System.lineSeparator(); String actualResult = ReportAppender.appendCompletedMessage(message, report, status).toString(); Assert.assertEquals(expectedResult, actualResult); }