WallClock implements Clock { @Override public Optional<Long> currentTimeMillis(JSONObject message) { return Optional.of(System.currentTimeMillis()); }  @Override Optional<Long> currentTimeMillis(JSONObject message);  }
@Test public void testCurrentTimeMillis() { JSONObject message = createMessage(); long before = System.currentTimeMillis(); WallClock clock = new WallClock(); Optional<Long> result = clock.currentTimeMillis(message); long after = System.currentTimeMillis(); assertTrue(result.isPresent()); assertTrue(result.get() >= before); assertTrue(result.get() <= after); }