use of org.eclipse.che.api.user.server.model.impl.UserImpl in project che by eclipse.
the class UserManagerTest method shouldUpdateUser.
@Test
public void shouldUpdateUser() throws Exception {
final User user = new UserImpl("identifier", "test@email.com", "testName", "password", Collections.emptyList());
manager.update(user);
verify(userDao).update(new UserImpl(user));
}
use of org.eclipse.che.api.user.server.model.impl.UserImpl in project che by eclipse.
the class UserManagerTest method shouldGetUserByAlias.
@Test
public void shouldGetUserByAlias() throws Exception {
final User user = new UserImpl("identifier", "test@email.com", "testName", "password", Collections.singletonList("alias"));
when(manager.getByAlias("alias")).thenReturn(user);
assertEquals(manager.getByAlias("alias"), user);
}
use of org.eclipse.che.api.user.server.model.impl.UserImpl 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.user.server.model.impl.UserImpl in project che by eclipse.
the class UserServiceTest method shouldBeAbleToFindUserByEmail.
@Test
public void shouldBeAbleToFindUserByEmail() throws Exception {
final UserImpl testUser = copySubject();
when(userManager.getByEmail(testUser.getEmail())).thenReturn(testUser);
final Response response = given().auth().basic(ADMIN_USER_NAME, ADMIN_USER_PASSWORD).when().get(SECURE_PATH + "/user/find?email=" + testUser.getEmail());
assertEquals(response.getStatusCode(), 200);
final UserDto fetchedUser = unwrapDto(response, UserDto.class);
assertEquals(fetchedUser.getId(), testUser.getId());
assertEquals(fetchedUser.getName(), testUser.getName());
assertEquals(fetchedUser.getEmail(), testUser.getEmail());
}
use of org.eclipse.che.api.user.server.model.impl.UserImpl in project che by eclipse.
the class UserServiceTest method shouldBeAbleToGetUserById.
@Test
public void shouldBeAbleToGetUserById() throws Exception {
final UserImpl testUser = copySubject();
when(userManager.getById(SUBJECT.getUserId())).thenReturn(testUser);
final Response response = given().auth().basic(ADMIN_USER_NAME, ADMIN_USER_PASSWORD).when().get(SECURE_PATH + "/user/" + SUBJECT.getUserId());
assertEquals(response.getStatusCode(), 200);
final UserDto fetchedUser = unwrapDto(response, UserDto.class);
assertEquals(fetchedUser.getId(), testUser.getId());
assertEquals(fetchedUser.getName(), testUser.getName());
assertEquals(fetchedUser.getEmail(), testUser.getEmail());
}
Aggregations