Пример #1
0
 @Test
 public void shouldNotSaveRoleWithoutAnyRights() throws Exception {
   Role role = mock(Role.class);
   doThrow(new DataException("error-message")).when(role).validate();
   expectedEx.expect(DataException.class);
   expectedEx.expectMessage("error-message");
   roleRightsService.saveRole(role);
   verify(roleRightsRepository, never()).createRole(role);
 }
Пример #2
0
 @Test
 public void shouldSaveRole() throws Exception {
   role.setRights(new HashSet<>(asList(CREATE_REQUISITION, VIEW_REQUISITION)));
   roleRightsService.saveRole(role);
   verify(roleRightsRepository).createRole(role);
 }