DateConverter { public static Date fromTimestamp(final long timestamp) { return timestamp != EMPTY_TIMESTAMP ? new Date(timestamp) : null; } private  DateConverter(); static Long[][] encode(final Collection<Date> dates); static Long encode(final Date date); static Date decode(final long timestamp); static long toTimestamp(final Date date); static Date fromTimestamp(final long timestamp);  }
@Test public void testFromTimestamp() { final int expectedTimestamp = 123; final Date date = DateConverter.fromTimestamp(expectedTimestamp); assertEquals(new Date(expectedTimestamp), date); assertNull(DateConverter.fromTimestamp(-1)); }