@Test
public void testGetTemporalConstraintsForRangeClippedFullRange() throws ParseException {

  final Map<StatisticsId, InternalDataStatistics<SimpleFeature, ?, ?>> statsMap = new HashMap<>();
  final FeatureTimeRangeStatistics startStats = new FeatureTimeRangeStatistics("start");
  statsMap.put(
      VectorStatisticsQueryBuilder.newBuilder().factory().timeRange().fieldName(
          "start").build().getId(),
      startStats);
  final FeatureTimeRangeStatistics endStats = new FeatureTimeRangeStatistics("end");
  statsMap.put(
      VectorStatisticsQueryBuilder.newBuilder().factory().timeRange().fieldName(
          "end").build().getId(),
      endStats);
  final Date statsStart1 = DateUtilities.parseISO("2005-05-18T20:32:56Z");
  final Date statsStart2 = DateUtilities.parseISO("2005-05-20T20:32:56Z");
  final Date statsEnd1 = DateUtilities.parseISO("2005-05-21T20:32:56Z");
  final Date statsEnd2 = DateUtilities.parseISO("2005-05-24T20:32:56Z");
  final SimpleFeature firstRangFeature = createFeature(statsStart1, statsEnd1);
  startStats.entryIngested(firstRangFeature);
  endStats.entryIngested(firstRangFeature);
  final SimpleFeature secondRangFeature = createFeature(statsStart2, statsEnd2);
  startStats.entryIngested(secondRangFeature);
  endStats.entryIngested(secondRangFeature);
  final Date stime = DateUtilities.parseISO("2005-05-18T20:32:56Z");
  final Date etime = DateUtilities.parseISO("2005-05-19T20:32:56Z");
  final TemporalConstraintsSet constraintsSet = new TemporalConstraintsSet();
  constraintsSet.getConstraintsForRange("start", "end").add(
      new TemporalRange(new Date(0), etime));
  final TemporalConstraintsSet resultConstraintsSet =
      QueryIndexHelper.clipIndexedTemporalConstraints(
          statsMap,
          rangeTimeDescriptors,
          constraintsSet);
  final TemporalConstraints constraints =
      resultConstraintsSet.getConstraintsForRange("start", "end");
  assertEquals(1, constraints.getRanges().size());
  assertEquals(stime, constraints.getStartRange().getStartTime());
  assertEquals(etime, constraints.getStartRange().getEndTime());
}