@Test public void shouldGetResultCountSearchByNodeName() throws Exception { String searchParam = "searchParam"; int resultCount = 4; when(requisitionGroupRepository.getTotalRecordsForSearchOnNodeName(searchParam)).thenReturn(resultCount); Integer count = requisitionGroupService.getTotalRecords(searchParam, "supervisoryNode"); verify(requisitionGroupRepository).getTotalRecordsForSearchOnNodeName(searchParam); assertThat(count, is(resultCount)); }
public Integer getTotalRecords(String searchParam, String columnName) { if (columnName.equals(REQUISITION_GROUP)) { return requisitionGroupRepository.getTotalRecordsForSearchOnGroupName(searchParam); } return requisitionGroupRepository.getTotalRecordsForSearchOnNodeName(searchParam); }
RequisitionGroupService { public Integer getTotalRecords(String searchParam, String columnName) { if (columnName.equals(REQUISITION_GROUP)) { return requisitionGroupRepository.getTotalRecordsForSearchOnGroupName(searchParam); } return requisitionGroupRepository.getTotalRecordsForSearchOnNodeName(searchParam); } }
RequisitionGroupService { public Integer getTotalRecords(String searchParam, String columnName) { if (columnName.equals(REQUISITION_GROUP)) { return requisitionGroupRepository.getTotalRecordsForSearchOnGroupName(searchParam); } return requisitionGroupRepository.getTotalRecordsForSearchOnNodeName(searchParam); }  }
RequisitionGroupService { public Integer getTotalRecords(String searchParam, String columnName) { if (columnName.equals(REQUISITION_GROUP)) { return requisitionGroupRepository.getTotalRecordsForSearchOnGroupName(searchParam); } return requisitionGroupRepository.getTotalRecordsForSearchOnNodeName(searchParam); }  @Transactional void saveWithMembersAndSchedules(RequisitionGroup requisitionGroup,
                                          List<RequisitionGroupMember> requisitionGroupMembers,
                                          List<RequisitionGroupProgramSchedule> requisitionGroupProgramSchedules,
                                          Long userId); void save(RequisitionGroup requisitionGroup); void saveRequisitionGroupMembers(List<RequisitionGroupMember> requisitionGroupMembers,
                                          RequisitionGroup requisitionGroup,
                                          Long userId); List<RequisitionGroup> getRequisitionGroupsBy(List<SupervisoryNode> supervisoryNodes); RequisitionGroup getByCode(RequisitionGroup requisitionGroup); List<RequisitionGroup> search(String searchParam, String columnName, Pagination pagination); Integer getTotalRecords(String searchParam, String columnName); RequisitionGroup getBy(Long id); List<RequisitionGroupMember> getMembersBy(Long requisitionGroupId); void updateWithMembersAndSchedules(RequisitionGroup requisitionGroup,
                                            List<RequisitionGroupMember> requisitionGroupMembers,
                                            List<RequisitionGroupProgramSchedule> requisitionGroupProgramSchedules,
                                            Long userId); void saveRequisitionGroupProgramSchedules(List<RequisitionGroupProgramSchedule> requisitionGroupProgramSchedules,
                                                   RequisitionGroup requisitionGroup,
                                                   Long userId); }
RequisitionGroupService { public Integer getTotalRecords(String searchParam, String columnName) { if (columnName.equals(REQUISITION_GROUP)) { return requisitionGroupRepository.getTotalRecordsForSearchOnGroupName(searchParam); } return requisitionGroupRepository.getTotalRecordsForSearchOnNodeName(searchParam); }  @Transactional void saveWithMembersAndSchedules(RequisitionGroup requisitionGroup,
                                          List<RequisitionGroupMember> requisitionGroupMembers,
                                          List<RequisitionGroupProgramSchedule> requisitionGroupProgramSchedules,
                                          Long userId); void save(RequisitionGroup requisitionGroup); void saveRequisitionGroupMembers(List<RequisitionGroupMember> requisitionGroupMembers,
                                          RequisitionGroup requisitionGroup,
                                          Long userId); List<RequisitionGroup> getRequisitionGroupsBy(List<SupervisoryNode> supervisoryNodes); RequisitionGroup getByCode(RequisitionGroup requisitionGroup); List<RequisitionGroup> search(String searchParam, String columnName, Pagination pagination); Integer getTotalRecords(String searchParam, String columnName); RequisitionGroup getBy(Long id); List<RequisitionGroupMember> getMembersBy(Long requisitionGroupId); void updateWithMembersAndSchedules(RequisitionGroup requisitionGroup,
                                            List<RequisitionGroupMember> requisitionGroupMembers,
                                            List<RequisitionGroupProgramSchedule> requisitionGroupProgramSchedules,
                                            Long userId); void saveRequisitionGroupProgramSchedules(List<RequisitionGroupProgramSchedule> requisitionGroupProgramSchedules,
                                                   RequisitionGroup requisitionGroup,
                                                   Long userId); static final String REQUISITION_GROUP; }