use of org.codenergic.theskeleton.role.RoleEntity in project theskeleton by codenergic.
the class PrivilegeServiceTest method testFindPrivilegesByRoleCode.
@Test
public void testFindPrivilegesByRoleCode() {
Set<RolePrivilegeEntity> dbResult = new HashSet<>(Arrays.asList(new RolePrivilegeEntity().setPrivilege(new PrivilegeEntity().setName("privilege")).setRole(new RoleEntity())));
when(rolePrivilegeRepository.findByRoleCode("role")).thenReturn(dbResult);
Set<PrivilegeEntity> result = privilegeService.findPrivilegesByRoleCode("role");
assertThat(result.size()).isEqualTo(1);
assertThat(result.iterator().next()).isEqualTo(dbResult.iterator().next().getPrivilege());
verify(rolePrivilegeRepository).findByRoleCode("role");
}
Aggregations