use of uk.gov.justice.services.core.aggregate.event.EventA in project microservice_framework by CJSCommonPlatform.
the class DefaultAggregateServiceTest method shouldThrowExceptionForUnregisteredEvent.
@Test(expected = IllegalStateException.class)
public void shouldThrowExceptionForUnregisteredEvent() {
when(eventStream.getId()).thenReturn(STREAM_ID);
JsonObject eventPayloadA = mock(JsonObject.class);
EventA eventA = mock(EventA.class);
when(jsonObjectToObjectConverter.convert(eventPayloadA, EventA.class)).thenReturn(eventA);
when(eventStream.read()).thenReturn(Stream.of(envelopeFrom(metadataWithRandomUUID("eventA"), eventPayloadA)));
aggregateService.get(eventStream, TestAggregate.class);
}
use of uk.gov.justice.services.core.aggregate.event.EventA in project microservice_framework by CJSCommonPlatform.
the class DefaultAggregateServiceIT method shouldThrowExceptionForNonInstantiatableEvent.
@Test(expected = RuntimeException.class)
public void shouldThrowExceptionForNonInstantiatableEvent() throws EventStreamException {
final EventStream eventStream = eventSource.getStreamById(STREAM_ID);
aggregateService.register(new EventFoundEvent(EventA.class, "eventA"));
aggregateService.get(eventStream, PrivateAggregate.class);
}
Aggregations