@Test
public void verifyEventsGetUidAssigned()
{

    final String uid = CodeGenerator.generateUid();
    // Given
    Event event1 = new Event();
    Event event2 = new Event();
    Event event3 = new Event();
    Event event4 = new Event();
    event4.setEvent( uid );
    // When
    List<Event> events = subject.assignUidToEvents( Lists.newArrayList( event1, event2, event3, event4 ) );
    // Then
    assertThat( events, hasSize( 4 ) );
    events.forEach( e -> assertNotNull( e.getUid() ) );
    // make sure we got 4 distinct UIDs
    assertThat( events.stream().collect( Collectors.toMap( Event::getUid, Function.identity() ) ).keySet(),
        hasSize( 4 ) );
    // make sure Event4 has retained the original UID
    assertThat( event4.getUid(), is( uid ) );
    assertThat( event4.getEvent(), is( uid ) );
}