ImplementationListToImplementationReportViewModelMapper { public ImplementationReportViewModel mapUsImplementations(Collection<Implementation> implementations, ViaReportStatus status) throws NoSuchMethodException, IllegalAccessException, InvocationTargetException { Implementation implementation = findImplementationForExecutor(implementations, US.name()); ImplementationReportViewModel report = new ImplementationReportViewModel(); report.setType(ImplementationReportType.US); report.setStatus(status); if (implementation != null) { for (String product : products) { mapForProduct(implementation, product, report); } } return report; }  ImplementationReportViewModel mapApeImplementations(Collection<Implementation> implementations, ViaReportStatus status); ImplementationReportViewModel mapUsImplementations(Collection<Implementation> implementations, ViaReportStatus status);  }
@Test public void shouldMapUsType() throws Exception { Implementation implementation = getImplementationForExecutor(PRODUCT_6x1_CODE, US_EXECUTOR); ImplementationReportViewModel viewModel = mapper.mapUsImplementations(newArrayList(implementation), malariaProgram.getStatus()); assertThat(viewModel.getType(), is(ImplementationReportType.US)); }
@Test public void shouldReturnEmptyIfImplementationsAreNoUsExecutor() throws Exception { Implementation implementation = make(a(randomImplementation)); ImplementationReportViewModel implementationReportViewModel = mapper.mapUsImplementations(newArrayList (implementation), malariaProgram.getStatus()); assertThat(implementationReportViewModel.getCurrentTreatment6x1(), is(0L)); assertThat(implementationReportViewModel.getExistingStock6x1(), is(0L)); assertThat(implementationReportViewModel.getCurrentTreatment6x2(), is(0L)); assertThat(implementationReportViewModel.getExistingStock6x2(), is(0L)); assertThat(implementationReportViewModel.getCurrentTreatment6x3(), is(0L)); assertThat(implementationReportViewModel.getExistingStock6x3(), is(0L)); assertThat(implementationReportViewModel.getCurrentTreatment6x4(), is(0L)); assertThat(implementationReportViewModel.getExistingStock6x4(), is(0L)); }