@Test
public void testClockDecoration() {

    final long now = System.currentTimeMillis();
    DeviceClock ref = new DeviceClock()
    {
        @Override
        public Reading instant() {
            return new DeviceClock.ReadingImpl(now);
        }
    };
    DeviceClock epoch = new DeviceClock()
    {
        @Override
        public Reading instant() {
            return new DeviceClock.ReadingImpl(0);
        }
    };
    DeviceClock.Reading r = new DeviceClock.CombinedReading(ref.instant(), epoch.instant());
    Assert.assertEquals("combined reading should return the reference time", r.getTime(), Instant.ofEpochMilli(now));
    Assert.assertTrue("combined reading must contain device time", r.hasDeviceTime());
    Assert.assertEquals("invalid value for device time", r.getDeviceTime(), Instant.ofEpochMilli(0));
}