@Test
public void workflowDefinitionStatisticsConverterWorks() {

  Map<String, WorkflowDefinitionStatistics> stateStats = new HashMap<>();
  WorkflowDefinitionStatistics created = new WorkflowDefinitionStatistics();
  created.allInstances = 1;
  created.queuedInstances = 2;
  stateStats.put("created", created);
  WorkflowDefinitionStatistics inProgress = new WorkflowDefinitionStatistics();
  inProgress.allInstances = 3;
  inProgress.queuedInstances = 4;
  stateStats.put("inProgress", inProgress);
  WorkflowDefinitionStatistics executing = new WorkflowDefinitionStatistics();
  executing.allInstances = 5;
  stateStats.put("executing", executing);
  WorkflowDefinitionStatistics manual = new WorkflowDefinitionStatistics();
  manual.allInstances = 8;
  stateStats.put("manual", manual);
  WorkflowDefinitionStatistics finished = new WorkflowDefinitionStatistics();
  finished.allInstances = 9;
  stateStats.put("finished", finished);
  stateStats.put("unknown", new WorkflowDefinitionStatistics());
  Map<String, Map<String, WorkflowDefinitionStatistics>> stats = singletonMap("state", stateStats);
  WorkflowDefinitionStatisticsResponse response = converter.convert(stats);
  StateStatistics stateStatistics = response.stateStatistics.get("state");
  assertThat(stateStatistics.created.allInstances, is(1L));
  assertThat(stateStatistics.created.queuedInstances, is(2L));
  assertThat(stateStatistics.inProgress.allInstances, is(3L));
  assertThat(stateStatistics.inProgress.queuedInstances, is(4L));
  assertThat(stateStatistics.executing.allInstances, is(5L));
  assertThat(stateStatistics.manual.allInstances, is(8L));
  assertThat(stateStatistics.finished.allInstances, is(9L));
}