@Test public void shouldSubmit() throws Exception { VaccineReport report = make(a(VaccineReportBuilder.defaultVaccineReport)); doNothing().when(repository).update(report, 2L); service.submit(report, 2L); verify(repository).update(report, 2L); assertThat(report.getStatus(), is(ReportStatus.SUBMITTED)); }
@Transactional public void submit(VaccineReport report, Long userId) { report.setStatus(ReportStatus.SUBMITTED); repository.update(report, userId); ReportStatusChange change = new ReportStatusChange(report, ReportStatus.SUBMITTED, userId); reportStatusChangeRepository.insert(change); }
VaccineReportService { @Transactional public void submit(VaccineReport report, Long userId) { report.setStatus(ReportStatus.SUBMITTED); repository.update(report, userId); ReportStatusChange change = new ReportStatusChange(report, ReportStatus.SUBMITTED, userId); reportStatusChangeRepository.insert(change); } }
VaccineReportService { @Transactional public void submit(VaccineReport report, Long userId) { report.setStatus(ReportStatus.SUBMITTED); repository.update(report, userId); ReportStatusChange change = new ReportStatusChange(report, ReportStatus.SUBMITTED, userId); reportStatusChangeRepository.insert(change); }  }
VaccineReportService { @Transactional public void submit(VaccineReport report, Long userId) { report.setStatus(ReportStatus.SUBMITTED); repository.update(report, userId); ReportStatusChange change = new ReportStatusChange(report, ReportStatus.SUBMITTED, userId); reportStatusChangeRepository.insert(change); }  @Transactional VaccineReport initialize(Long facilityId, Long programId, Long periodId, Long userId); @Transactional void save(VaccineReport report, Long userId); @Transactional void submit(VaccineReport report, Long userId); List<ReportStatusDTO> getReportedPeriodsFor(Long facilityId, Long programId); List<ReportStatusDTO> getPeriodsFor(Long facilityId, Long programId, Date endDate); VaccineReport getById(Long id); Long getReportIdForFacilityAndPeriod(Long facilityId, Long periodId); List<HashMap<String, Object>> vaccineUsageTrend(String facilityCode, String productCode, Long periodId, Long zoneId); Map<String, Object> getMonthlyVaccineReport(Long facilityId, Long periodId, Long zoneId); }
VaccineReportService { @Transactional public void submit(VaccineReport report, Long userId) { report.setStatus(ReportStatus.SUBMITTED); repository.update(report, userId); ReportStatusChange change = new ReportStatusChange(report, ReportStatus.SUBMITTED, userId); reportStatusChangeRepository.insert(change); }  @Transactional VaccineReport initialize(Long facilityId, Long programId, Long periodId, Long userId); @Transactional void save(VaccineReport report, Long userId); @Transactional void submit(VaccineReport report, Long userId); List<ReportStatusDTO> getReportedPeriodsFor(Long facilityId, Long programId); List<ReportStatusDTO> getPeriodsFor(Long facilityId, Long programId, Date endDate); VaccineReport getById(Long id); Long getReportIdForFacilityAndPeriod(Long facilityId, Long periodId); List<HashMap<String, Object>> vaccineUsageTrend(String facilityCode, String productCode, Long periodId, Long zoneId); Map<String, Object> getMonthlyVaccineReport(Long facilityId, Long periodId, Long zoneId); static final String VACCINE_REPORT_VACCINE_CATEGORY_CODE; static final String VACCINE_REPORT_VITAMINS_CATEGORY_CODE; static final String VACCINE_REPORT_SYRINGES_CATEGORY_CODE; }