This is the codeAbility Sharing Platform! Learn more about the codeAbility Sharing Platform.

Skip to content
Snippets Groups Projects
Commit a939da57 authored by Michael Breu's avatar Michael Breu :speech_balloon:
Browse files

Intermediate commit: More Tests

parent f4d29e48
Branches
2 merge requests!55June Release,!52Resolve "Extend Bookmarklists and implement stored searches"
......@@ -511,7 +511,7 @@ public class MetaDataRepository {
}
queryBuilder.must(idQueryBuilder);
if(since != null) {
queryBuilder.should(QueryBuilders.rangeQuery(SearchRepositoryConstants.PROJECT_LASTACTIVITYAT).gte(since));
queryBuilder.must(QueryBuilders.rangeQuery(SearchRepositoryConstants.PROJECT_LASTACTIVITYAT).gte(since) /*.lte(Instant.now()) */);
}
addAuthorizationQuery(user, queryBuilder);
......
......@@ -5,6 +5,7 @@ import static org.mockito.Mockito.when;
import java.io.IOException;
import java.time.Instant;
import java.time.LocalDateTime;
import java.time.temporal.ChronoUnit;
import java.util.Map;
import java.util.Optional;
......@@ -51,9 +52,6 @@ public class UserWatchListServiceIT {
@Autowired
private UserRepository userRepository;
@Autowired
private UserService userService;
@Autowired
private UserWatchListService userWatchListService;
@Autowired
......@@ -106,5 +104,19 @@ public class UserWatchListServiceIT {
org.junit.Assert.assertTrue("At least one match, because changed since 1970", !changesSince1970.isEmpty());
}
@Test
@Transactional
public void testNotChangedAfterCheck() {
final Instant justOneHourAfterChange = LAST_CHANGE_DATE_OF_EXERCISE3.plus(1, ChronoUnit.HOURS);
final Map<SearchResultDTO, UserWatchList> changesSinceAnHourLater = userWatchListService.findChangesSince(justOneHourAfterChange, user);
org.junit.Assert.assertTrue("At least one match, because changed an hour before", changesSinceAnHourLater.isEmpty());
}
@Test
@Transactional
public void testChangedBeforeCheck() {
final Instant justOneHourBeforeChange = LAST_CHANGE_DATE_OF_EXERCISE3.minus(1, ChronoUnit.HOURS);
final Map<SearchResultDTO, UserWatchList> changesSinceAnHourBefore = userWatchListService.findChangesSince(justOneHourBeforeChange, user);
org.junit.Assert.assertTrue("At least one match, because changed an hour later", !changesSinceAnHourBefore.isEmpty());
}
}
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment