MessageHeaders { static void setHeader(Message message, String name, String value) { MessageProperties properties = message.getMessageProperties(); if (properties == null) return; properties.setHeader(name, value); }    }
@Test public void setHeader_noProperties() { message = new Message(new byte[0], null); MessageHeaders.setHeader(message, "b3", "1"); }
@Test public void setHeader() { MessageHeaders.setHeader(message, "b3", "1"); assertThat((String) message.getMessageProperties().getHeader("b3")) .isEqualTo("1"); }
@Test public void setHeader_replace() { message.getMessageProperties().setHeader("b3", (byte) 0); MessageHeaders.setHeader(message, "b3", "1"); assertThat((String) message.getMessageProperties().getHeader("b3")) .isEqualTo("1"); }