@Test
public void testGetAllActiveStates() throws Exception {

  sinceVersion(Api.Version.V3);
  storage.writeActiveState(WFI_1, PERSISTENT_STATE_1);
  storage.writeActiveState(WFI_2, PERSISTENT_STATE_2);
  assertThat(storage.readActiveStates().entrySet(), hasSize(2));
  Response<ByteString> response =
      awaitResponse(serviceHelper.request("GET", path("/activeStates")));
  assertThat(response, hasStatus(withCode(Status.OK)));
  String json = response.payload().orElseThrow().utf8();
  RunStateDataPayload
      parsed = Json.OBJECT_MAPPER.readValue(json, RunStateDataPayload.class);
  assertThat(parsed.activeStates(), containsInAnyOrder(
      RunStateData.newBuilder()
          .workflowInstance(PERSISTENT_STATE_1.workflowInstance())
          .state(PERSISTENT_STATE_1.state().name())
          .stateData(PERSISTENT_STATE_1.data())
          .latestTimestamp(PERSISTENT_STATE_1.timestamp())
          .build(),
      RunStateData.newBuilder()
          .workflowInstance(PERSISTENT_STATE_2.workflowInstance())
          .state(PERSISTENT_STATE_2.state().name())
          .stateData(PERSISTENT_STATE_2.data())
          .latestTimestamp(PERSISTENT_STATE_2.timestamp())
          .build()
  ));
}