Ejemplo n.º 1
0
  // ------------------------------------------------------------------------
  // PARSE
  // ------------------------------------------------------------------------
  @Test
  public void parse() throws Exception {
    Calendar cal = CalendarUtils.parse("3/6/2007");
    assertMarch(6, 2007, cal);

    cal = CalendarUtils.parse("3-6-2007");
    assertMarch(6, 2007, cal);
  }
Ejemplo n.º 2
0
  // ------------------------------------------------------------------------
  // PARSE DATE RANGE
  // ------------------------------------------------------------------------
  @Test
  public void parse_dateRange() throws Exception {

    CalendarRange range = CalendarUtils.parseRange("foo bar 3/6/2007 to 3/6/2008 blah");
    assertMarch(6, 2007, range.getStartDate());
    assertMarch(6, 2008, range.getEndDate());

    range = CalendarUtils.parseRange("3-6-2007 - 3-8-2007");
    assertMarch(6, 2007, range.getStartDate());
    assertMarch(8, 2007, range.getEndDate());

    range = CalendarUtils.parseRange("3/6/2008");
    assertMarch(6, 2008, range.getStartDate());
    assertNull(range.getEndDate());

    range = CalendarUtils.parseRange("");
    assertNull(range.getStartDate());
    assertNull(range.getEndDate());

    range = CalendarUtils.parseRange(null);
    assertNull(range.getStartDate());
    assertNull(range.getEndDate());
  }
Ejemplo n.º 3
0
 @Test
 public void toString_basic() {
   assertNotNull(CalendarUtils.toString(CalendarUtils.december(29, 1981)));
   assertNotNull(CalendarUtils.toString(null));
 }