use of tech.aroma.thrift.events.Event in project aroma-data-operations by RedRoma.
the class CassandraActivityRepositoryTest method testGetAllEventsFor.
@Test
public void testGetAllEventsFor() throws Exception {
List<Event> events = listOf(events());
List<Row> rows = Lists.create();
Map<Row, Event> rowMap = Maps.create();
for (Event event : events) {
Row row = mock(Row.class);
when(eventMapper.apply(row)).thenReturn(event);
rows.add(row);
rowMap.put(row, event);
}
when(results.iterator()).thenReturn(rows.iterator());
when(results.all()).thenReturn(rows);
List<Event> response = instance.getAllEventsFor(user);
assertThat(response, is(events));
}
use of tech.aroma.thrift.events.Event in project aroma-data-operations by RedRoma.
the class CassandraActivityRepositoryTest method testGetEvent.
@Test
public void testGetEvent() throws Exception {
Event result = instance.getEvent(eventId, user);
assertThat(result, is(event));
verify(session).execute(captor.capture());
Statement statement = captor.getValue();
assertThat(statement, notNullValue());
assertThat(statement, is(instanceOf(Select.Where.class)));
}
use of tech.aroma.thrift.events.Event in project aroma-data-operations by RedRoma.
the class CassandraActivityRepository method mapRowToEvent.
private Event mapRowToEvent(Row row) throws DoesNotExistException {
if (row == null) {
return new Event();
}
Event event = eventMapper.apply(row);
checkThat(event).usingMessage("event does not exist").throwing(DoesNotExistException.class).is(notNull());
return event;
}
use of tech.aroma.thrift.events.Event in project aroma-data-operations by RedRoma.
the class MemoryActivityRepositoryTest method testGetEvent.
@Test
public void testGetEvent() throws Exception {
instance.saveEvent(event, user);
Event result = instance.getEvent(eventId, user);
assertThat(result, is(event));
}
use of tech.aroma.thrift.events.Event in project aroma-data-operations by RedRoma.
the class MemoryActivityRepositoryTest method testDeleteAllEventsFor.
@Test
public void testDeleteAllEventsFor() throws Exception {
for (Event e : events) {
instance.saveEvent(e, user);
}
instance.deleteAllEventsFor(user);
assertThat(instance.getAllEventsFor(user), is(empty()));
}
Aggregations