### Question:
ConsumerOffsetClient implements Closeable { @Override public void close() { if (!providedByUser) IOUtils.closeQuietly(consumer); } ConsumerOffsetClient(Properties properties);  ConsumerOffsetClient(Consumer<Object, Object> consumer);   ConsumerOffsetClient(Consumer<Object, Object> consumer, boolean providedByUser); Map<TopicPartition, Long> getEndOffsets(Collection<String> topics); Map<TopicPartition, Long> getBeginningOffsets(Collection<String> topics); Map<TopicPartition, Long> getOffsetsForTimes(Collection<String> topics, long time); Map<TopicPartition, Long> getCommittedOffsets(Collection<String> topics); void commitOffsets(Map<TopicPartition, Long> offsets); long getCommittedOffset(TopicPartition topicPartition); Collection<TopicPartition> getPartitionsFor(Collection<String> topics); @Override void close();  }### Answer:
@Test public void close_providedByConsumer() throws IOException { client.close(); verify(consumer, never()).close(); }
@Test public void close_notProvidedByConsumer() throws IOException { client = new ConsumerOffsetClient(consumer, false); client.close(); verify(consumer).close(); }