@Test
public void testBuild() throws Exception {

    long timestamp = System.currentTimeMillis();
    EventCorrelationInjector injector = new EventCorrelationInjector();
    StreamlineEvent parentEvent = copyEventWithNewID();
    // use same component name for parent and ancestor for easy testing
    // this line is covered via `testNoParent()`
    parentEvent = injector.injectCorrelationInformation(parentEvent, Collections.emptyList(), TEST_COMPONENT_NAME);
    StreamlineEvent injectedEvent = injector.injectCorrelationInformation(
            INPUT_STREAMLINE_EVENT, Collections.singletonList(parentEvent), TEST_COMPONENT_NAME);
    EventInformation information = sut.build(timestamp, TEST_COMPONENT_NAME, TEST_STREAM_ID,
            Sets.newHashSet(TEST_TARGET_COMPONENT_NAME, TEST_TARGET_COMPONENT_NAME_2), injectedEvent);
    assertEquals(timestamp, information.getTimestamp());
    assertEquals(injectedEvent.getId(), information.getEventId());
    assertEquals(EventCorrelationInjector.getRootIds(injectedEvent), information.getRootIds());
    assertEquals(EventCorrelationInjector.getParentIds(injectedEvent), information.getParentIds());
    assertEquals(EventCorrelationInjector.getSourceComponentName(injectedEvent), information.getComponentName());
    assertEquals(TEST_COMPONENT_NAME, information.getComponentName());
    assertEquals(TEST_STREAM_ID, information.getStreamId());
    assertEquals(Sets.newHashSet(TEST_TARGET_COMPONENT_NAME, TEST_TARGET_COMPONENT_NAME_2),
            information.getTargetComponents());
}