@Test
public void rejectNewRoleWithInvalidPrivileges() {

     thrown.expect(BadRequestException.class);
     thrown.expectMessage("Privileges [9, 10] defined to attach in role not exist");
     
     RoleDTO roleDTO = new RoleDTO();
     roleDTO.setName("name");
     
     List<ReferenceIdDTO> privileges = Arrays.asList(new ReferenceIdDTO(10L), new ReferenceIdDTO(9L));
     roleDTO.setPrivileges(privileges);
     
     Mockito.when(privilegeRepository.findOne(Mockito.anyLong())).thenReturn(null);
     
     service.save(roleDTO);
}