TransactionalInstanceState implements InstanceState<T> { @Override public Optional<String> getValue(final String key) { return parent.getValue(key); } 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 delegatesValues() { final String key = UUID.randomUUID() .toString(); final String value = UUID.randomUUID() .toString(); final InstanceState<String> parent = mock(InstanceState.class); when(parent.getValue(key)).thenReturn(Optional.of(value)); final TransactionalInstanceState<String> s = new TransactionalInstanceState<>(Collections.emptyList(), parent); assertThat(s.getValue(key)).contains(value); }