OrFinallyTrigger extends Trigger { @Override protected Trigger getContinuationTrigger(List<Trigger> continuationTriggers) { return Repeatedly.forever( new OrFinallyTrigger( continuationTriggers.get(ACTUAL), (Trigger.OnceTrigger) continuationTriggers.get(UNTIL))); } @VisibleForTesting  OrFinallyTrigger(Trigger actual, Trigger.OnceTrigger until); Trigger getMainTrigger(); OnceTrigger getUntilTrigger(); @Override Instant getWatermarkThatGuaranteesFiring(BoundedWindow window); @Override boolean mayFinish(); @Override String toString();  }
@Test public void testContinuation() throws Exception { OnceTrigger triggerA = AfterProcessingTime.pastFirstElementInPane(); OnceTrigger triggerB = AfterWatermark.pastEndOfWindow(); Trigger aOrFinallyB = triggerA.orFinally(triggerB); Trigger bOrFinallyA = triggerB.orFinally(triggerA); assertEquals( Repeatedly.forever( triggerA.getContinuationTrigger().orFinally(triggerB.getContinuationTrigger())), aOrFinallyB.getContinuationTrigger()); assertEquals( Repeatedly.forever( triggerB.getContinuationTrigger().orFinally(triggerA.getContinuationTrigger())), bOrFinallyA.getContinuationTrigger()); }