public TopicMessageDTO deserialize(ConsumerRecord<Bytes, Bytes> rec) {
    var message = new TopicMessageDTO();
    fillKey(message, rec);
    fillValue(message, rec);
    fillHeaders(message, rec);

    message.setPartition(rec.partition());
    message.setOffset(rec.offset());
    message.setTimestampType(mapToTimestampType(rec.timestampType()));
    message.setTimestamp(OffsetDateTime.ofInstant(Instant.ofEpochMilli(rec.timestamp()), UTC_ZONE_ID));

    message.setKeySize(getKeySize(rec));
    message.setValueSize(getValueSize(rec));
    message.setHeadersSize(getHeadersSize(rec));

    return masker.apply(message);
  }
@Test
  void dataMaskingAppliedOnDeserializedMessage() {
    UnaryOperator<TopicMessageDTO> maskerMock = mock();
    Serde.Deserializer deser = (headers, data) -> new DeserializeResult("test", STRING, Map.of());

    var recordDeser = new ConsumerRecordDeserializer("test", deser, "test", deser, "test", deser, deser, maskerMock);
    recordDeser.deserialize(new ConsumerRecord<>("t", 1, 1L, Bytes.wrap("t".getBytes()), Bytes.wrap("t".getBytes())));

    verify(maskerMock).apply(any(TopicMessageDTO.class));
  }