AfterPaneStateMachine extends TriggerStateMachine { @Override public void clear(TriggerContext c) throws Exception { c.state().access(ELEMENTS_IN_PANE_TAG).clear(); } private  AfterPaneStateMachine(int countElems); int getElementCount(); static AfterPaneStateMachine elementCountAtLeast(int countElems); @Override void onElement(OnElementContext c); @Override void prefetchOnMerge(MergingStateAccessor<?, ?> state); @Override void onMerge(OnMergeContext context); @Override void prefetchShouldFire(StateAccessor<?> state); @Override boolean shouldFire(TriggerStateMachine.TriggerContext context); @Override void clear(TriggerContext c); @Override boolean isCompatible(TriggerStateMachine other); @Override String toString(); @Override boolean equals(@Nullable Object obj); @Override int hashCode(); @Override void onFire(TriggerStateMachine.TriggerContext context);  }
@Test public void testClear() throws Exception { SimpleTriggerStateMachineTester<IntervalWindow> tester = TriggerStateMachineTester.forTrigger( AfterPaneStateMachine.elementCountAtLeast(2), FixedWindows.of(Duration.millis(10))); tester.injectElements(1, 2, 3); IntervalWindow window = new IntervalWindow(new Instant(0), new Instant(10)); tester.clearState(window); tester.assertCleared(window); }