@Test public void shouldGetRequisitionsIfFacilityIsValid() { Facility facility = new Facility(); facility.setCode(FACILITY_CODE); facility.setId(120L); when(facilityService.getFacilityByCode(FACILITY_CODE)).thenReturn(facility); service.getRequisitionsByFacility(FACILITY_CODE); verify(requisitionService).getRequisitionsByFacility(facility); }
public List<Report> getRequisitionsByFacility(String facilityCode) { Facility facility = facilityService.getFacilityByCode(facilityCode); if (facility == null) { throw new DataException("error.facility.unknown"); } List<Rnr> rnrList = requisitionService.getRequisitionsByFacility(facility); return FluentIterable.from(rnrList).transform(new Function<Rnr, Report>() { @Override public Report apply(Rnr input) { return Report.prepareForREST(input); } }).toList(); }
RestRequisitionService { public List<Report> getRequisitionsByFacility(String facilityCode) { Facility facility = facilityService.getFacilityByCode(facilityCode); if (facility == null) { throw new DataException("error.facility.unknown"); } List<Rnr> rnrList = requisitionService.getRequisitionsByFacility(facility); return FluentIterable.from(rnrList).transform(new Function<Rnr, Report>() { @Override public Report apply(Rnr input) { return Report.prepareForREST(input); } }).toList(); } }
RestRequisitionService { public List<Report> getRequisitionsByFacility(String facilityCode) { Facility facility = facilityService.getFacilityByCode(facilityCode); if (facility == null) { throw new DataException("error.facility.unknown"); } List<Rnr> rnrList = requisitionService.getRequisitionsByFacility(facility); return FluentIterable.from(rnrList).transform(new Function<Rnr, Report>() { @Override public Report apply(Rnr input) { return Report.prepareForREST(input); } }).toList(); }  }
RestRequisitionService { public List<Report> getRequisitionsByFacility(String facilityCode) { Facility facility = facilityService.getFacilityByCode(facilityCode); if (facility == null) { throw new DataException("error.facility.unknown"); } List<Rnr> rnrList = requisitionService.getRequisitionsByFacility(facility); return FluentIterable.from(rnrList).transform(new Function<Rnr, Report>() { @Override public Report apply(Rnr input) { return Report.prepareForREST(input); } }).toList(); }  @Transactional Rnr submitReport(Report report, Long userId); @Transactional Rnr submitSdpReport(Report report, Long userId); @Transactional void approve(Report report, Long requisitionId, Long userId); ReplenishmentDTO getReplenishmentDetails(Long id); List<Report> getRequisitionsByFacility(String facilityCode); }
RestRequisitionService { public List<Report> getRequisitionsByFacility(String facilityCode) { Facility facility = facilityService.getFacilityByCode(facilityCode); if (facility == null) { throw new DataException("error.facility.unknown"); } List<Rnr> rnrList = requisitionService.getRequisitionsByFacility(facility); return FluentIterable.from(rnrList).transform(new Function<Rnr, Report>() { @Override public Report apply(Rnr input) { return Report.prepareForREST(input); } }).toList(); }  @Transactional Rnr submitReport(Report report, Long userId); @Transactional Rnr submitSdpReport(Report report, Long userId); @Transactional void approve(Report report, Long requisitionId, Long userId); ReplenishmentDTO getReplenishmentDetails(Long id); List<Report> getRequisitionsByFacility(String facilityCode); static final boolean EMERGENCY; }