public W getStateWindow(W window) {
        return mapping.get(window);
    }
@Test
    void testRestoreFromState() throws Exception {
        @SuppressWarnings("unchecked")
        ListState<Tuple2<TimeWindow, TimeWindow>> mockState = mock(ListState.class);
        when(mockState.get())
                .thenReturn(
                        Lists.newArrayList(
                                new Tuple2<>(new TimeWindow(17, 42), new TimeWindow(42, 17)),
                                new Tuple2<>(new TimeWindow(1, 2), new TimeWindow(3, 4))));

        MergingWindowSet<TimeWindow> windowSet =
                new MergingWindowSet<>(
                        EventTimeSessionWindows.withGap(Time.milliseconds(3)), mockState);

        assertThat(windowSet.getStateWindow(new TimeWindow(17, 42)))
                .isEqualTo(new TimeWindow(42, 17));
        assertThat(windowSet.getStateWindow(new TimeWindow(1, 2))).isEqualTo(new TimeWindow(3, 4));
    }