use of org.camunda.bpm.engine.rest.dto.identity.UserProfileDto in project camunda-bpm-platform by camunda.
the class UserRestServiceInteractionTest method testPutProfile.
@Test
public void testPutProfile() {
User initialUser = MockProvider.createMockUser();
User userUpdate = MockProvider.createMockUserUpdate();
UserQuery sampleUserQuery = mock(UserQuery.class);
when(identityServiceMock.createUserQuery()).thenReturn(sampleUserQuery);
when(sampleUserQuery.userId(MockProvider.EXAMPLE_USER_ID)).thenReturn(sampleUserQuery);
when(sampleUserQuery.singleResult()).thenReturn(initialUser);
UserProfileDto updateDto = UserProfileDto.fromUser(userUpdate);
given().pathParam("id", MockProvider.EXAMPLE_USER_ID).body(updateDto).contentType(ContentType.JSON).then().statusCode(Status.NO_CONTENT.getStatusCode()).when().put(USER_PROFILE_URL);
// password was updated
verify(initialUser).setEmail(updateDto.getEmail());
verify(initialUser).setFirstName(updateDto.getFirstName());
verify(initialUser).setLastName(updateDto.getLastName());
// and then saved
verify(identityServiceMock).saveUser(initialUser);
}
Aggregations