@Override
            public boolean equals(Object o) {
                if (this == o) return true;
                if (o == null || getClass() != o.getClass()) return false;

                RecordAndMetadata that = (RecordAndMetadata) o;

                if (offset != that.offset) return false;
                if (producerId != that.producerId) return false;
                if (producerEpoch != that.producerEpoch) return false;
                return Objects.equals(record, that.record);
            }
A simple Coordinator implementation that stores the records into a set.
group-coordinator/src/test/java/org/apache/kafka/coordinator/group/runtime/CoordinatorRuntimeTest.java