@Test public void shouldGetTotalSearchResultCountByGeographicZone(){ String columnName = "geographicZone"; String searchParam = "searchParam"; int count = 10; when(facilityRepository.getTotalSearchResultCountByGeographicZone(searchParam)).thenReturn(count); assertThat(facilityService.getTotalSearchResultCountByColumnName(searchParam, columnName), is(count)); verify(facilityRepository).getTotalSearchResultCountByGeographicZone(searchParam); }
public Integer getTotalSearchResultCountByColumnName(String searchParam, String columnName) { if (columnName.equalsIgnoreCase("Facility")) { return facilityRepository.getTotalSearchResultCount(searchParam); } return facilityRepository.getTotalSearchResultCountByGeographicZone(searchParam); }
FacilityService { public Integer getTotalSearchResultCountByColumnName(String searchParam, String columnName) { if (columnName.equalsIgnoreCase("Facility")) { return facilityRepository.getTotalSearchResultCount(searchParam); } return facilityRepository.getTotalSearchResultCountByGeographicZone(searchParam); } }
FacilityService { public Integer getTotalSearchResultCountByColumnName(String searchParam, String columnName) { if (columnName.equalsIgnoreCase("Facility")) { return facilityRepository.getTotalSearchResultCount(searchParam); } return facilityRepository.getTotalSearchResultCountByGeographicZone(searchParam); }  }
FacilityService { public Integer getTotalSearchResultCountByColumnName(String searchParam, String columnName) { if (columnName.equalsIgnoreCase("Facility")) { return facilityRepository.getTotalSearchResultCount(searchParam); } return facilityRepository.getTotalSearchResultCountByGeographicZone(searchParam); }  @Transactional void update(Facility facility); List<FacilityType> getAllTypes(); List<GeographicZone> getAllZones(); Facility getHomeFacility(Long userId); Facility getById(Long id); @Transactional void updateEnabledAndActiveFor(Facility facility); List<Facility> getUserSupervisedFacilities(Long userId, Long programId, String... rightNames); void save(Facility newFacility); void updateAndNotifyForVirtualFacilities(Facility parentFacility); List<Facility> getForUserAndRights(Long userId, String... rightNames); FacilityType getFacilityTypeByCode(FacilityType facilityType); Facility getByCode(Facility facility); List<Facility> getAllForDeliveryZoneAndProgram(Long deliveryZoneId, Long programId); List<Facility> getAllByProgramSupportedModifiedDate(Date dateModified); Facility getFacilityWithReferenceDataForCode(String facilityCode); List<Facility> searchBy(String searchParam, String columnName, Pagination pagination); List<Facility> getEnabledWarehouses(); Facility getFacilityByCode(String facilityCode); List<Facility> getChildFacilities(Facility facility); List<Facility> getAllByRequisitionGroupMemberModifiedDate(Date modifiedDate); List<Facility> getAllParentsByModifiedDate(Date modifiedDate); Facility getOperativeFacilityByCode(String facilityCode); List<Facility> getCompleteListInRequisitionGroups(List<RequisitionGroup> requisitionGroups); List<FacilityContact> getContactList(Long facilityId, String notificationMedium); List<FacilitySupervisor> getFacilitySupervisors(Long facilityId); List<Facility> getUserSupervisedFacilities(Long userId); List<Facility> getAllForGeographicZone(Long geographizZoneId); Integer getFacilitiesCountBy(String searchParam, Long facilityTypeId, Long geoZoneId, Boolean virtualFacility, Boolean enabled); List<Facility> searchFacilitiesBy(String searchParam, Long facilityTypeId, Long geoZoneId, Boolean virtualFacility, Boolean enabled); Integer getTotalSearchResultCountByColumnName(String searchParam, String columnName); List<Facility> getFacilityByTypeAndRequisitionGroupId(Long facilityTypeId, Long rgroupId); List<FacilityGeoTreeDto> getGeoRegionFacilityTree(Long userId); List<FacilityGeoTreeDto> getGeoDistrictFacility(Long userId); List<FacilityGeoTreeDto> getGeoFlatFacilityTree(Long userId); Facility getFacilityById(Long id); }
FacilityService { public Integer getTotalSearchResultCountByColumnName(String searchParam, String columnName) { if (columnName.equalsIgnoreCase("Facility")) { return facilityRepository.getTotalSearchResultCount(searchParam); } return facilityRepository.getTotalSearchResultCountByGeographicZone(searchParam); }  @Transactional void update(Facility facility); List<FacilityType> getAllTypes(); List<GeographicZone> getAllZones(); Facility getHomeFacility(Long userId); Facility getById(Long id); @Transactional void updateEnabledAndActiveFor(Facility facility); List<Facility> getUserSupervisedFacilities(Long userId, Long programId, String... rightNames); void save(Facility newFacility); void updateAndNotifyForVirtualFacilities(Facility parentFacility); List<Facility> getForUserAndRights(Long userId, String... rightNames); FacilityType getFacilityTypeByCode(FacilityType facilityType); Facility getByCode(Facility facility); List<Facility> getAllForDeliveryZoneAndProgram(Long deliveryZoneId, Long programId); List<Facility> getAllByProgramSupportedModifiedDate(Date dateModified); Facility getFacilityWithReferenceDataForCode(String facilityCode); List<Facility> searchBy(String searchParam, String columnName, Pagination pagination); List<Facility> getEnabledWarehouses(); Facility getFacilityByCode(String facilityCode); List<Facility> getChildFacilities(Facility facility); List<Facility> getAllByRequisitionGroupMemberModifiedDate(Date modifiedDate); List<Facility> getAllParentsByModifiedDate(Date modifiedDate); Facility getOperativeFacilityByCode(String facilityCode); List<Facility> getCompleteListInRequisitionGroups(List<RequisitionGroup> requisitionGroups); List<FacilityContact> getContactList(Long facilityId, String notificationMedium); List<FacilitySupervisor> getFacilitySupervisors(Long facilityId); List<Facility> getUserSupervisedFacilities(Long userId); List<Facility> getAllForGeographicZone(Long geographizZoneId); Integer getFacilitiesCountBy(String searchParam, Long facilityTypeId, Long geoZoneId, Boolean virtualFacility, Boolean enabled); List<Facility> searchFacilitiesBy(String searchParam, Long facilityTypeId, Long geoZoneId, Boolean virtualFacility, Boolean enabled); Integer getTotalSearchResultCountByColumnName(String searchParam, String columnName); List<Facility> getFacilityByTypeAndRequisitionGroupId(Long facilityTypeId, Long rgroupId); List<FacilityGeoTreeDto> getGeoRegionFacilityTree(Long userId); List<FacilityGeoTreeDto> getGeoDistrictFacility(Long userId); List<FacilityGeoTreeDto> getGeoFlatFacilityTree(Long userId); Facility getFacilityById(Long id); static final String FACILITY_CATEGORY; static final String FACILITY_TITLE; static final String ERROR_FACILITY_CODE_INVALID; static final String SMS; static final String EMAIL; }