public EndpointResponse getStatus(final String type, final String entity, final String action) {
    final CommandId commandId = new CommandId(type, entity, action);

    final Optional<CommandStatus> commandStatus = statementExecutor.getStatus(commandId);

    return commandStatus.map(EndpointResponse::ok)
        .orElseGet(() -> Errors.notFound("Command not found"));

  }
@Test
  public void testGetStatusNotFound() throws Exception {
    final StatusResource testResource = getTestStatusResource();
    final EndpointResponse response = testResource.getStatus(
        CommandId.Type.STREAM.name(), "foo", CommandId.Action.CREATE.name());
    assertThat(response.getStatus(), equalTo(NOT_FOUND.code()));
    assertThat(response.getEntity(), instanceOf(KsqlErrorMessage.class));
    final KsqlErrorMessage errorMessage = (KsqlErrorMessage)response.getEntity();
    assertThat(errorMessage.getErrorCode(), equalTo(Errors.ERROR_CODE_NOT_FOUND));
    assertThat(errorMessage.getMessage(), equalTo("Command not found"));
  }