### Question:
ConsumerGroupOffsetsState { public ConsumerGroupOffsets snapshot() { Map<ConsumerThreadKey, ConsumerClientOffsets> offsetsGroupedByThread = new HashMap<>(); for (Tuple<ConsumerThreadKey, ConsumerLogOffsets> tuple : offsets.values()) { ConsumerClientOffsets consumerClientOffsets = offsetsGroupedByThread.computeIfAbsent( tuple.left(), ConsumerClientOffsets::new ); consumerClientOffsets.update(tuple.right()); } return new ConsumerGroupOffsets(group, new HashSet<>(offsetsGroupedByThread.values())); } ConsumerGroupOffsetsState(final String group); ConsumerGroupOffsets snapshot(); void update(final TopicPartition tp,
                       final ConsumerThreadKey consumerThreadKey,
                       final Function<ConsumerLogOffsets, ConsumerLogOffsets> updater); @Override boolean equals(Object o); @Override int hashCode();  }### Answer:
@Test public void shouldGetConsumerGroupOffsetsWhenCallingSnapshot() { final ConsumerGroupOffsetsState state = new ConsumerGroupOffsetsState("test-group"); ConsumerGroupOffsets snapshot = state.snapshot(); assertNotNull(snapshot); assertEquals(TEST_GROUP, snapshot.group()); assertTrue(snapshot.consumers().isEmpty()); }