# Method temporal.api.workflowservice.v1.WorkflowService/ListWorkflowExecutions is unimplemented when using SDKTestWorkflowRule

**URL:** <https://community.temporal.io/t/method-temporal-api-workflowservice-v1-workflowservice-listworkflowexecutions-is-unimplemented-when-using-sdktestworkflowrule/4639>\
**Category:** Community Support\
**Tags:** java-sdk, testing\
**Created:** [May 6, 2022, 10:21am UTC](https://community.temporal.io/t/method-temporal-api-workflowservice-v1-workflowservice-listworkflowexecutions-is-unimplemented-when-using-sdktestworkflowrule/4639 "2022-05-06T10:21:14Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Elsi](https://avatars.discourse-cdn.com/v4/letter/e/b9bd4f/32.png) [@Elsi](https://community.temporal.io/u/Elsi)\
**Post date:** [May 6, 2022, 10:21am UTC](https://community.temporal.io/t/method-temporal-api-workflowservice-v1-workflowservice-listworkflowexecutions-is-unimplemented-when-using-sdktestworkflowrule/4639/1 "2022-05-06T10:21:14Z")

</div>

Hi! I’m using SDKTestWorkflowRule for workflow unit testing. I want to query the workflows by using the ListWorkflowExecutionsRequest/ListOpenWorkflowExecutionsResponse. I encounter this exception that says _WorkflowService/ListWorkflowExecutions is unimplemented_.

I tried using ListOpenWorkflowExecutionsRequest and I’m able to get all running/open workflows. The problem of using ListOpenWorkflowExecutionsRequest is I can’t query specific workflow (setQuery method).

What is the cause of the unimplemented method? Any help is much appreciated. Thanks!

---

<div class="post-metadata">

**Author:** ![tihomir](https://sea2.discourse-cdn.com/flex016/user_avatar/community.temporal.io/tihomir/32/6580_2.png) [@tihomir](https://community.temporal.io/u/tihomir)\
**Post date:** [May 6, 2022, 1:58pm UTC](https://community.temporal.io/t/method-temporal-api-workflowservice-v1-workflowservice-listworkflowexecutions-is-unimplemented-when-using-sdktestworkflowrule/4639/2 "2022-05-06T13:58:26Z")

</div>

`SDKTestWorkflowRule` is internal, in your tests you should use [TestWorkflowRule](https://github.com/temporalio/sdk-java/blob/master/temporal-testing/src/main/java/io/temporal/testing/TestWorkflowRule.java) for JUnit4 tests and can use [TestWorkflowExtension](https://github.com/temporalio/sdk-java/blob/master/temporal-testing/src/main/java/io/temporal/testing/TestWorkflowExtension.java) for JUnit5.

See for example tests [here](https://github.com/temporalio/samples-java/blob/main/src/test/java/io/temporal/samples/hello/HelloActivityExclusiveChoiceTest.java) and [here](https://github.com/temporalio/samples-java/blob/main/src/test/java/io/temporal/samples/hello/HelloActivityExclusiveChoiceJUnit5Test.java).

Which version of the Java SDK are you using?

---

<div class="post-metadata">

**Author:** ![Elsi](https://avatars.discourse-cdn.com/v4/letter/e/b9bd4f/32.png) [@Elsi](https://community.temporal.io/u/Elsi)\
**Post date:** [May 6, 2022, 2:33pm UTC](https://community.temporal.io/t/method-temporal-api-workflowservice-v1-workflowservice-listworkflowexecutions-is-unimplemented-when-using-sdktestworkflowrule/4639/3 "2022-05-06T14:33:21Z")

</div>

> [@tihomir](#):
>
> [TestWorkflowExtension](https://github.com/temporalio/sdk-java/blob/master/temporal-testing/src/main/java/io/temporal/testing/TestWorkflowExtension.java)

Oh, I see. Reason I came up trying to use `SDKTestWorkflowRule` because I want to check if an event exists in workflow history (i.e., signal event) by using the **`assertHistoryEvent(WorkflowExecution execution, EventType eventType)`** method.

Is there an equivalent of that functionality in the **TestWorkflowRule/TestWorkflowExtension**?

I’m using version 1.10.0 Java SDK.

---

<div class="post-metadata">

**Author:** ![tihomir](https://sea2.discourse-cdn.com/flex016/user_avatar/community.temporal.io/tihomir/32/6580_2.png) [@tihomir](https://community.temporal.io/u/tihomir)\
**Post date:** [May 6, 2022, 6:13pm UTC](https://community.temporal.io/t/method-temporal-api-workflowservice-v1-workflowservice-listworkflowexecutions-is-unimplemented-when-using-sdktestworkflowrule/4639/5 "2022-05-06T18:13:37Z")

</div>

You can implement this method yourself (and extend it if needed) pretty easily with TestWorkflowRule, for example:

```auto
public void assertHistoryEvent(
      TestWorkflowRule testWorkflowRule, WorkflowExecution execution, EventType eventType) {
    History history =
        testWorkflowRule
            .getTestEnvironment()
            .getWorkflowExecutionHistory(
                WorkflowExecution.newBuilder().setWorkflowId("testId").build())
            .getHistory();
    for (HistoryEvent event : history.getEventsList()) {
      if (eventType == event.getEventType()) {
        return;
      }
    }
    fail("No event of " + eventType + " found in the history");
  }

```

and can call it from within your tests given workflow id (and runid if you have it):

```auto
    assertHistoryEvent(
        testWorkflowRule,
        WorkflowExecution.newBuilder().setWorkflowId("testId").build(),
        EventType.EVENT_TYPE_WORKFLOW_EXECUTION_STARTED);

```

Opened feature request [here](https://github.com/temporalio/sdk-java/issues/1189) to have this added out of box in TestWorkflowRule if possible.

---

<div class="post-metadata">

**Author:** ![tihomir](https://sea2.discourse-cdn.com/flex016/user_avatar/community.temporal.io/tihomir/32/6580_2.png) [@tihomir](https://community.temporal.io/u/tihomir)\
**Post date:** [May 6, 2022, 6:26pm UTC](https://community.temporal.io/t/method-temporal-api-workflowservice-v1-workflowservice-listworkflowexecutions-is-unimplemented-when-using-sdktestworkflowrule/4639/7 "2022-05-06T18:26:54Z")

</div>

You can also get the JSON history for an execution:

`testWorkflowRule.getTestEnvironment().getWorkflowExecutionHistory(myExecution).toJson(true);`

and even do some complex checks using jq for example as well if needed.
