SlidingWindows extends NonMergingWindowFn<Object, IntervalWindow> { @Override public void verifyCompatibility(WindowFn<?, ?> other) throws IncompatibleWindowException { if (!this.isCompatible(other)) { throw new IncompatibleWindowException( other, String.format( "Only %s objects with the same size, period and offset are compatible.", SlidingWindows.class.getSimpleName())); } } private  SlidingWindows(Duration period, Duration size, Duration offset); static SlidingWindows of(Duration size); SlidingWindows every(Duration period); SlidingWindows withOffset(Duration offset); @Override Coder<IntervalWindow> windowCoder(); @Override Collection<IntervalWindow> assignWindows(AssignContext c); Collection<IntervalWindow> assignWindows(Instant timestamp); @Override WindowMappingFn<IntervalWindow> getDefaultWindowMappingFn(); @Override boolean isCompatible(WindowFn<?, ?> other); @Override boolean assignsToOneWindow(); @Override void verifyCompatibility(WindowFn<?, ?> other); @Override void populateDisplayData(DisplayData.Builder builder); Duration getPeriod(); Duration getSize(); Duration getOffset(); @Experimental(Kind.OUTPUT_TIME) @Override Instant getOutputTime(Instant inputTimestamp, IntervalWindow window); @Override boolean equals(@Nullable Object object); @Override int hashCode();  }
@Test public void testVerifyCompatibility() throws IncompatibleWindowException { SlidingWindows.of(new Duration(10)).verifyCompatibility(SlidingWindows.of(new Duration(10))); thrown.expect(IncompatibleWindowException.class); SlidingWindows.of(new Duration(10)).verifyCompatibility(SlidingWindows.of(new Duration(20))); }