@Override
  public void validateTransientQuery(
      final SessionConfig config,
      final ExecutionPlan executionPlan,
      final Collection<QueryMetadata> runningQueries
  ) {
    validateCacheBytesUsage(
        runningQueries.stream()
            .filter(q -> q instanceof TransientQueryMetadata)
            .collect(Collectors.toList()),
        config,
        config.getConfig(false)
            .getLong(KsqlConfig.KSQL_TOTAL_CACHE_MAX_BYTES_BUFFERING_TRANSIENT)
    );
  }
@Test
  public void shouldLimitBufferCacheLimitForTransientQueries() {
    // Given:
    final SessionConfig config = configWithLimitsTransient(5, OptionalLong.of(30));

    // When/Then:
    assertThrows(
        KsqlException.class,
        () -> queryValidator.validateTransientQuery(config, plan, queries)
    );
  }