@Test public void shouldGetRightsForAUserOnSupervisoryNodeAndProgram() throws Exception { Long userId = 1L; List<SupervisoryNode> supervisoryNodes = asList(new SupervisoryNode(2L), new SupervisoryNode(3L)); Program program = new Program(3L); when(commaSeparator.commaSeparateIds(supervisoryNodes)).thenReturn("{2, 3}"); when(roleRightsMapper.getRightsForUserOnSupervisoryNodeAndProgram(userId, "{2, 3}", program)).thenReturn(null); List<Right> result = roleRightsRepository.getRightsForUserOnSupervisoryNodeAndProgram(userId, supervisoryNodes, program); verify(roleRightsMapper).getRightsForUserOnSupervisoryNodeAndProgram(userId, "{2, 3}", program); assertNull(result); }
public List<Right> getRightsForUserOnSupervisoryNodeAndProgram(Long userId, List<SupervisoryNode> supervisoryNodes, Program program) { return roleRightsMapper.getRightsForUserOnSupervisoryNodeAndProgram(userId, commaSeparator.commaSeparateIds(supervisoryNodes), program); }
RoleRightsRepository { public List<Right> getRightsForUserOnSupervisoryNodeAndProgram(Long userId, List<SupervisoryNode> supervisoryNodes, Program program) { return roleRightsMapper.getRightsForUserOnSupervisoryNodeAndProgram(userId, commaSeparator.commaSeparateIds(supervisoryNodes), program); } }
RoleRightsRepository { public List<Right> getRightsForUserOnSupervisoryNodeAndProgram(Long userId, List<SupervisoryNode> supervisoryNodes, Program program) { return roleRightsMapper.getRightsForUserOnSupervisoryNodeAndProgram(userId, commaSeparator.commaSeparateIds(supervisoryNodes), program); } @Autowired  RoleRightsRepository(RoleRightsMapper roleRightsMapper, CommaSeparator commaSeparator); }
RoleRightsRepository { public List<Right> getRightsForUserOnSupervisoryNodeAndProgram(Long userId, List<SupervisoryNode> supervisoryNodes, Program program) { return roleRightsMapper.getRightsForUserOnSupervisoryNodeAndProgram(userId, commaSeparator.commaSeparateIds(supervisoryNodes), program); } @Autowired  RoleRightsRepository(RoleRightsMapper roleRightsMapper, CommaSeparator commaSeparator); void createRole(Role role); void updateRole(Role role); List<Role> getAllRoles(); Role getRole(Long roleId); List<Right> getAllRightsForUser(Long userId); List<Right> getRightsForUserOnSupervisoryNodeAndProgram(Long userId, List<SupervisoryNode> supervisoryNodes, Program program); List<Right> getRightsForUserOnHomeFacilityAndProgram(Long userId, Program program); RightType getRightTypeForRoleId(Long roleId); List<Right> getRightsForUserAndWarehouse(Long userId, Long warehouseId); }
RoleRightsRepository { public List<Right> getRightsForUserOnSupervisoryNodeAndProgram(Long userId, List<SupervisoryNode> supervisoryNodes, Program program) { return roleRightsMapper.getRightsForUserOnSupervisoryNodeAndProgram(userId, commaSeparator.commaSeparateIds(supervisoryNodes), program); } @Autowired  RoleRightsRepository(RoleRightsMapper roleRightsMapper, CommaSeparator commaSeparator); void createRole(Role role); void updateRole(Role role); List<Role> getAllRoles(); Role getRole(Long roleId); List<Right> getAllRightsForUser(Long userId); List<Right> getRightsForUserOnSupervisoryNodeAndProgram(Long userId, List<SupervisoryNode> supervisoryNodes, Program program); List<Right> getRightsForUserOnHomeFacilityAndProgram(Long userId, Program program); RightType getRightTypeForRoleId(Long roleId); List<Right> getRightsForUserAndWarehouse(Long userId, Long warehouseId);  }