@Test public void shouldGetRoleById() throws Exception { Role role = new Role(); Long roleId = 1L; when(roleRightsMapper.getRole(roleId)).thenReturn(role); Role fetchedRole = roleRightsRepository.getRole(roleId); assertThat(fetchedRole, is(role)); verify(roleRightsMapper).getRole(roleId); }
public Role getRole(Long roleId) { return roleRightsMapper.getRole(roleId); }
RoleRightsRepository { public Role getRole(Long roleId) { return roleRightsMapper.getRole(roleId); } }
RoleRightsRepository { public Role getRole(Long roleId) { return roleRightsMapper.getRole(roleId); } @Autowired  RoleRightsRepository(RoleRightsMapper roleRightsMapper, CommaSeparator commaSeparator); }
RoleRightsRepository { public Role getRole(Long roleId) { return roleRightsMapper.getRole(roleId); } @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 Role getRole(Long roleId) { return roleRightsMapper.getRole(roleId); } @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);  }