@Test public void shouldGetRightsForUserAndWarehouse() { List<Right> expectedRights = new ArrayList<>(); Long userId = 1l; Long warehouseId = 2l; when(roleRightsMapper.getRightsForUserAndWarehouse(userId, warehouseId)).thenReturn(expectedRights); List<Right> rights = roleRightsRepository.getRightsForUserAndWarehouse(userId, warehouseId); assertThat(rights, is(expectedRights)); verify(roleRightsMapper).getRightsForUserAndWarehouse(userId, warehouseId); }
public List<Right> getRightsForUserAndWarehouse(Long userId, Long warehouseId) { return roleRightsMapper.getRightsForUserAndWarehouse(userId, warehouseId); }
RoleRightsRepository { public List<Right> getRightsForUserAndWarehouse(Long userId, Long warehouseId) { return roleRightsMapper.getRightsForUserAndWarehouse(userId, warehouseId); } }
RoleRightsRepository { public List<Right> getRightsForUserAndWarehouse(Long userId, Long warehouseId) { return roleRightsMapper.getRightsForUserAndWarehouse(userId, warehouseId); } @Autowired  RoleRightsRepository(RoleRightsMapper roleRightsMapper, CommaSeparator commaSeparator); }
RoleRightsRepository { public List<Right> getRightsForUserAndWarehouse(Long userId, Long warehouseId) { return roleRightsMapper.getRightsForUserAndWarehouse(userId, warehouseId); } @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> getRightsForUserAndWarehouse(Long userId, Long warehouseId) { return roleRightsMapper.getRightsForUserAndWarehouse(userId, warehouseId); } @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);  }