@Before public void createTestData() { int index = pvpLeagueIds.size(); for (String league : pvpLeagueIds) { DateTime tim = new DateTime(); tim.minusWeeks(index); index--; String userId = userIds.get(index); PvpLeagueForUser pvp = new PvpLeagueForUser( userId, league, index, index, tim.getMillis(), tim.getMillis(), index, index, index, index, tim.getMillis()); repo.save(pvp); leagues.add(pvp); log.info("Saving: {}", pvp); } }
@Test public void test() { List<PvpLeagueForUser> res = repo.getLeaguesByEloAndShieldEndTimeLessThanAndBattleEndTimeLessThan( pvpLeagueIds.size() - 4, pvpLeagueIds.size() - 1, System.currentTimeMillis(), System.currentTimeMillis(), 10); log.info("Found {} leagues", res.size()); for (PvpLeagueForUser le : res) { log.info("Found: {}", le); } Assert.assertTrue("Found all relevant pvpLeaguesForUser", res.size() == 4); }