@Test
public void testEncodeDate() {

  Date now = new Date();
  assertEquals(4, encodeDate(now, Precision.Year).getValue().length());
  assertEquals(3, encodeDate(now, Precision.Day).getValue().split("-").length);
  assertEquals("2009-01-01T00:00:00Z".length(), encodeDate(now, Precision.Second).getValue().length());
  assertEquals(Opt.some(DublinCore.ENC_SCHEME_W3CDTF), encodeDate(now, Precision.Year).getEncodingScheme());
  // Test symmetry
  assertEquals(decodeDate(encodeDate(now, Precision.Second)), precisionSecond(now));
  assertEquals(decodeDate(encodeDate(createDate(1999, 3, 21, 14, 0, 0), Precision.Day)), precisionDay(createDate(
          1999, 3, 21, 14, 0, 0)));
  assertEquals("1724-04-22", encodeDate(createDate(1724, 4, 22, 18, 30, 0), Precision.Day).getValue());
  assertEquals("1724-04-22T18:30:00Z", encodeDate(createDate(1724, 4, 22, 18, 30, 0, "UTC"), Precision.Second)
          .getValue());
  assertEquals("1724-04-22T17:30:10Z", encodeDate(createDate(1724, 4, 22, 17, 30, 10, "UTC"), Precision.Second)
          .getValue());
  assertEquals("1724-04-22T17:30Z", encodeDate(createDate(1724, 4, 22, 17, 30, 25, "UTC"), Precision.Minute)
          .getValue());
  assertEquals("1999-03-21", encodeDate(createDate(1999, 3, 21, 18, 30, 25), Precision.Day).getValue());
  //
  logger.info(encodeDate(now, Precision.Day).getValue());
  logger.info(encodeDate(now, Precision.Second).getValue());
}