EventStream { public static <S> EventStream<S> of(Stream<? extends Event> stream) { return new EventStream<>(null, stream); } EventStream(S state, Stream<? extends Event> stream); static Builder<S> builder(S state); static Builder<S> builder(); static EventStream<S> empty(); static EventStream<S> empty(S state); static EventStream<S> ofWithState(S state, Stream<? extends Event> stream); static EventStream<S> of(Stream<? extends Event> stream); static EventStream<S> ofWithState(S state, Event event); static EventStream<S> of(Event event); static EventStream<S> ofWithState(S state, Event ...events); static EventStream<S> of(Event ...events);  }
@Test public void testOf() throws Exception { EventStream<Object> test = EventStream.of(EventCausalityEstablished.builder().build()); assertNull(test.getState()); assertEquals(test.getStream().collect(Collectors.<Event>toSet()).size(), 1); }