public Command create(
      final ConfiguredStatement<? extends Statement> statement,
      final KsqlExecutionContext context) {
    return create(statement, context.getServiceContext(), context);
  }
@Test
  public void shouldFailTerminateSourceTableQuery() {
    // Given:
    configuredStatement = configuredStatement("TERMINATE X", terminateQuery);
    when(terminateQuery.getQueryId()).thenReturn(Optional.of(QUERY_ID));
    when(executionContext.getPersistentQuery(QUERY_ID)).thenReturn(Optional.of(query1));
    when(query1.getPersistentQueryType())
        .thenReturn(KsqlConstants.PersistentQueryType.CREATE_SOURCE);

    // When:
    final Exception e = assertThrows(
        KsqlStatementException.class,
        () -> commandFactory.create(configuredStatement, executionContext)
    );

    // Then:
    assertThat(e.getMessage(), containsString(
        "Cannot terminate query 'FOO' because it is linked to a source table"));
    verify(query1, times(0)).close();
  }