@Test
public void removeAccessFromUserActiveAccessIntervalPresent() {

    // given
    var activeStartTime = LocalDateTime.now(clock).minus(10L, ChronoUnit.DAYS);
    var activeEndTime = LocalDateTime.now(clock).plus(1L, ChronoUnit.WEEKS);
    var expectedEndTime = LocalDateTime.now(clock);
    given(userMock.getLatestAccessInterval()).willReturn(Optional.of(accessIntervalMock));
    given(accessIntervalMock.getStartTime()).willReturn(activeStartTime);
    given(accessIntervalMock.getEndTime()).willReturn(activeEndTime);
    // when
    var actualUser = accessService.removeAccessFromUser(userMock);
    // then
    assertThat(actualUser).isEqualTo(userMock);
    verify(accessIntervalMock).setEndTime(expectedEndTime);
    verify(intervalRepo).save(accessIntervalMock);
    verify(userAccessEventHandlerMock).onAccessRevoked(userMock, activeEndTime);
}