ProcessorFactory { static StatusProcessor produce(SuiteStatusResult suiteStatusResult, String reportUrl, RedirectWriter redirectWriter, RunnerTerminator runnerTerminator) { StatusProcessor processor = null; if (suiteStatusResult != null) { switch (suiteStatusResult.getStatus()) { case PROGRESS: processor = new ProgressStatusProcessor(suiteStatusResult); break; case ERROR: processor = new ProcessingErrorStatusProcessor(suiteStatusResult); break; case FATAL_ERROR: processor = new FatalErrorStatusProcessor(suiteStatusResult); break; case FINISHED: processor = new SuiteFinishedProcessor(reportUrl, redirectWriter, runnerTerminator); break; case UNKNOWN: break; default: processor = new UnexpectedStatusProcessor(suiteStatusResult); break; } } return processor; } private  ProcessorFactory();   }
@Test public void processTest_statusIsNull() { SuiteStatusResult nullSuiteStatus = null; StatusProcessor processor = ProcessorFactory .produce(nullSuiteStatus, REPORT_URL, null, runnerTerminator); assertThat(processor, is(nullValue())); }
@Test public void processTest_statusIsUnknown() { StatusProcessor processor = ProcessorFactory .produce(new SuiteStatusResult(ProcessingStatus.UNKNOWN), REPORT_URL, null, runnerTerminator); assertThat(processor, is(nullValue())); }
@Test public void processTest_processingErrorStatus() { StatusProcessor processor = ProcessorFactory .produce(new SuiteStatusResult(ProcessingStatus.ERROR), REPORT_URL, null, runnerTerminator); assertThat(processor, instanceOf(ProcessingErrorStatusProcessor.class)); }
@Test public void processTest_finishedStatus() { StatusProcessor processor = ProcessorFactory .produce(new SuiteStatusResult(ProcessingStatus.FINISHED), REPORT_URL, null, runnerTerminator); assertThat(processor, instanceOf(SuiteFinishedProcessor.class)); }
@Test public void processTest_progressStatus() { StatusProcessor processor = ProcessorFactory .produce(new SuiteStatusResult(ProcessingStatus.PROGRESS), REPORT_URL, null, runnerTerminator); assertThat(processor, instanceOf(ProgressStatusProcessor.class)); }