public static WindowStoreIterator<ValueAndTimestamp<GenericRow>> fetch(
      final ReadOnlyWindowStore<GenericKey, ValueAndTimestamp<GenericRow>> store,
      final GenericKey key,
      final Instant lower,
      final Instant upper
  ) {
    Objects.requireNonNull(key, "key can't be null");
    final List<ReadOnlyWindowStore<GenericKey, ValueAndTimestamp<GenericRow>>> stores
            = getStores(store);
    final Function<ReadOnlyWindowStore<GenericKey, ValueAndTimestamp<GenericRow>>,
            WindowStoreIterator<ValueAndTimestamp<GenericRow>>> fetchFunc = windowStore ->
            fetchUncached(windowStore, key, lower, upper);
    return findFirstNonEmptyIterator(stores, fetchFunc);
  }
@Test
  public void shouldThrowException_wrongStateStore() {
    when(provider.stores(any(), any())).thenReturn(ImmutableList.of(windowStore));

    final Exception e = assertThrows(
        IllegalStateException.class,
        () -> WindowStoreCacheBypass.fetch(store, SOME_KEY,
            Instant.ofEpochMilli(100), Instant.ofEpochMilli(200))
    );

    assertThat(e.getMessage(), containsString("Expecting a MeteredWindowStore"));
  }