mirror of https://github.com/OpenIdentityPlatform/OpenDJ.git

matthew_swift
28.47.2010 f2160f4bd1c8ac67e5a86a6710d431e8932877f9
sdk/tests/unit-tests-testng/src/org/opends/sdk/schema/UTCTimeSyntaxTest.java
@@ -43,17 +43,6 @@
 */
public class UTCTimeSyntaxTest extends SyntaxTestCase
{
  /**
   * {@inheritDoc}
   */
  @Override
  protected Syntax getRule()
  {
    return Schema.getCoreSchema().getSyntax(SYNTAX_UTC_TIME_OID);
  }
  @Override
  @DataProvider(name = "acceptableValues")
  public Object[][] createAcceptableValues()
@@ -93,20 +82,31 @@
  /**
   * Tests the {@code createUTCTimeValue} and {@code decodeUTCTimeValue}
   * methods.
   *
   *
   * @throws Exception
   *           If an unexpected problem occurs.
   */
  @Test()
  public void testCreateAndDecodeUTCTimeValue() throws Exception
  {
    Date d = new Date();
    String timeValue = UTCTimeSyntaxImpl.createUTCTimeValue(d);
    Date decodedDate = UTCTimeSyntaxImpl.decodeUTCTimeValue(timeValue);
    final Date d = new Date();
    final String timeValue = UTCTimeSyntaxImpl.createUTCTimeValue(d);
    final Date decodedDate = UTCTimeSyntaxImpl.decodeUTCTimeValue(timeValue);
    // UTCTime does not have support for sub-second values, so we need
    // to make
    // sure that the decoded value is within 1000 milliseconds.
    assertTrue(Math.abs(d.getTime() - decodedDate.getTime()) < 1000);
  }
  /**
   * {@inheritDoc}
   */
  @Override
  protected Syntax getRule()
  {
    return Schema.getCoreSchema().getSyntax(SYNTAX_UTC_TIME_OID);
  }
}