@Test public void shouldGetApprovedRequisitionsForCriteriaAndPageNumber() throws Exception { List<Rnr> expected = mock(List.class); String searchType = SEARCH_ALL; String searchVal = "test"; Integer pageNumber = 2; String sortDirection = "asc"; String sortBy = "program"; Integer pageSize = 2; when(requisitionMapper.getApprovedRequisitionsForCriteriaAndPageNumber(searchType, searchVal, pageNumber, pageSize, 1l, CONVERT_TO_ORDER, sortBy, sortDirection)).thenReturn(expected); List<Rnr> rnrList = requisitionRepository.getApprovedRequisitionsForCriteriaAndPageNumber(searchType, searchVal, pageNumber, pageSize, 1l, CONVERT_TO_ORDER, sortBy, sortDirection); assertThat(rnrList, is(expected)); verify(requisitionMapper).getApprovedRequisitionsForCriteriaAndPageNumber(searchType, searchVal, pageNumber, pageSize, 1l, CONVERT_TO_ORDER, sortBy, sortDirection); }
public List<Rnr> getApprovedRequisitionsForCriteriaAndPageNumber(String searchType, String searchVal, Integer pageNumber, Integer pageSize, Long userId, String rightName, String sortBy, String sortDirection) { return requisitionMapper.getApprovedRequisitionsForCriteriaAndPageNumber(searchType, searchVal, pageNumber, pageSize, userId, rightName, sortBy, sortDirection); }
RequisitionRepository { public List<Rnr> getApprovedRequisitionsForCriteriaAndPageNumber(String searchType, String searchVal, Integer pageNumber, Integer pageSize, Long userId, String rightName, String sortBy, String sortDirection) { return requisitionMapper.getApprovedRequisitionsForCriteriaAndPageNumber(searchType, searchVal, pageNumber, pageSize, userId, rightName, sortBy, sortDirection); } }
RequisitionRepository { public List<Rnr> getApprovedRequisitionsForCriteriaAndPageNumber(String searchType, String searchVal, Integer pageNumber, Integer pageSize, Long userId, String rightName, String sortBy, String sortDirection) { return requisitionMapper.getApprovedRequisitionsForCriteriaAndPageNumber(searchType, searchVal, pageNumber, pageSize, userId, rightName, sortBy, sortDirection); }  }
RequisitionRepository { public List<Rnr> getApprovedRequisitionsForCriteriaAndPageNumber(String searchType, String searchVal, Integer pageNumber, Integer pageSize, Long userId, String rightName, String sortBy, String sortDirection) { return requisitionMapper.getApprovedRequisitionsForCriteriaAndPageNumber(searchType, searchVal, pageNumber, pageSize, userId, rightName, sortBy, sortDirection); }  void insert(Rnr requisition); void insertPatientQuantificationLineItems(Rnr rnr); void update(Rnr rnr); void approve(Rnr rnr); Rnr getRequisitionWithLineItems(Facility facility, Program program, ProcessingPeriod period); Rnr getRequisitionWithoutLineItems(Long facilityId, Long programId, Long periodId); Rnr getRegularRequisitionWithLineItems(Facility facility, Program program, ProcessingPeriod period); List<Rnr> getInitiatedOrSubmittedEmergencyRequisitions(Long facilityId, Long programId); List<LossesAndAdjustmentsType> getLossesAndAdjustmentsTypes(); Rnr getById(Long rnrId); @Deprecated List<Rnr> getAuthorizedRequisitions(RoleAssignment roleAssignment); List<RnrDTO> getAuthorizedRequisitionsDTOs(RoleAssignment roleAssignment); Rnr getLastRegularRequisitionToEnterThePostSubmitFlow(Long facilityId, Long programId); List<Rnr> getPostSubmitRequisitions(Facility facility, Program program, List<ProcessingPeriod> periods); Integer getCategoryCount(Rnr requisition, boolean fullSupply); List<Comment> getCommentsByRnrID(Long rnrId); void insertComment(Comment comment); void logStatusChange(Rnr requisition, String name); Date getOperationDateFor(Long rnrId, String status); Rnr getLWById(Long rnrId); List<Rnr> getApprovedRequisitionsForCriteriaAndPageNumber(String searchType, String searchVal, Integer pageNumber,
                                                                   Integer pageSize, Long userId, String rightName, String sortBy,
                                                                   String sortDirection); Integer getCountOfApprovedRequisitionsForCriteria(String searchType, String searchVal, Long userId, String rightName); Long getFacilityId(Long id); Rnr getLastRegularRequisition(Facility facility, Program program); Date getAuthorizedDateForPreviousLineItem(Rnr rnr, String productCode, Date periodStartDate); List<RnrLineItem> getAuthorizedRegularUnSkippedLineItems(String productCode, Rnr rnr, Integer n, Date startDate); RnrLineItem getNonSkippedLineItem(Long rnrId, String productCode); Long getProgramId(Long rnrId); String deleteRnR(Long rnrId); void updateClientFields(Rnr rnr); List<Rnr> getRequisitionDetailsByFacility(Facility facility); void insertRnrSignatures(Rnr rnr); }
RequisitionRepository { public List<Rnr> getApprovedRequisitionsForCriteriaAndPageNumber(String searchType, String searchVal, Integer pageNumber, Integer pageSize, Long userId, String rightName, String sortBy, String sortDirection) { return requisitionMapper.getApprovedRequisitionsForCriteriaAndPageNumber(searchType, searchVal, pageNumber, pageSize, userId, rightName, sortBy, sortDirection); }  void insert(Rnr requisition); void insertPatientQuantificationLineItems(Rnr rnr); void update(Rnr rnr); void approve(Rnr rnr); Rnr getRequisitionWithLineItems(Facility facility, Program program, ProcessingPeriod period); Rnr getRequisitionWithoutLineItems(Long facilityId, Long programId, Long periodId); Rnr getRegularRequisitionWithLineItems(Facility facility, Program program, ProcessingPeriod period); List<Rnr> getInitiatedOrSubmittedEmergencyRequisitions(Long facilityId, Long programId); List<LossesAndAdjustmentsType> getLossesAndAdjustmentsTypes(); Rnr getById(Long rnrId); @Deprecated List<Rnr> getAuthorizedRequisitions(RoleAssignment roleAssignment); List<RnrDTO> getAuthorizedRequisitionsDTOs(RoleAssignment roleAssignment); Rnr getLastRegularRequisitionToEnterThePostSubmitFlow(Long facilityId, Long programId); List<Rnr> getPostSubmitRequisitions(Facility facility, Program program, List<ProcessingPeriod> periods); Integer getCategoryCount(Rnr requisition, boolean fullSupply); List<Comment> getCommentsByRnrID(Long rnrId); void insertComment(Comment comment); void logStatusChange(Rnr requisition, String name); Date getOperationDateFor(Long rnrId, String status); Rnr getLWById(Long rnrId); List<Rnr> getApprovedRequisitionsForCriteriaAndPageNumber(String searchType, String searchVal, Integer pageNumber,
                                                                   Integer pageSize, Long userId, String rightName, String sortBy,
                                                                   String sortDirection); Integer getCountOfApprovedRequisitionsForCriteria(String searchType, String searchVal, Long userId, String rightName); Long getFacilityId(Long id); Rnr getLastRegularRequisition(Facility facility, Program program); Date getAuthorizedDateForPreviousLineItem(Rnr rnr, String productCode, Date periodStartDate); List<RnrLineItem> getAuthorizedRegularUnSkippedLineItems(String productCode, Rnr rnr, Integer n, Date startDate); RnrLineItem getNonSkippedLineItem(Long rnrId, String productCode); Long getProgramId(Long rnrId); String deleteRnR(Long rnrId); void updateClientFields(Rnr rnr); List<Rnr> getRequisitionDetailsByFacility(Facility facility); void insertRnrSignatures(Rnr rnr);  }