@Test
public void getLatestAccessIntervalReturnsLastAddedWhenCollectionContainsMultipleElements() {

    // given
    AccessInterval expectedAccessIntervalMock = mock(AccessInterval.class);
    User user = new User("user");
    user.accessIntervals.addAll(Arrays.asList(accessIntervalMock, expectedAccessIntervalMock));
    // when
    AccessInterval actualAccessInterval = user.getLatestAccessInterval()
            .orElseThrow(() -> new IllegalStateException("No interval instance present!"));
    // then
    assertThat(actualAccessInterval).isEqualTo(expectedAccessIntervalMock);
}