### Question:
ConsumerOffsetClient implements Closeable { public long getCommittedOffset(TopicPartition topicPartition) { if (topicPartition == null) throw new IllegalArgumentException("topicPartition cannot be null"); OffsetAndMetadata offsetAndMetadata = consumer.committed(topicPartition); return offsetAndMetadata == null ? -1L : offsetAndMetadata.offset(); } 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 getCommittedOffset() { when(consumer.committed(new TopicPartition("topic", 0))).thenReturn(new OffsetAndMetadata(123L)); assertThat(client.getCommittedOffset(new TopicPartition("topic", 0)), is(123L)); }
@Test public void getCommittedOffset_noOffset() { assertThat(client.getCommittedOffset(new TopicPartition("topic", 0)), is(-1L)); }
@Test (expected = IllegalArgumentException.class) public void getCommittedOffset_nullTopicPartition() { client.getCommittedOffset(null); }