StateContexts { public static <W extends BoundedWindow> StateContext<W> windowOnlyContext(W window) { return new WindowOnlyContext<>(window); }  @SuppressWarnings("unchecked") static StateContext<W> nullContext(); static StateContext<W> windowOnlyContext(W window);  }
@Test public void windowOnlyContextThrowsOnOptions() { BoundedWindow window = new IntervalWindow(new Instant(-137), Duration.millis(21L)); StateContext<BoundedWindow> context = StateContexts.windowOnlyContext(window); thrown.expect(IllegalArgumentException.class); context.getPipelineOptions(); }
@Test public void windowOnlyContextThrowsOnSideInput() { BoundedWindow window = new IntervalWindow(new Instant(-137), Duration.millis(21L)); StateContext<BoundedWindow> context = StateContexts.windowOnlyContext(window); thrown.expect(IllegalArgumentException.class); context.sideInput(view); }
@Test public void windowOnlyContextWindowReturnsWindow() { BoundedWindow window = new IntervalWindow(new Instant(-137), Duration.millis(21L)); StateContext<BoundedWindow> context = StateContexts.windowOnlyContext(window); assertThat(context.window(), equalTo(window)); }