use of org.eclipse.che.api.user.server.model.impl.UserImpl in project che by eclipse.
the class UserDaoTest method shouldThrowConflictExceptionWhenCreatingUserWithExistingEmail.
@Test(expectedExceptions = ConflictException.class)
public void shouldThrowConflictExceptionWhenCreatingUserWithExistingEmail() throws Exception {
final UserImpl newUser = new UserImpl("user123", users[0].getEmail(), "user_name", "password", asList("google:user123", "github:user123"));
userDao.create(newUser);
}
use of org.eclipse.che.api.user.server.model.impl.UserImpl in project che by eclipse.
the class UserDaoTest method shouldThrowConflictExceptionWhenCreatingUserWithExistingName.
@Test(expectedExceptions = ConflictException.class)
public void shouldThrowConflictExceptionWhenCreatingUserWithExistingName() throws Exception {
final UserImpl newUser = new UserImpl("user123", "user123@eclipse.org", users[0].getName(), "password", asList("google:user123", "github:user123"));
userDao.create(newUser);
}
use of org.eclipse.che.api.user.server.model.impl.UserImpl in project che by eclipse.
the class UserDaoTest method shouldReturnUserWithNullPasswordWhenGetUserByAliasAndPassword.
@Test(dependsOnMethods = { "shouldGetUserByNameAndPassword", "shouldGetUserByEmailAndPassword" })
public void shouldReturnUserWithNullPasswordWhenGetUserByAliasAndPassword() throws Exception {
final UserImpl user = users[0];
assertEquals(userDao.getByAliasAndPassword(user.getName(), user.getPassword()).getPassword(), null);
assertEquals(userDao.getByAliasAndPassword(user.getEmail(), user.getPassword()).getPassword(), null);
}
use of org.eclipse.che.api.user.server.model.impl.UserImpl in project che by eclipse.
the class UserDaoTest method shouldThrowConflictExceptionWhenUpdatingUserWithReservedAlias.
@Test(expectedExceptions = ConflictException.class)
public void shouldThrowConflictExceptionWhenUpdatingUserWithReservedAlias() throws Exception {
final UserImpl user = users[0];
user.setAliases(users[1].getAliases());
userDao.update(user);
}
use of org.eclipse.che.api.user.server.model.impl.UserImpl in project che by eclipse.
the class UserDaoTest method shouldNotRemoveUserWhenSubscriberThrowsExceptionOnUserRemoving.
@Test(dependsOnMethods = "shouldGetUserById")
public void shouldNotRemoveUserWhenSubscriberThrowsExceptionOnUserRemoving() throws Exception {
final UserImpl user = users[0];
CascadeEventSubscriber<BeforeUserRemovedEvent> subscriber = mockCascadeEventSubscriber();
doThrow(new ServerException("error")).when(subscriber).onCascadeEvent(any());
eventService.subscribe(subscriber, BeforeUserRemovedEvent.class);
try {
userDao.remove(user.getId());
fail("UserDao#remove had to throw server exception");
} catch (ServerException ignored) {
}
assertEqualsNoPassword(userDao.getById(user.getId()), user);
eventService.unsubscribe(subscriber, BeforeUserRemovedEvent.class);
}
Aggregations