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

    final Exception e = assertThrows(
        IllegalStateException.class,
        () -> SessionStoreCacheBypass.fetch(store, SOME_KEY)
    );

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