@Test public void convertGap_14DAYS() { XDateRange xDateRange = new XDateRange(new LocalDate(), new LocalDate(), new Period(14, PeriodUnit.DAY)); String gapParam = xDateRangeConverter.convertGap(xDateRange); assertEquals("+14DAYS", gapParam); }
@Override public String convertGap(XRange xRange) { Preconditions.checkNotNull(xRange); Preconditions.checkArgument(isApplicable(xRange.getClass())); XDateRange xDateRange = (XDateRange) xRange; Period gap = xDateRange.getGap(); int gapValue = gap.getValue(); PeriodUnit gapUnit = gap.getUnit(); String periodUnit = PERIOD_UNIT_MAPPINGS.get(gapUnit); if (periodUnit == null) { throw new IllegalArgumentException("PeriodUnit " + gapUnit.name() + " is not supported"); } return "+" + gapValue + periodUnit; }
XDateRangeConverter implements XRangeConverter { @Override public String convertGap(XRange xRange) { Preconditions.checkNotNull(xRange); Preconditions.checkArgument(isApplicable(xRange.getClass())); XDateRange xDateRange = (XDateRange) xRange; Period gap = xDateRange.getGap(); int gapValue = gap.getValue(); PeriodUnit gapUnit = gap.getUnit(); String periodUnit = PERIOD_UNIT_MAPPINGS.get(gapUnit); if (periodUnit == null) { throw new IllegalArgumentException("PeriodUnit " + gapUnit.name() + " is not supported"); } return "+" + gapValue + periodUnit; } }
XDateRangeConverter implements XRangeConverter { @Override public String convertGap(XRange xRange) { Preconditions.checkNotNull(xRange); Preconditions.checkArgument(isApplicable(xRange.getClass())); XDateRange xDateRange = (XDateRange) xRange; Period gap = xDateRange.getGap(); int gapValue = gap.getValue(); PeriodUnit gapUnit = gap.getUnit(); String periodUnit = PERIOD_UNIT_MAPPINGS.get(gapUnit); if (periodUnit == null) { throw new IllegalArgumentException("PeriodUnit " + gapUnit.name() + " is not supported"); } return "+" + gapValue + periodUnit; }  }
XDateRangeConverter implements XRangeConverter { @Override public String convertGap(XRange xRange) { Preconditions.checkNotNull(xRange); Preconditions.checkArgument(isApplicable(xRange.getClass())); XDateRange xDateRange = (XDateRange) xRange; Period gap = xDateRange.getGap(); int gapValue = gap.getValue(); PeriodUnit gapUnit = gap.getUnit(); String periodUnit = PERIOD_UNIT_MAPPINGS.get(gapUnit); if (periodUnit == null) { throw new IllegalArgumentException("PeriodUnit " + gapUnit.name() + " is not supported"); } return "+" + gapValue + periodUnit; }  @Override boolean isApplicable(Class<? extends XRange> clazz); @Override String convertStart(XRange xRange); @Override String convertEnd(XRange xRange); @Override String convertGap(XRange xRange); }
XDateRangeConverter implements XRangeConverter { @Override public String convertGap(XRange xRange) { Preconditions.checkNotNull(xRange); Preconditions.checkArgument(isApplicable(xRange.getClass())); XDateRange xDateRange = (XDateRange) xRange; Period gap = xDateRange.getGap(); int gapValue = gap.getValue(); PeriodUnit gapUnit = gap.getUnit(); String periodUnit = PERIOD_UNIT_MAPPINGS.get(gapUnit); if (periodUnit == null) { throw new IllegalArgumentException("PeriodUnit " + gapUnit.name() + " is not supported"); } return "+" + gapValue + periodUnit; }  @Override boolean isApplicable(Class<? extends XRange> clazz); @Override String convertStart(XRange xRange); @Override String convertEnd(XRange xRange); @Override String convertGap(XRange xRange);  }