### Question:
KafkaProducerPool implements Closeable { @Override public void close() throws IOException { writeLock.lock(); try { if (!shutdown) { shutdown = true; final Stream<Exception> exceptions = pool.values().stream() .flatMap(Collection::stream) .flatMap(producer -> { try { producer.close(); } catch (Exception e) { LOGGER.error("Could not close producer", e); return Stream.of(e); } return Stream.empty(); }); final Optional<Exception> exception = exceptions.findFirst(); if (exception.isPresent()) { throw new IOException(exception.get()); } } } finally { writeLock.unlock(); } } KafkaProducerPool(); Producer<K, V> getProducer(Properties properties); @Override void close(); static final String KAFKA_PRODUCER_CONCURRENCY; static final int DEFAULT_KAFKA_PRODUCER_CONCURRENCY_INT; static final String DEFAULT_KAFKA_PRODUCER_CONCURRENCY; }### Answer:
@Test public void closeEmptyPool() throws IOException { pool.close(); }