use of com.sanction.thunder.dao.DatabaseException in project thunder by RohanNagar.
the class UserResourceTest method testUpdateUserDatabaseDown.
@Test
public void testUpdateUserDatabaseDown() {
when(usersDao.findByEmail(email.getAddress())).thenReturn(user);
when(usersDao.update(null, updatedUser)).thenThrow(new DatabaseException(DatabaseError.DATABASE_DOWN));
Response response = resource.updateUser(key, "password", null, updatedUser);
assertEquals(Response.Status.SERVICE_UNAVAILABLE, response.getStatusInfo());
}
use of com.sanction.thunder.dao.DatabaseException in project thunder by RohanNagar.
the class UserResourceTest method testGetUserNotFound.
@Test
public void testGetUserNotFound() {
when(usersDao.findByEmail(email.getAddress())).thenThrow(new DatabaseException(DatabaseError.USER_NOT_FOUND));
Response response = resource.getUser(key, "password", email.getAddress());
assertEquals(Response.Status.NOT_FOUND, response.getStatusInfo());
}
use of com.sanction.thunder.dao.DatabaseException in project thunder by RohanNagar.
the class UserResourceTest method testDeleteUserLookupNotFound.
@Test
public void testDeleteUserLookupNotFound() {
when(usersDao.findByEmail(email.getAddress())).thenThrow(new DatabaseException(DatabaseError.USER_NOT_FOUND));
Response response = resource.deleteUser(key, "password", email.getAddress());
assertEquals(Response.Status.NOT_FOUND, response.getStatusInfo());
}
use of com.sanction.thunder.dao.DatabaseException in project thunder by RohanNagar.
the class VerificationResourceTest method testVerifyUserUpdateUserException.
@Test
public void testVerifyUserUpdateUserException() {
when(usersDao.findByEmail(anyString())).thenReturn(nullDatabaseTokenMockUser);
when(usersDao.update(anyString(), any(PilotUser.class))).thenThrow(new DatabaseException(DatabaseError.DATABASE_DOWN));
Response response = resource.createVerificationEmail(key, "test@test.com", "password");
assertEquals(response.getStatusInfo(), Response.Status.SERVICE_UNAVAILABLE);
}
use of com.sanction.thunder.dao.DatabaseException in project thunder by RohanNagar.
the class VerificationResourceTest method testVerifyEmailUpdateUserException.
@Test
public void testVerifyEmailUpdateUserException() {
when(usersDao.findByEmail("test@test.com")).thenReturn(unverifiedMockUser);
when(usersDao.update(unverifiedMockUser.getEmail().getAddress(), verifiedMockUser)).thenThrow(new DatabaseException(DatabaseError.DATABASE_DOWN));
Response response = resource.verifyEmail("test@test.com", "verificationToken", ResponseType.JSON);
assertEquals(response.getStatusInfo(), Response.Status.SERVICE_UNAVAILABLE);
}
Aggregations