@Test
public void shouldCreateAggregateFromSingletonStream() {

    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(
                    metadataBuilder()
                            .withStreamId(STREAM_ID)
                            .withId(randomUUID())
                            .withName("eventA"),
                    eventPayloadA)));
    when(eventStream.getId()).thenReturn(STREAM_ID);
    registerEvent(EventA.class, "eventA");
    TestAggregate aggregate = aggregateService.get(eventStream, TestAggregate.class);
    assertThat(aggregate, notNullValue());
    assertThat(aggregate.recordedEvents(), hasSize(1));
    assertThat(aggregate.recordedEvents().get(0), equalTo(eventA));
    verify(logger).info("Registering event {}, {} with DefaultAggregateService", "eventA", EventA.class);
    verify(logger).trace("Recreating aggregate for instance {} of aggregate type {}", STREAM_ID, TestAggregate.class);
}