@Test
public void addAccessIntervalThrowsExceptionWhenNotBelongingToUser() {

    // given
    User user = new User("user");
    User otherUser = new User("other-user");
    given(accessIntervalMock.getUser()).willReturn(otherUser);
    // when
    assertThatThrownBy(() -> user.addAccessInterval(accessIntervalMock))
            .isInstanceOf(IllegalArgumentException.class)
            .hasMessage("Interval instance belongs to a different or no user!");
}