MalariaProgramToMalariaDataReportViewModelMapper { public MalariaDataReportViewModel Map(MalariaProgram malariaProgram) throws NoSuchMethodException, IllegalAccessException, InvocationTargetException { if (malariaProgram == null) { return new MalariaDataReportViewModel(); } return new MalariaDataReportViewModel(malariaProgram.getReportedDate(), malariaProgram.getStartPeriodDate(), malariaProgram.getEndPeriodDate(), implementationReportMapper.mapUsImplementations(malariaProgram.getImplementations(), malariaProgram.getStatus()), implementationReportMapper.mapApeImplementations(malariaProgram.getImplementations(), malariaProgram.getStatus())); }  MalariaDataReportViewModel Map(MalariaProgram malariaProgram);  }
@Test public void shouldMapReportedDate() throws Exception { malariaDataReportViewModel = mapper.Map(malariaProgram); assertThat(malariaDataReportViewModel.getReportedDate(), is(malariaProgram.getReportedDate())); }
@Test public void shouldMapStartPeriodDate() throws Exception { malariaDataReportViewModel = mapper.Map(malariaProgram); assertThat(malariaDataReportViewModel.getStartPeriodDate(), is(malariaProgram.getStartPeriodDate())); }
@Test public void shouldMapEndPeriodDate() throws Exception { malariaDataReportViewModel = mapper.Map(malariaProgram); assertThat(malariaDataReportViewModel.getEndPeriodDate(), is(malariaProgram.getEndPeriodDate())); }
@Test public void shouldMapImplementations() throws Exception { malariaDataReportViewModel = mapper.Map(malariaProgram); assertThat(malariaDataReportViewModel.getApeImplementationReportViewModel(), is(apeImplementations)); assertThat(malariaDataReportViewModel.getUsImplementationReportViewModel(), is(usImplementations)); }
@Test public void shouldReturnDefaultViewModelWhenMalariaProgramIsNotDefined() throws Exception { malariaDataReportViewModel = mapper.Map(null); assertThat(malariaDataReportViewModel, is(notNullValue())); assertThat(malariaDataReportViewModel.getUsImplementationReportViewModel().getType(), is(ImplementationReportType.US)); assertThat(malariaDataReportViewModel.getApeImplementationReportViewModel().getType(), is(ImplementationReportType.APE)); }