@Test
public void testGetTemporalConstraintsForSingleClippedRange() throws ParseException {

  final Date stime = DateUtilities.parseISO("2005-05-14T20:32:56Z");
  final Date etime = DateUtilities.parseISO("2005-05-18T20:32:56Z");
  final Date stime1 = DateUtilities.parseISO("2005-05-18T20:32:56Z");
  final Date etime1 = DateUtilities.parseISO("2005-05-19T20:32:56Z");
  final Map<StatisticsId, InternalDataStatistics<SimpleFeature, ?, ?>> statsMap = new HashMap<>();
  final FeatureTimeRangeStatistics whenStats = new FeatureTimeRangeStatistics("when");
  statsMap.put(
      VectorStatisticsQueryBuilder.newBuilder().factory().timeRange().fieldName(
          "when").build().getId(),
      whenStats);
  final TemporalConstraintsSet constraintsSet = new TemporalConstraintsSet();
  constraintsSet.getConstraintsFor("when").add(new TemporalRange(stime, etime));
  final SimpleFeature notIntersectSingle1 = createSingleTimeFeature(startTime);
  whenStats.entryIngested(notIntersectSingle1);
  final SimpleFeature notIntersectSingle = createSingleTimeFeature(endTime);
  whenStats.entryIngested(notIntersectSingle);
  final TemporalConstraintsSet resultConstraintsSet =
      QueryIndexHelper.clipIndexedTemporalConstraints(
          statsMap,
          singleTimeDescriptors,
          constraintsSet);
  final TemporalConstraints constraints = resultConstraintsSet.getConstraintsFor("when");
  assertEquals(1, constraints.getRanges().size());
  assertEquals(startTime, constraints.getStartRange().getStartTime());
  assertEquals(etime, constraints.getStartRange().getEndTime());
  final TemporalConstraintsSet constraintsSet1 = new TemporalConstraintsSet();
  constraintsSet1.getConstraintsFor("when").add(new TemporalRange(stime1, etime1));
  final TemporalConstraintsSet resultConstraintsSet1 =
      QueryIndexHelper.clipIndexedTemporalConstraints(
          statsMap,
          singleTimeDescriptors,
          constraintsSet1);
  final TemporalConstraints constraints1 = resultConstraintsSet1.getConstraintsFor("when");
  assertEquals(1, constraints1.getRanges().size());
  assertEquals(stime1, constraints1.getStartRange().getStartTime());
  assertEquals(etime1, constraints1.getStartRange().getEndTime());
}