WindmillTimeUtils { public static @Nullable Instant windmillToHarnessWatermark(long watermarkUs) { if (watermarkUs == Long.MIN_VALUE) { return null; } else { return windmillToHarnessTimestamp(watermarkUs); } }  static @Nullable Instant windmillToHarnessWatermark(long watermarkUs); static Instant windmillToHarnessTimestamp(long timestampUs); static long harnessToWindmillTimestamp(Instant timestamp);  }
@Test public void testWindmillToHarnessWatermark() { assertEquals(null, windmillToHarnessWatermark(Long.MIN_VALUE)); assertEquals(BoundedWindow.TIMESTAMP_MAX_VALUE, windmillToHarnessWatermark(Long.MAX_VALUE)); assertEquals( BoundedWindow.TIMESTAMP_MAX_VALUE, windmillToHarnessWatermark(Long.MAX_VALUE - 17)); assertEquals(new Instant(16), windmillToHarnessWatermark(16999)); assertEquals(new Instant(17), windmillToHarnessWatermark(17120)); assertEquals(new Instant(17), windmillToHarnessWatermark(17000)); assertEquals(new Instant(-17), windmillToHarnessWatermark(-16987)); assertEquals(new Instant(-17), windmillToHarnessWatermark(-17000)); assertEquals(new Instant(-18), windmillToHarnessTimestamp(-17001)); }