use of org.eclipse.che.api.core.model.user.User in project che by eclipse.
the class UserManagerTest method shouldGenerateIdentifierWhenCreatingUserWithNullId.
@Test
public void shouldGenerateIdentifierWhenCreatingUserWithNullId() throws Exception {
final User user = new UserImpl(null, "test@email.com", "testName", null, null);
manager.create(user, false);
final ArgumentCaptor<UserImpl> userCaptor = ArgumentCaptor.forClass(UserImpl.class);
verify(userDao).create(userCaptor.capture());
final String id = userCaptor.getValue().getId();
assertNotNull(id);
}
use of org.eclipse.che.api.core.model.user.User in project che by eclipse.
the class UserServiceTest method shouldCreateUserFromEntity.
@Test
public void shouldCreateUserFromEntity() throws Exception {
final UserDto newUser = newDto(UserDto.class).withName("test").withEmail("test@codenvy.com").withPassword("password12345");
final Response response = given().auth().basic(ADMIN_USER_NAME, ADMIN_USER_PASSWORD).when().body(newUser).contentType("application/json").post(SECURE_PATH + "/user");
assertEquals(response.statusCode(), 201);
verify(userManager).create(userCaptor.capture(), anyBoolean());
final User user = userCaptor.getValue();
assertEquals(user.getEmail(), "test@codenvy.com");
assertEquals(user.getName(), "test");
assertEquals(user.getPassword(), "password12345");
}
Aggregations