@Test
public void testFilterActiveStatesOnComponent() throws Exception {

  sinceVersion(Api.Version.V3);
  WorkflowInstance OTHER_WFI =
      WorkflowInstance.create(WorkflowId.create(C_ID_1 + "-other", WF_ID_1), PARAMETER);
  storage.writeActiveState(WFI_1, PERSISTENT_STATE_1);
  storage.writeActiveState(OTHER_WFI, PERSISTENT_STATE_2);
  storage.writeActiveState(WFI_3, PERSISTENT_STATE_3);
  assertThat(storage.readActiveStates().entrySet(), hasSize(3));
  Response<ByteString> response =
      awaitResponse(serviceHelper.request("GET", path("/activeStates?component=" + C_ID_1)));
  assertThat(response, hasStatus(withCode(Status.OK)));
  String json = response.payload().orElseThrow().utf8();
  RunStateDataPayload
      parsed = Json.OBJECT_MAPPER.readValue(json, RunStateDataPayload.class);
  assertThat(parsed.activeStates(), hasSize(2));
  assertThat(parsed.activeStates().get(0).workflowInstance().workflowId().componentId(), is(C_ID_1));
  assertThat(parsed.activeStates().get(0).workflowInstance().workflowId().id(), is(WF_ID_2));
  assertThat(parsed.activeStates().get(1).workflowInstance().workflowId().componentId(), is(C_ID_1));
  assertThat(parsed.activeStates().get(1).workflowInstance().workflowId().id(), is(WF_ID_1));
}