public void findByDriftCriteriaWithStartTimeFilter() throws Exception {
long startTime = System.currentTimeMillis() - (1000 * 60 * 60); // one hour ago
int resourceId = 1;
MongoDBChangeSet c1 = createChangeSet(COVERAGE, 1, resourceId, 1);
c1.setCtime(startTime - (1000 * 5)); // c1 is created 5 seconds before startTime
MongoDBChangeSetEntry e1 = new MongoDBChangeSetEntry("c1-1.txt", FILE_ADDED);
e1.setCtime(startTime - (1000 * 5)); // e1 is created 5 seconds before startTime
c1.add(e1);
dao.save(c1);
MongoDBChangeSet c2 = createChangeSet(DRIFT, 2, resourceId, 1);
MongoDBChangeSetEntry e2 = new MongoDBChangeSetEntry("c1-1.txt", FILE_CHANGED);
c2.add(e2);
dao.save(c2);
GenericDriftCriteria criteria = new GenericDriftCriteria();
criteria.addFilterResourceIds(resourceId);
criteria.addFilterStartTime(startTime);
List<MongoDBChangeSet> actual = dao.findByDriftCriteria(criteria);
assertEquals(actual.size(), 1, "Expected to get back one change set");
MongoDBChangeSet actualChangeSet = actual.get(0);
assertChangeSetMatches("Failed to find drift entries by drift criteria with start time filter", c2,
actualChangeSet);
}