@Test public void singleDateRangeTest() { TemporalRangeParser trp = TemporalRangeParser.builder() .temporalParser(TemporalParser.create(Collections.singletonList(DMY))) .create(); EventRange range = trp.parse("1930/1929"); assertEquals("1930", range.getFrom().get().toString()); assertFalse(range.getTo().isPresent()); range = trp.parse("1930/1931"); assertEquals("1930", range.getFrom().get().toString()); assertEquals("1931", range.getTo().get().toString()); range = trp.parse("1930/1930"); assertEquals("1930", range.getFrom().get().toString()); assertFalse(range.getTo().isPresent()); range = trp.parse("1930-01"); assertEquals("1930-01", range.getFrom().get().toString()); assertFalse(range.getTo().isPresent()); range = trp.parse("01/1930"); assertFalse(range.getFrom().isPresent()); assertFalse(range.getTo().isPresent()); range = trp.parse("1930-01-02/1930-02-01"); assertEquals("1930-01-02", range.getFrom().get().toString()); assertEquals("1930-02-01", range.getTo().get().toString()); range = trp.parse("02/01/1930"); assertEquals("1930-01-02", range.getFrom().get().toString()); assertFalse(range.getTo().isPresent()); range = trp.parse("1930-01-02/02-01"); assertEquals("1930-01-02", range.getFrom().get().toString()); assertEquals("1930-02-01", range.getTo().get().toString()); range = trp.parse("1930-01-02/15"); assertEquals("1930-01-02", range.getFrom().get().toString()); assertEquals("1930-01-15", range.getTo().get().toString()); }
public EventRange parse(String dateRange) { return parse(null, null, null, dateRange); }
TemporalRangeParser implements Serializable { public EventRange parse(String dateRange) { return parse(null, null, null, dateRange); } }
TemporalRangeParser implements Serializable { public EventRange parse(String dateRange) { return parse(null, null, null, dateRange); } @Builder(buildMethodName = "create") private  TemporalRangeParser(TemporalParser temporalParser); }
TemporalRangeParser implements Serializable { public EventRange parse(String dateRange) { return parse(null, null, null, dateRange); } @Builder(buildMethodName = "create") private  TemporalRangeParser(TemporalParser temporalParser); EventRange parse(String dateRange); EventRange parse(String year, String month, String day, String dateRange); }
TemporalRangeParser implements Serializable { public EventRange parse(String dateRange) { return parse(null, null, null, dateRange); } @Builder(buildMethodName = "create") private  TemporalRangeParser(TemporalParser temporalParser); EventRange parse(String dateRange); EventRange parse(String year, String month, String day, String dateRange);  }