use of org.camunda.bpm.engine.rest.dto.identity.UserDto in project camunda-bpm-platform by camunda.
the class UserRestServiceInteractionTest method testSaveNewUserThrowsAuthorizationException.
@Test
public void testSaveNewUserThrowsAuthorizationException() {
User newUser = MockProvider.createMockUser();
when(identityServiceMock.newUser(MockProvider.EXAMPLE_USER_ID)).thenReturn(newUser);
String message = "exception expected";
doThrow(new AuthorizationException(message)).when(identityServiceMock).saveUser(newUser);
UserDto userDto = UserDto.fromUser(newUser, true);
given().body(userDto).contentType(ContentType.JSON).then().statusCode(Status.FORBIDDEN.getStatusCode()).contentType(ContentType.JSON).body("type", equalTo(AuthorizationException.class.getSimpleName())).body("message", equalTo(message)).when().post(USER_CREATE_URL);
}
Aggregations