public void terminateCluster(final List<String> deleteTopicPatterns) {
    terminatePersistentQueries();
    deleteSinkTopics(deleteTopicPatterns);
    deleteTopics(managedTopics);
    ksqlEngine.close();
  }
@Test
  public void shouldCloseTheEngineAfterTerminatingPersistentQueries() {
    // When:
    clusterTerminator.terminateCluster(Collections.emptyList());

    // Then:
    final InOrder inOrder = Mockito.inOrder(persistentQuery0, ksqlEngine);
    inOrder.verify(persistentQuery0).close();
    inOrder.verify(ksqlEngine).close();
  }