@Test
public void testCopy() {
WindowInternal<Object, Object, Collection> window = new WindowInternal<Object, Object, Collection>(
defaultTrigger, supplierFunction, foldFn, keyFn, timeFn, WindowType.SESSION, null,
mock(Serde.class), mock(Serde.class));
window.setEarlyTrigger(earlyTrigger);
WindowOperatorSpec<Object, Object, Collection> spec = new WindowOperatorSpec<>(window, "w0");
WindowOperatorSpec<Object, Object, Collection> copy =
(WindowOperatorSpec<Object, Object, Collection>) OperatorSpecTestUtils.copyOpSpec(spec);
Assert.assertNotEquals(spec, copy);
Assert.assertTrue(spec.isClone(copy));
Assert.assertNotEquals(spec.getWindow(), copy.getWindow());
Assert.assertNotEquals(copy.getWindow().getInitializer(), supplierFunction);
assertEquals(copy.getWindow().getInitializer().get(), supplierFunction.get());
Assert.assertNotEquals(copy.getWindow().getFoldLeftFunction(), foldFn);
Object mockMsg = new Object();
assertEquals(copy.getWindow().getFoldLeftFunction().apply(mockMsg, new ArrayList<>()), foldFn.apply(mockMsg, new ArrayList<>()));
Assert.assertNotEquals(copy.getWindow().getKeyExtractor(), keyFn);
assertEquals(copy.getWindow().getKeyExtractor().apply(mockMsg), keyFn.apply(mockMsg));
Assert.assertNotEquals(copy.getWindow().getEventTimeExtractor(), timeFn);
assertEquals(copy.getWindow().getEventTimeExtractor().apply(mockMsg), timeFn.apply(mockMsg));
assertEquals(copy.getDefaultTriggerMs(), 150);
}