expect(eventApi.get(anyInt())).andReturn(event(Status.ERROR));
expect(api.getEventApi()).andReturn(eventApi);
replay(eventApi, api);
EventDonePredicate predicate = new EventDonePredicate(api);
try {
predicate.apply(1);
fail("Method should have thrown an IllegalStateException");
} catch (IllegalStateException ex) {
assertEquals(ex.getMessage(), "Resource is in invalid status: ERROR");
}
}