TransactionalInstanceState implements InstanceState<T> { @Override public Stream<String> getKeys() { return parent.getKeys(); } TransactionalInstanceState(final Collection<Runnable> stateUpdates, final InstanceState<T> parent); @Override void update(final Consumer<StateModifier<T>> modifier); @Override void reset(final Consumer<StateModifier<T>> setter); @Override Optional<String> getValue(final String key); @Override Stream<String> getKeys();  }
@Test void delegatesKeys() { final InstanceState<String> parent = mock(InstanceState.class); when(parent.getKeys()).thenReturn(Stream.empty()); final TransactionalInstanceState<String> s = new TransactionalInstanceState<>(Collections.emptyList(), parent); assertThat(s.getKeys()).isSameAs(parent.getKeys()); }