PersistentStateManager implements StateManager { @Override public Optional<RunState> getActiveState(WorkflowInstance workflowInstance) { try { return storage.readActiveState(workflowInstance); } catch (IOException e) { throw new RuntimeException(e); } } PersistentStateManager(
      Time time,
      ExecutorService executor,
      Storage storage,
      BiConsumer<SequenceEvent, RunState> eventConsumer,
      Executor eventConsumerExecutor,
      OutputHandler outputHandler,
      ShardedCounter shardedCounter);   PersistentStateManager(
      Time time,
      ExecutorService executor,
      Storage storage,
      BiConsumer<SequenceEvent, RunState> eventConsumer,
      Executor eventConsumerExecutor,
      OutputHandler outputHandler,
      ShardedCounter shardedCounter,
      Logger logger); @Override void tick(); @Override void trigger(WorkflowInstance workflowInstance, Trigger trigger, TriggerParameters parameters); @Override void receive(Event event); @Override void receive(Event event, long expectedCounter); @Override Set<WorkflowInstance> listActiveInstances(); @Override Map<WorkflowInstance, RunState> getActiveStates(); @Override Map<WorkflowInstance, RunState> getActiveStatesByTriggerId(String triggerId); @Override Optional<RunState> getActiveState(WorkflowInstance workflowInstance); @Override void close();  }
@Test public void shouldGetRunState() throws Exception { RunState runState = RunState.create( INSTANCE, State.QUEUED, StateData.zero(), NOW.minusMillis(1), 17); when(storage.readActiveState(INSTANCE)).thenReturn(Optional.of(runState)); RunState returnedRunState = stateManager.getActiveState(INSTANCE).orElseThrow(); assertThat(runState, equalTo(returnedRunState)); }