@Test public void shouldNotBeSearchableIfThereIsNoPermission() throws Exception { when(requisitionPermissionService.hasPermission(userId, facility, program, VIEW_REQUISITION)).thenReturn(false); boolean permissible = facilityProgramDateRangeSearch.isSearchable(VIEW_REQUISITION); assertThat(permissible, is(false)); verify(requisitionPermissionService).hasPermission(userId, facility, program, VIEW_REQUISITION); }
@Override boolean isSearchable(String rightName) { Facility facility = new Facility(criteria.getFacilityId()); Program program = new Program(criteria.getProgramId()); return requisitionPermissionService.hasPermission(criteria.getUserId(), facility, program, rightName); }
FacilityProgramDateRangeSearch extends RequisitionSearchStrategy { @Override boolean isSearchable(String rightName) { Facility facility = new Facility(criteria.getFacilityId()); Program program = new Program(criteria.getProgramId()); return requisitionPermissionService.hasPermission(criteria.getUserId(), facility, program, rightName); } }
FacilityProgramDateRangeSearch extends RequisitionSearchStrategy { @Override boolean isSearchable(String rightName) { Facility facility = new Facility(criteria.getFacilityId()); Program program = new Program(criteria.getProgramId()); return requisitionPermissionService.hasPermission(criteria.getUserId(), facility, program, rightName); } FacilityProgramDateRangeSearch(RequisitionSearchCriteria criteria,
                                        RequisitionPermissionService requisitionPermissionService,
                                        ProcessingScheduleService processingScheduleService,
                                        RequisitionRepository requisitionRepository); }
FacilityProgramDateRangeSearch extends RequisitionSearchStrategy { @Override boolean isSearchable(String rightName) { Facility facility = new Facility(criteria.getFacilityId()); Program program = new Program(criteria.getProgramId()); return requisitionPermissionService.hasPermission(criteria.getUserId(), facility, program, rightName); } FacilityProgramDateRangeSearch(RequisitionSearchCriteria criteria,
                                        RequisitionPermissionService requisitionPermissionService,
                                        ProcessingScheduleService processingScheduleService,
                                        RequisitionRepository requisitionRepository);  }
FacilityProgramDateRangeSearch extends RequisitionSearchStrategy { @Override boolean isSearchable(String rightName) { Facility facility = new Facility(criteria.getFacilityId()); Program program = new Program(criteria.getProgramId()); return requisitionPermissionService.hasPermission(criteria.getUserId(), facility, program, rightName); } FacilityProgramDateRangeSearch(RequisitionSearchCriteria criteria,
                                        RequisitionPermissionService requisitionPermissionService,
                                        ProcessingScheduleService processingScheduleService,
                                        RequisitionRepository requisitionRepository);   }