KafkaHeaders { @Nullable static String lastStringHeader(Headers headers, String key) { Header header = headers.lastHeader(key); if (header == null || header.value() == null) return null; return new String(header.value(), UTF_8); } KafkaHeaders();   }
@Test public void lastStringHeader() { record.headers().add("b3", new byte[] {'1'}); assertThat(KafkaHeaders.lastStringHeader(record.headers(), "b3")) .isEqualTo("1"); }
@Test public void lastStringHeader_null() { assertThat(KafkaHeaders.lastStringHeader(record.headers(), "b3")).isNull(); }