test_class.declarator: userService
test_class.modifier: @Mock
      private
test_class.original_string: @Mock
      private RepositoryUserService userService;
test_class.type: RepositoryUserService
test_class.var_name: userService
test_class.declarator: intervalRepo
test_class.modifier: @Mock
      private
test_class.original_string: @Mock
      private AccessIntervalRepository intervalRepo;
test_class.type: AccessIntervalRepository
test_class.var_name: intervalRepo
test_class.declarator: userAccessEventHandlerMock
test_class.modifier: @Mock
      private
test_class.original_string: @Mock
      private UserAccessEventHandler userAccessEventHandlerMock;
test_class.type: UserAccessEventHandler
test_class.var_name: userAccessEventHandlerMock
test_class.declarator: userMock
test_class.modifier: @Mock
      private
test_class.original_string: @Mock
      private User userMock;
test_class.type: User
test_class.var_name: userMock
test_class.declarator: accessIntervalMock
test_class.modifier: @Mock
      private
test_class.original_string: @Mock
      private AccessInterval accessIntervalMock;
test_class.type: AccessInterval
test_class.var_name: accessIntervalMock
test_class.declarator: clock
test_class.modifier: private
test_class.original_string: private Clock clock;
test_class.type: Clock
test_class.var_name: clock
test_class.declarator: accessService
test_class.modifier: private
test_class.original_string: private RepositoryUserAccessService accessService;
test_class.type: RepositoryUserAccessService
test_class.var_name: accessService
test_class.file: backend/project-board/src/test/java/de/adesso/projectboard/ad/access/RepositoryUserAccessServiceTest.java
test_class.identifier: RepositoryUserAccessServiceTest
test_case.body: @Test
      public void userHasActiveAccessIntervalReturnsFalseWhenStartDateAfterToday() {
          // given
          var startDateTime = LocalDateTime.now(clock).plus(1L, ChronoUnit.DAYS);
          var endDateTime = LocalDateTime.now(clock).plus(3L, ChronoUnit.DAYS);
  
          given(userMock.getLatestAccessInterval()).willReturn(Optional.of(accessIntervalMock));
  
          given(accessIntervalMock.getStartTime()).willReturn(startDateTime);
          given(accessIntervalMock.getEndTime()).willReturn(endDateTime);
  
          // when
          boolean actualHasAccess = accessService.userHasActiveAccessInterval(userMock);
  
          // then
          assertThat(actualHasAccess).isFalse();
      }
test_case.class_method_signature: RepositoryUserAccessServiceTest.userHasActiveAccessIntervalReturnsFalseWhenStartDateAfterToday()
test_case.full_signature: @Test public void userHasActiveAccessIntervalReturnsFalseWhenStartDateAfterToday()
test_case.identifier: userHasActiveAccessIntervalReturnsFalseWhenStartDateAfterToday
test_case.invocations: plus now plus now willReturn given getLatestAccessInterval of willReturn given getStartTime willReturn given getEndTime userHasActiveAccessInterval isFalse assertThat
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void userHasActiveAccessIntervalReturnsFalseWhenStartDateAfterToday()
focal_class.declarator: userService
focal_class.modifier: private final
focal_class.original_string: private final RepositoryUserService userService;
focal_class.type: RepositoryUserService
focal_class.var_name: userService
focal_class.declarator: intervalRepo
focal_class.modifier: private final
focal_class.original_string: private final AccessIntervalRepository intervalRepo;
focal_class.type: AccessIntervalRepository
focal_class.var_name: intervalRepo
focal_class.declarator: userAccessEventHandler
focal_class.modifier: private final
focal_class.original_string: private final UserAccessEventHandler userAccessEventHandler;
focal_class.type: UserAccessEventHandler
focal_class.var_name: userAccessEventHandler
focal_class.declarator: clock
focal_class.modifier: private final
focal_class.original_string: private final Clock clock;
focal_class.type: Clock
focal_class.var_name: clock
focal_class.file: backend/project-board/src/main/java/de/adesso/projectboard/ad/access/RepositoryUserAccessService.java
focal_class.identifier: RepositoryUserAccessService
focal_class.interfaces: implements UserAccessService
focal_class.class_method_signature: RepositoryUserAccessService.RepositoryUserAccessService(RepositoryUserService userService,
                                         AccessIntervalRepository intervalRepo,
                                         UserAccessEventHandler userAccessEventHandler,
                                         Clock clock)
focal_class.full_signature: @Autowired public  RepositoryUserAccessService(RepositoryUserService userService,
                                         AccessIntervalRepository intervalRepo,
                                         UserAccessEventHandler userAccessEventHandler,
                                         Clock clock)
focal_class.identifier: RepositoryUserAccessService
focal_class.modifiers: @Autowired public
focal_class.parameters: (RepositoryUserService userService,
                                         AccessIntervalRepository intervalRepo,
                                         UserAccessEventHandler userAccessEventHandler,
                                         Clock clock)
focal_class.signature:  RepositoryUserAccessService(RepositoryUserService userService,
                                         AccessIntervalRepository intervalRepo,
                                         UserAccessEventHandler userAccessEventHandler,
                                         Clock clock)
focal_class.class_method_signature: RepositoryUserAccessService.giveUserAccessUntil(User user, LocalDateTime until)
focal_class.full_signature: @Override public User giveUserAccessUntil(User user, LocalDateTime until)
focal_class.identifier: giveUserAccessUntil
focal_class.modifiers: @Override public
focal_class.parameters: (User user, LocalDateTime until)
focal_class.return: User
focal_class.signature: User giveUserAccessUntil(User user, LocalDateTime until)
focal_class.class_method_signature: RepositoryUserAccessService.removeAccessFromUser(User user)
focal_class.full_signature: @Override public User removeAccessFromUser(User user)
focal_class.identifier: removeAccessFromUser
focal_class.modifiers: @Override public
focal_class.parameters: (User user)
focal_class.return: User
focal_class.signature: User removeAccessFromUser(User user)
focal_class.class_method_signature: RepositoryUserAccessService.userHasActiveAccessInterval(User user)
focal_class.full_signature: @Override public boolean userHasActiveAccessInterval(User user)
focal_class.identifier: userHasActiveAccessInterval
focal_class.modifiers: @Override public
focal_class.parameters: (User user)
focal_class.return: boolean
focal_class.signature: boolean userHasActiveAccessInterval(User user)
focal_method.body: @Override
      public boolean userHasActiveAccessInterval(User user) {
          var latestIntervalOptional = user.getLatestAccessInterval();
  
          if(latestIntervalOptional.isPresent()) {
              var latestInterval = latestIntervalOptional.get();
  
              var startTime = latestInterval.getStartTime();
              var endTime = latestInterval.getEndTime();
              var now = LocalDateTime.now(clock);
  
              return (startTime.isEqual(now) || startTime.isBefore(now)) && (endTime.isEqual(now) || endTime.isAfter(now));
          }
  
          return false;
      }
focal_method.class_method_signature: RepositoryUserAccessService.userHasActiveAccessInterval(User user)
focal_method.full_signature: @Override public boolean userHasActiveAccessInterval(User user)
focal_method.identifier: userHasActiveAccessInterval
focal_method.invocations: getLatestAccessInterval isPresent get getStartTime getEndTime now isEqual isBefore isEqual isAfter
focal_method.modifiers: @Override public
focal_method.parameters: (User user)
focal_method.return: boolean
focal_method.signature: boolean userHasActiveAccessInterval(User user)