MessageHeaders { @Nullable static String getHeaderIfString(Message message, String name) { MessageProperties properties = message.getMessageProperties(); if (properties == null) return null; Object o = properties.getHeader(name); if (o instanceof String) return o.toString(); return null; }    }
@Test public void getHeaderIfString_noProperties() { message = new Message(new byte[0], null); assertThat(MessageHeaders.getHeaderIfString(message, "b3")) .isNull(); }
@Test public void getHeaderIfString() { message.getMessageProperties().setHeader("b3", "1"); assertThat(MessageHeaders.getHeaderIfString(message, "b3")) .isEqualTo("1"); }
@Test public void getHeaderIfString_null() { assertThat(MessageHeaders.getHeaderIfString(message, "b3")).isNull(); }