use of tech.aroma.thrift.exceptions.OperationFailedException in project aroma-data-operations by RedRoma.
the class MeasuredUserRepositoryTest method testContainsUserWhenThrows.
@DontRepeat
@Test
public void testContainsUserWhenThrows() throws Exception {
when(delegate.containsUser(userId)).thenThrow(new OperationFailedException());
assertThrows(() -> instance.containsUser(userId)).isInstanceOf(OperationFailedException.class);
verify(delegate).containsUser(userId);
}
use of tech.aroma.thrift.exceptions.OperationFailedException in project aroma-data-operations by RedRoma.
the class MeasuredUserRepositoryTest method testGetUserWhenThrows.
@DontRepeat
@Test
public void testGetUserWhenThrows() throws Exception {
when(delegate.getUser(userId)).thenThrow(new OperationFailedException());
assertThrows(() -> instance.getUser(userId)).isInstanceOf(OperationFailedException.class);
}
use of tech.aroma.thrift.exceptions.OperationFailedException in project aroma-data-operations by RedRoma.
the class MeasuredApplicationRepositoryTest method testSaveApplicationWhenThrows.
@DontRepeat
@Test
public void testSaveApplicationWhenThrows() throws Exception {
doThrow(new OperationFailedException()).when(delegate).saveApplication(application);
assertThrows(() -> instance.saveApplication(application)).isInstanceOf(OperationFailedException.class);
verify(delegate).saveApplication(application);
}
use of tech.aroma.thrift.exceptions.OperationFailedException in project aroma-data-operations by RedRoma.
the class MeasuredApplicationRepositoryTest method testGetRecentlyCreatedWhenThrows.
@DontRepeat
@Test
public void testGetRecentlyCreatedWhenThrows() throws Exception {
when(delegate.getRecentlyCreated()).thenThrow(new OperationFailedException());
assertThrows(() -> instance.getRecentlyCreated()).isInstanceOf(OperationFailedException.class);
}
use of tech.aroma.thrift.exceptions.OperationFailedException in project aroma-data-operations by RedRoma.
the class CassandraInboxRepository method countInboxForUser.
@Override
public long countInboxForUser(String userId) throws TException {
checkUserId(userId);
Statement query = createQueryToCountMessagesFor(userId);
ResultSet results;
try {
results = cassandra.execute(query);
} catch (Exception ex) {
LOG.error("Failed to count total messages for User [{}]", userId, ex);
throw new OperationFailedException("Could not count messags for user: " + ex.getMessage());
}
Row row = results.one();
checkThat(row).throwing(OperationFailedException.class).usingMessage("Query for message failed").is(notNull());
long count = row.getLong(0);
return count;
}
Aggregations