IdGeneratorService { public long getTimestamp(long id) { return ((id >> timestampLeftShift) + epoch); }  synchronized long generate(int shardId); int getShard(long id); long getTimestamp(long id); HashCode getHash(long id);  }
@Test public void getTimestamp() { long mills = currentTimeMillis(); IdGeneratorService idGeneratorService = new IdGeneratorService(); long id = idGeneratorService.generate(1); assertEquals(idGeneratorService.getTimestamp(id), mills); }