use of com.sanction.thunder.dao.DatabaseException in project thunder by RohanNagar.
the class UserResourceTest method testUpdateUserLookupNotFound.
@Test
public void testUpdateUserLookupNotFound() {
when(usersDao.findByEmail(email.getAddress())).thenThrow(new DatabaseException(DatabaseError.USER_NOT_FOUND));
Response response = resource.updateUser(key, "password", null, user);
assertEquals(Response.Status.NOT_FOUND, response.getStatusInfo());
}
use of com.sanction.thunder.dao.DatabaseException in project thunder by RohanNagar.
the class UserResourceTest method testUpdateUserConflict.
@Test
public void testUpdateUserConflict() {
when(usersDao.findByEmail(email.getAddress())).thenReturn(user);
when(usersDao.update(null, updatedUser)).thenThrow(new DatabaseException(DatabaseError.CONFLICT));
Response response = resource.updateUser(key, "password", null, updatedUser);
assertEquals(Response.Status.CONFLICT, response.getStatusInfo());
}
use of com.sanction.thunder.dao.DatabaseException in project thunder by RohanNagar.
the class UserResourceTest method testDeleteUserDatabaseDown.
@Test
public void testDeleteUserDatabaseDown() {
when(usersDao.findByEmail(email.getAddress())).thenReturn(user);
when(usersDao.delete(email.getAddress())).thenThrow(new DatabaseException(DatabaseError.DATABASE_DOWN));
Response response = resource.deleteUser(key, "password", email.getAddress());
assertEquals(Response.Status.SERVICE_UNAVAILABLE, response.getStatusInfo());
}
use of com.sanction.thunder.dao.DatabaseException in project thunder by RohanNagar.
the class UserResourceTest method testGetUserDatabaseDown.
@Test
public void testGetUserDatabaseDown() {
when(usersDao.findByEmail(email.getAddress())).thenThrow(new DatabaseException(DatabaseError.DATABASE_DOWN));
Response response = resource.getUser(key, "password", email.getAddress());
assertEquals(Response.Status.SERVICE_UNAVAILABLE, response.getStatusInfo());
}
use of com.sanction.thunder.dao.DatabaseException in project thunder by RohanNagar.
the class UserResourceTest method testUpdateUserLookupUnsupportedData.
@Test
public void testUpdateUserLookupUnsupportedData() {
when(usersDao.findByEmail(email.getAddress())).thenThrow(new DatabaseException(DatabaseError.REQUEST_REJECTED));
Response response = resource.updateUser(key, "password", null, user);
assertEquals(Response.Status.INTERNAL_SERVER_ERROR, response.getStatusInfo());
}
Aggregations