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

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

More Tests

parent a939da57
Branches
2 merge requests!55June Release,!52Resolve "Extend Bookmarklists and implement stored searches"
......@@ -15,7 +15,7 @@ public enum CheckFrequency {
case NEVER: return now;
case DAILY: return now.minus(1, ChronoUnit.DAYS);
case WEEKLY: return now.minus(1, ChronoUnit.WEEKS);
case MONTHLY: return now.minus(1, ChronoUnit.MONTHS);
case MONTHLY: return now.minus(30, ChronoUnit.DAYS);
default: // should never happen
return now;
}
......
......@@ -99,7 +99,7 @@ public class UserWatchListQueryService extends QueryService<UserWatchList> {
}
if (criteria.getUserIdId() != null) {
specification = specification.and(buildSpecification(criteria.getUserIdId(),
root -> root.join(UserWatchList_.userId, JoinType.LEFT).get(User_.id)));
root -> root.join(UserWatchList_.user, JoinType.LEFT).get(User_.id)));
}
}
return specification;
......
......@@ -86,14 +86,24 @@ public class UserWatchListServiceIT {
user.setActivated(false);
userRepository.saveAndFlush(user);
UserWatchList wl = new UserWatchList("someTestWatchList", CheckFrequency.DAILY, user);
UserWatchList wlDAILY = new UserWatchList("someTestWatchList", CheckFrequency.DAILY, user);
WatchListEntry wle1 = new WatchListEntry();
wle1.setExerciseId("3");
wle1.setExerciseName("Unused in this test");
wl.getWatchListEntries().add(wle1);
wlDAILY.getWatchListEntries().add(wle1);
userWatchListRepository.save(wl);
userWatchListRepository.save(wlDAILY);
UserWatchList wlMONTHLY = new UserWatchList("someTestWatchList", CheckFrequency.MONTHLY, user);
WatchListEntry wle2 = new WatchListEntry();
wle2.setExerciseId("3");
wle2.setExerciseName("Unused in this test");
wlMONTHLY.getWatchListEntries().add(wle2);
userWatchListRepository.save(wlMONTHLY);
}
@Test
......@@ -119,4 +129,12 @@ public class UserWatchListServiceIT {
final Map<SearchResultDTO, UserWatchList> changesSinceAnHourBefore = userWatchListService.findChangesSince(justOneHourBeforeChange, user);
org.junit.Assert.assertTrue("At least one match, because changed an hour later", !changesSinceAnHourBefore.isEmpty());
}
@Test
@Transactional
public void testChangedBeforeCheckFrequency() {
final Map<SearchResultDTO, UserWatchList> allExercisesAreTooOld = userWatchListService.findChangesSince(CheckFrequency.MONTHLY, user);
org.junit.Assert.assertTrue("At least one match, because changed an hour later", allExercisesAreTooOld.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