@Override
  public void validateQuery(
      final SessionConfig config,
      final ExecutionPlan executionPlan,
      final Collection<QueryMetadata> runningQueries
  ) {
    validateCacheBytesUsage(
        runningQueries.stream()
            .filter(q -> q instanceof PersistentQueryMetadata)
            .collect(Collectors.toList()),
        config,
        config.getConfig(false)
            .getLong(KsqlConfig.KSQL_TOTAL_CACHE_MAX_BYTES_BUFFERING)
    );
  }
@Test
  public void shouldValidateSharedRuntimes() {
    // Given:
    final SessionConfig config = SessionConfig.of(
        new KsqlConfig(ImmutableMap.of(KsqlConfig.KSQL_TOTAL_CACHE_MAX_BYTES_BUFFERING, 50,
        KsqlConfig.KSQL_SHARED_RUNTIME_ENABLED, true)),
        ImmutableMap.of(StreamsConfig.CACHE_MAX_BYTES_BUFFERING_CONFIG, 10)
    );

    // When/Then:
    queryValidator.validateQuery(config, plan, queries);
  }