@Test
public void shouldPrintStatesKeyedOnWorkflowIdKey() throws IOException {

  final WorkflowId fooWorkflowId = WorkflowId.create("foo-component", "foo-workflow");
  final WorkflowId barWorkflowId = WorkflowId.create("bar-component", "bar-workflow");
  final WorkflowInstance fooWorkflowInstance = WorkflowInstance.create(fooWorkflowId, "foo-param");
  final WorkflowInstance barWorkflowInstance = WorkflowInstance.create(barWorkflowId, "bar-param");
  final RunStateData fooRunStateData = RunStateData.create(fooWorkflowInstance, "PREPARE",
      StateData.newBuilder().executionId("foo-e").build());
  final RunStateData barRunStateData = RunStateData.create(barWorkflowInstance, "RUNNING",
      StateData.newBuilder().executionId("bar-e").build());
  cliOutput.printStates(RunStateDataPayload.create(List.of(fooRunStateData, barRunStateData)));
  final Map<String, List<RunStateData>> expectedOutput = Map.of(
      fooWorkflowId.toKey(), List.of(fooRunStateData),
      barWorkflowId.toKey(), List.of(barRunStateData));
  final Map<String, List<RunStateData>> output = OBJECT_MAPPER.readValue(outContent.toString(),
      new TypeReference<Map<String, List<RunStateData>>>() { });
  assertThat(output, is(expectedOutput));
}