package org.gbif.registry.doi.util;

import org.junit.Test;

import java.util.Date;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNull;

public class RegistryDoiUtilsTest {

  @Test
  public void testGetYear() {
    // given
    Date date = new Date(1418340702253L);

    // when
    String actualNonNull = RegistryDoiUtils.getYear(date);
    String actualNull = RegistryDoiUtils.getYear(null);

    // then
    assertEquals("2014", actualNonNull);
    assertNull(actualNull);
  }

  @Test
  public void testFdate() {
    // given
    Date date = new Date(1418340702253L);

    // when
    String actual = RegistryDoiUtils.fdate(date);

    // then
    assertEquals("2014-12-12", actual);
  }
}

@@ -54,16 +54,103 @@
 .Test;%0A%0A
+import java.time.Instant;%0Aimport java.time.LocalDateTime;%0Aimport java.time.ZoneOffset;%0A
 import j
@@ -656,43 +656,130 @@
     
-Date date = new Date(1418340702253L
+Instant instant = LocalDateTime.of(2014, 12, 12, 0, 0)%0A      .toInstant(ZoneOffset.UTC);%0A    Date date = Date.from(instant
 );%0A%0A

Fix RegistryDoiUtilsTest date problem