ConsoleServer extends AbstractServer { public void process(final BuildDetails details) { if (!isStatus(ServerStatus.PROCESSING)) { return; } clearScreen(); printResult(details); printer.println(); if (BuildSummary.SUCCESS == details.getState() || null == details.getError()) { printTest(details); } else { printer.println(NL_0, details.getError()); } try { printer.flush(); } catch (final IOException e) { logger.trace("Ignore exception", e); } }  @Override void boot(); @Override void down(); void process(final BuildDetails details);  }
@Test public void testProcess() { final TestReportNode<?> totalReport = new TestReportNode<>(); totalReport.setName(randomUUID().toString()); final TestReportNode<?> suiteReport = new TestReportNode<>(); suiteReport.setName(randomUUID().toString()); final TestReportNode<?> successCaseReport = new TestReportNode<>(); successCaseReport.setName(randomUUID().toString()); successCaseReport.setResult(Success); final TestReportNode<?> failureCaseReport = new TestReportNode<>(); failureCaseReport.setName(randomUUID().toString()); failureCaseReport.setResult(Failure); suiteReport.addChild(successCaseReport); suiteReport.addChild(failureCaseReport); totalReport.addChild(suiteReport); final BuildDetails buildDetails = new BuildDetails(); buildDetails.getUnitTestReport().add(totalReport); final ConsoleServer consoleServer = new ConsoleServer(); consoleServer.setPrinter(mock(MessagePrinter.class)); consoleServer.boot(); try { consoleServer.process(buildDetails); verify(consoleServer.getPrinter(), new AtLeast(1)).println(any(), any()); } finally { consoleServer.down(); } }