@Ignore("todo: Import the latest changes to enable the below test case.")
  public void itestRenderAbbreviations() throws Exception {
    // Following method is available in the latest version of XMPDateTime
    // class.
    // todo: Import the latest version from the Granite's build.
    // XMPDateTime dt = XMPDateTimeFactory.create();
    XMPDateTime dt = new XMPDateTimeImpl();
    assertEquals("", ISO8601Converter.render(dt));

    dt.setYear(2010);
    assertEquals("2010", ISO8601Converter.render(dt));

    dt.setMonth(9);
    assertEquals("2010-09", ISO8601Converter.render(dt));

    dt.setDay(30);
    assertEquals("2010-09-30", ISO8601Converter.render(dt));

    // Note: hours and minutes are always rendered together
    dt.setHour(23);
    assertEquals("2010-09-30T23:00", ISO8601Converter.render(dt));

    dt.setMinute(58);
    assertEquals("2010-09-30T23:58", ISO8601Converter.render(dt));

    dt.setSecond(59);
    assertEquals("2010-09-30T23:58:59", ISO8601Converter.render(dt));

    dt.setNanoSecond(999 * 1000000);
    assertEquals("2010-09-30T23:58:59.999", ISO8601Converter.render(dt));

    dt.setTimeZone(TimeZone.getTimeZone("Egypt"));
    assertEquals("2010-09-30T23:58:59.999+02:00", ISO8601Converter.render(dt));
  }
  /**
   * Test date variants:
   *
   * <ul>
   *   <li>YYYY
   *   <li>YYYY-MM
   *   <li>YYYY-MM-DD
   *   <li>YYYY-MM-DDThh:mm (according to our spec, this also allowed, even if not allowed in
   *       ISO8601)
   *   <li>YYYY-MM-DDThh:mmTZD
   *   <li>YYYY-MM-DDThh:mm:ssTZD
   *   <li>YYYY-MM-DDThh:mm:ss.sTZD
   * </ul>
   *
   * @throws Exception Forward test exceptions
   */
  public void testRender() throws Exception {
    XMPDateTime dt = XMPDateTimeFactory.create(2006, 12, 31, 23, 59, 59, 987654321);
    dt.setTimeZone(TimeZone.getTimeZone("UTC"));
    assertEquals("2006-12-31T23:59:59.987654321Z", ISO8601Converter.render(dt));

    dt.setNanoSecond(0);
    assertEquals("2006-12-31T23:59:59Z", ISO8601Converter.render(dt));

    dt.setSecond(0);
    assertEquals("2006-12-31T23:59Z", ISO8601Converter.render(dt));

    dt.setMinute(0);
    assertEquals("2006-12-31T23:00Z", ISO8601Converter.render(dt));

    // Following method is available in the latest version of
    // XMPDateTimeFactory class.
    // todo: Import the latest version from the Granite's build.
    // dt = XMPDateTimeFactory.create(2006, 12, 31);
    // assertEquals("2006-12-31", ISO8601Converter.render(dt));

    dt.setHour(0);
    dt.setTimeZone(TimeZone.getTimeZone("Asia/Dushanbe"));
    assertEquals("2006-12-31T00:00+05:00", ISO8601Converter.render(dt));

    dt.setTimeZone(new SimpleTimeZone(-8000000, ""));
    assertEquals("2006-12-31T00:00-02:13", ISO8601Converter.render(dt));
  }
  /**
   * Tests the parsing of an ISO8601 formatted date
   *
   * @throws Exception Forwards all exceptions to JUnit.
   */
  @Ignore("todo: Import the latest changes to enable the below test case.")
  public void itestParse() throws Exception {
    GregorianCalendar cal = new GregorianCalendar(2006, 05, 30, 23, 59, 54);
    cal.set(Calendar.MILLISECOND, 321);
    cal.setTimeZone(TimeZone.getTimeZone("UTC"));
    XMPDateTime dt = XMPDateTimeFactory.createFromCalendar(cal);
    XMPDateTime parsed = ISO8601Converter.parse("2006-06-30T23:59:54.321Z");
    assertEquals(0, dt.compareTo(parsed));

    cal.set(Calendar.MILLISECOND, 0);
    dt = XMPDateTimeFactory.createFromCalendar(cal);
    assertEquals(0, dt.compareTo(ISO8601Converter.parse("2006-06-30T23:59:54Z")));

    cal.set(Calendar.SECOND, 0);
    dt = XMPDateTimeFactory.createFromCalendar(cal);
    assertEquals(0, dt.compareTo(ISO8601Converter.parse("2006-06-30T23:59Z")));

    cal.set(Calendar.HOUR_OF_DAY, 0);
    dt = XMPDateTimeFactory.createFromCalendar(cal);
    assertEquals(0, dt.compareTo(ISO8601Converter.parse("2006-06-30T00:59Z")));

    cal.set(Calendar.MINUTE, 0);
    dt = XMPDateTimeFactory.createFromCalendar(cal);
    assertEquals(0, dt.compareTo(ISO8601Converter.parse("2006-06-30T00:00Z")));

    // Issue reported by S7, dates w/o timezone have to be accepted
    // toDo: Import latest version to run the following test
    // dt = ISO8601Converter.parse("2006-10-13T17:45:26.16");
    // assertEquals("2006-10-13T17:45:26.16", dt.toString());

    dt = ISO8601Converter.parse("2006-10-13T17:45:26.16Z");
    assertEquals("2006-10-13T17:45:26.16Z", dt.toString());

    dt = ISO8601Converter.parse("2006-10-13T17:45:26");
    assertEquals("2006-10-13T17:45:26", dt.toString());

    dt = ISO8601Converter.parse("2006-10-13T17:45:26+5:30");
    assertEquals("2006-10-13T17:45:26+05:30", dt.toString());

    dt = ISO8601Converter.parse("2006-10-13T17:45");
    assertEquals("2006-10-13T17:45", dt.toString());

    dt = ISO8601Converter.parse("2006-10-13T17:45-06");
    assertEquals("2006-10-13T17:45-06:00", dt.toString());

    dt = ISO8601Converter.parse("2006-10-13T17");
    assertEquals("2006-10-13T17:00", dt.toString());

    dt = ISO8601Converter.parse("2006-10-13T17Z");
    assertEquals("2006-10-13T17:00Z", dt.toString());

    dt = ISO8601Converter.parse("2006-10-13T17-03:00");
    assertEquals("2006-10-13T17:00-03:00", dt.toString());

    dt = ISO8601Converter.parse("2006-10-13");
    assertEquals("2006-10-13", dt.toString());
  }