use of org.eclipse.che.account.spi.AccountImpl in project che by eclipse.
the class JpaAccountDao method getById.
@Override
@Transactional
public AccountImpl getById(String id) throws NotFoundException, ServerException {
requireNonNull(id, "Required non-null account id");
final EntityManager manager = managerProvider.get();
try {
AccountImpl account = manager.find(AccountImpl.class, id);
if (account == null) {
throw new NotFoundException(format("Account with id '%s' was not found", id));
}
return account;
} catch (RuntimeException x) {
throw new ServerException(x.getLocalizedMessage(), x);
}
}
use of org.eclipse.che.account.spi.AccountImpl in project che by eclipse.
the class AccountDaoTest method shouldThrowConflictExceptionWhenUpdatingAccountWithExistingName.
@Test(expectedExceptions = ConflictException.class)
public void shouldThrowConflictExceptionWhenUpdatingAccountWithExistingName() throws Exception {
AccountImpl account = accounts[0];
account.setName(accounts[1].getName());
accountDao.update(account);
}
Aggregations