コード例 #1
0
  @Test
  public void copyHeadersNullMap() {
    MessageHeaderAccessor headers = new MessageHeaderAccessor();
    headers.copyHeaders(null);
    headers.copyHeadersIfAbsent(null);

    assertEquals(0, headers.toMap().size());
  }
コード例 #2
0
  @Test
  public void wrapMessage() {
    Map<String, Object> original = new HashMap<>();
    original.put("foo", "bar");
    original.put("bar", "baz");
    GenericMessage<String> message = new GenericMessage<>("p", original);

    MessageHeaderAccessor headers = new MessageHeaderAccessor(message);
    Map<String, Object> actual = headers.toMap();

    assertEquals(4, actual.size());
    assertNotNull(actual.get(MessageHeaders.ID));
    assertNotNull(actual.get(MessageHeaders.TIMESTAMP));
    assertEquals("bar", actual.get("foo"));
    assertEquals("baz", actual.get("bar"));
  }
コード例 #3
0
 @Test
 public void empty() {
   MessageHeaderAccessor headers = new MessageHeaderAccessor();
   assertEquals(Collections.emptyMap(), headers.toMap());
 }