### Question:
DateRangeParser extends Parser<CDateRange> { @Override protected Decision<CDateRange, ?, ? extends CType<CDateRange, ?>> decideType() { if (anyOpen) { return new Decision<>( new NoopTransformer<>(), new DateRangeTypeDateRange() ); } if (onlyQuarters) { DateRangeTypeQuarter type = new DateRangeTypeQuarter(); return new Decision<>( new Transformer<CDateRange, Integer>() { @Override public Integer transform(CDateRange value) { return value.getMinValue(); } }, type ); } if (Math.subtractExact(maxValue, minValue) < PackedUnsigned1616.MAX_VALUE) { DateRangeTypePacked type = new DateRangeTypePacked(); type.setMinValue(minValue); type.setMaxValue(maxValue); log.debug("Decided for Packed: min={}, max={}", minValue, maxValue); return new Decision<>( new Transformer<CDateRange, Integer>() { @Override public Integer transform(CDateRange value) { return PackedUnsigned1616.pack(value.getMinValue() - minValue, value.getMaxValue() - minValue); } }, type ); } return new Decision<>( new NoopTransformer<>(), new DateRangeTypeDateRange() ); } DateRangeParser(ParserConfig config); static CDateRange parseISORange(String value);  }### Answer:
@Test public void onlyClosed() { final DateRangeParser parser = new DateRangeParser(new ParserConfig()); List.of(CDateRange.of(10,11), CDateRange.exactly(10)) .forEach(parser::registerValue); assertThat(parser.decideType().getType()).isInstanceOf(DateRangeTypePacked.class); }
@Test public void notOnlyClosed() { final DateRangeParser parser = new DateRangeParser(new ParserConfig()); List.of(CDateRange.of(10,11), CDateRange.exactly(10), CDateRange.atMost(10)) .forEach(parser::registerValue); assertThat(parser.decideType().getType()).isInstanceOf(DateRangeTypeDateRange.class); }
@Test public void onlyQuarters() { final DateRangeParser parser = new DateRangeParser(new ParserConfig()); List.of(CDateRange.of(QuarterUtils.getFirstDayOfQuarter(2011,1), QuarterUtils.getLastDayOfQuarter(2011,1))) .forEach(parser::registerValue); assertThat(parser.decideType().getType()).isInstanceOf(DateRangeTypeQuarter.class); }
@Test public void notPacked() { final DateRangeParser parser = new DateRangeParser(new ParserConfig()); List.of(CDateRange.of(10, PackedUnsigned1616.MAX_VALUE + 12)) .forEach(parser::registerValue); assertThat(parser.decideType().getType()).isInstanceOf(DateRangeTypeDateRange.class); }