private AdmissionLocation getWard( List<AdmissionLocation> admissionLocationList, String wardName) { for (AdmissionLocation admissionLocation : admissionLocationList) { if (admissionLocation.getWard().getName().equals(wardName)) return admissionLocation; } return null; }
@Test public void getBedsForWard_gets_all_bed_layouts_for_ward() { LocationService locationService = Context.getLocationService(); Location ward = locationService.getLocationByUuid("19e023e8-20ee-4237-ade6-9e68f897b7a9"); AdmissionLocation admissionLocation = bedManagementService.getLayoutForWard(ward); assertEquals(6, admissionLocation.getBedLayouts().size()); assertEquals( "Physical Location for Orthopaedic ward", admissionLocation.getBedLayouts().get(0).getLocation()); }
@Test public void getAllLocationsBy_gets_locations_for_a_tag() { List<AdmissionLocation> admissionLocationList = bedManagementService.getAllAdmissionLocations(); assertThat(admissionLocationList.size(), is(2)); AdmissionLocation cardioWard = getWard(admissionLocationList, "Cardio ward on first floor"); Assert.assertEquals(10, cardioWard.getTotalBeds()); Assert.assertEquals(1, cardioWard.getOccupiedBeds()); AdmissionLocation orthoWard = getWard(admissionLocationList, "Orthopaedic ward"); Assert.assertEquals(4, orthoWard.getTotalBeds()); Assert.assertEquals(2, orthoWard.getOccupiedBeds()); }