Пример #1
0
 @Test
 public void testGetEncode() {
   LOG.trace(">testGetEncode");
   // Test relative times (<Integer.MAX_VALUE)
   Assert.assertEquals("", 0, ValidityDate.encode(ValidityDate.getString(0)));
   Assert.assertEquals("", 1, ValidityDate.encode(ValidityDate.getString(1)));
   // Test absolute times (>Integer.MAX_VALUE)
   final long nowWithOutSeconds = (new Date().getTime() / 60000) * 60000;
   Assert.assertEquals(
       "", nowWithOutSeconds, ValidityDate.encode(ValidityDate.getString(nowWithOutSeconds)));
   LOG.trace("<testGetEncode");
 }
Пример #2
0
 @Test
 public void testEncodeGet() throws ParseException {
   LOG.trace(">testEncodeGet");
   Assert.assertEquals(
       "",
       ValidityDate.parseAsIso8601("2011-05-09 16:58:00+00:00"),
       ValidityDate.parseAsIso8601(
           ValidityDate.getString(ValidityDate.encode("2011-05-09 16:58:00+00:00"))));
   Assert.assertEquals(
       "",
       ValidityDate.parseAsIso8601("1970-01-25 20:32:00+00:00"),
       ValidityDate.parseAsIso8601(
           ValidityDate.getString(ValidityDate.encode("1970-01-25 20:32:00+00:00"))));
   LOG.trace("<testEncodeGet");
 }
Пример #3
0
 private void getStringInternalAbs(final long subject, final String result) throws ParseException {
   Assert.assertEquals(
       "Failed to fetch absolute time for " + subject,
       ValidityDate.parseAsIso8601(result),
       ValidityDate.parseAsIso8601(ValidityDate.getString(subject)));
 }
Пример #4
0
 private void getStringInternalRel(final long subject, final String result) throws ParseException {
   Assert.assertEquals(
       "Failed to fetch relative time for " + subject, result, ValidityDate.getString(subject));
 }