@Test public void shouldGetRnrById() throws Exception { Rnr expectedRnr = new Rnr(); Long rnrId = 1L; when(requisitionMapper.getById(rnrId)).thenReturn(expectedRnr); Rnr returnedRnr = requisitionRepository.getById(rnrId); assertThat(returnedRnr, is(expectedRnr)); }
public Rnr getById(Long rnrId) { Rnr requisition = requisitionMapper.getById(rnrId); if (requisition == null) throw new DataException("error.rnr.not.found"); return requisition; }
RequisitionRepository { public Rnr getById(Long rnrId) { Rnr requisition = requisitionMapper.getById(rnrId); if (requisition == null) throw new DataException("error.rnr.not.found"); return requisition; } }
RequisitionRepository { public Rnr getById(Long rnrId) { Rnr requisition = requisitionMapper.getById(rnrId); if (requisition == null) throw new DataException("error.rnr.not.found"); return requisition; }  }
RequisitionRepository { public Rnr getById(Long rnrId) { Rnr requisition = requisitionMapper.getById(rnrId); if (requisition == null) throw new DataException("error.rnr.not.found"); return requisition; }  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 Rnr getById(Long rnrId) { Rnr requisition = requisitionMapper.getById(rnrId); if (requisition == null) throw new DataException("error.rnr.not.found"); return requisition; }  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);  }