use of tech.aroma.thrift.Message in project aroma-data-operations by RedRoma.
the class CassandraMessageRepositoryIT method testGetByTitle.
@Test
public void testGetByTitle() throws Exception {
String title = one(alphabeticString());
List<Message> expected = messages.stream().map(m -> m.setTitle(title)).collect(toList());
saveMessages(expected);
List<Message> result = instance.getByTitle(appId, title);
assertThat(result, notNullValue());
assertThat(result, not(empty()));
assertThat(containTheSameElements(result, expected), is(true));
}
use of tech.aroma.thrift.Message in project aroma-data-operations by RedRoma.
the class CassandraInboxRepositoryTest method testGetMessagesForUser.
@Test
public void testGetMessagesForUser() throws Exception {
List<Message> result = instance.getMessagesForUser(userId);
assertThat(result, notNullValue());
assertThat(result, not(empty()));
assertThat(result, contains(message));
verify(cassandra).execute(captor.capture());
Statement statement = captor.getValue();
assertThat(statement, notNullValue());
assertThat(statement, is(instanceOf(Select.class)));
}
use of tech.aroma.thrift.Message in project aroma-data-operations by RedRoma.
the class CassandraInboxRepositoryTest method testSaveMessageForUserWithBadArgs.
@DontRepeat
@Test
public void testSaveMessageForUserWithBadArgs() throws Exception {
User userWithBadId = new User(user).setUserId(badId);
assertThrows(() -> instance.saveMessageForUser(userWithBadId, message, lifetime)).isInstanceOf(InvalidArgumentException.class);
Message messageWithBadId = new Message(message).setMessageId(badId);
assertThrows(() -> instance.saveMessageForUser(user, messageWithBadId, lifetime)).isInstanceOf(InvalidArgumentException.class);
Message messageWithBadAppId = new Message(message).setApplicationId(badId);
assertThrows(() -> instance.saveMessageForUser(user, messageWithBadAppId, lifetime)).isInstanceOf(InvalidArgumentException.class);
}
use of tech.aroma.thrift.Message in project aroma-data-operations by RedRoma.
the class CassandraMessageRepositoryTest method testSaveMessageWithBadArgs.
@Test
public void testSaveMessageWithBadArgs() throws Exception {
assertThrows(() -> instance.saveMessage(null, lifetime)).isInstanceOf(InvalidArgumentException.class);
assertThrows(() -> instance.saveMessage(message, null)).isInstanceOf(InvalidArgumentException.class);
Message emptyMessage = new Message();
assertThrows(() -> instance.saveMessage(emptyMessage, lifetime)).isInstanceOf(InvalidArgumentException.class);
Message messageWithBadId = new Message(message).setMessageId(badId);
assertThrows(() -> instance.saveMessage(messageWithBadId)).isInstanceOf(InvalidArgumentException.class);
}
use of tech.aroma.thrift.Message in project aroma-data-operations by RedRoma.
the class CassandraMessageRepositoryTest method testGetMessage.
@Test
public void testGetMessage() throws Exception {
Message result = instance.getMessage(appId, messageId);
assertThat(result, is(message));
verify(cassandra).execute(captor.capture());
Statement statement = captor.getValue();
assertThat(statement, notNullValue());
assertThat(statement, instanceOf(Select.class));
}
Aggregations