@Test public void shouldGetSupervisoryNodeForProgramAndFacility() throws Exception { SupervisoryNode expectedNode = new SupervisoryNode(); Facility facility = new Facility(1L); Program program = new Program(1L); when(supervisoryNodeRepository.getFor(facility, program)).thenReturn(expectedNode); final SupervisoryNode result = supervisoryNodeService.getFor(facility, program); verify(supervisoryNodeRepository).getFor(facility, program); assertThat(result, is(expectedNode)); }
public SupervisoryNode getFor(Facility facility, Program program) { return supervisoryNodeRepository.getFor(facility, program); }
SupervisoryNodeService { public SupervisoryNode getFor(Facility facility, Program program) { return supervisoryNodeRepository.getFor(facility, program); } }
SupervisoryNodeService { public SupervisoryNode getFor(Facility facility, Program program) { return supervisoryNodeRepository.getFor(facility, program); }  }
SupervisoryNodeService { public SupervisoryNode getFor(Facility facility, Program program) { return supervisoryNodeRepository.getFor(facility, program); }  @Autowired void setPageSize(@Value("${search.page.size}") String pageSize); void save(SupervisoryNode supervisoryNode); List<SupervisoryNode> getSupervisoryNodesBy(Integer page, String nameSearchCriteria, Boolean parent); List<SupervisoryNode> getAllSupervisoryNodesInHierarchyBy(Long userId, Long programId, String... rightNames); List<SupervisoryNode> getAllSupervisoryNodesInHierarchyBy(Long userId, String... rightNames); SupervisoryNode getFor(Facility facility, Program program); User getApproverFor(Facility facility, Program program); SupervisoryNode getParent(Long id); User getApproverForGivenSupervisoryNodeAndProgram(SupervisoryNode supervisoryNode, Program program); List<SupervisoryNode> getAll(); List<SupervisoryNode> getAllParentSupervisoryNodesInHierarchy(SupervisoryNode supervisoryNode); SupervisoryNode getByCode(SupervisoryNode supervisoryNode); Pagination getPagination(Integer page); Integer getTotalSearchResultCount(String param, Boolean parent); SupervisoryNode getSupervisoryNode(Long id); List<SupervisoryNode> getFilteredSupervisoryNodesByName(String param); List<SupervisoryNode> searchTopLevelSupervisoryNodesByName(String param); Long getTotalUnassignedSupervisoryNodeOfUserBy(Long userId, Long programId); }
SupervisoryNodeService { public SupervisoryNode getFor(Facility facility, Program program) { return supervisoryNodeRepository.getFor(facility, program); }  @Autowired void setPageSize(@Value("${search.page.size}") String pageSize); void save(SupervisoryNode supervisoryNode); List<SupervisoryNode> getSupervisoryNodesBy(Integer page, String nameSearchCriteria, Boolean parent); List<SupervisoryNode> getAllSupervisoryNodesInHierarchyBy(Long userId, Long programId, String... rightNames); List<SupervisoryNode> getAllSupervisoryNodesInHierarchyBy(Long userId, String... rightNames); SupervisoryNode getFor(Facility facility, Program program); User getApproverFor(Facility facility, Program program); SupervisoryNode getParent(Long id); User getApproverForGivenSupervisoryNodeAndProgram(SupervisoryNode supervisoryNode, Program program); List<SupervisoryNode> getAll(); List<SupervisoryNode> getAllParentSupervisoryNodesInHierarchy(SupervisoryNode supervisoryNode); SupervisoryNode getByCode(SupervisoryNode supervisoryNode); Pagination getPagination(Integer page); Integer getTotalSearchResultCount(String param, Boolean parent); SupervisoryNode getSupervisoryNode(Long id); List<SupervisoryNode> getFilteredSupervisoryNodesByName(String param); List<SupervisoryNode> searchTopLevelSupervisoryNodesByName(String param); Long getTotalUnassignedSupervisoryNodeOfUserBy(Long userId, Long programId);  }