parent
bbf61c74ab
commit
f207c0ed5c
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2002-2023 the original author or authors.
|
* Copyright 2002-2025 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2002-2024 the original author or authors.
|
* Copyright 2002-2025 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
@ -239,21 +239,22 @@ class MessageBuilderTests {
|
||||||
assertThat(message3.getHeaders().get("foo")).isEqualTo("bar3");
|
assertThat(message3.getHeaders().get("foo")).isEqualTo("bar3");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test // gh-34949
|
||||||
void buildReplyChannelHeaderMessage() {
|
void buildMessageWithReplyChannelHeader() {
|
||||||
MessageHeaderAccessor headerAccessor = new MessageHeaderAccessor();
|
MessageHeaderAccessor headerAccessor = new MessageHeaderAccessor();
|
||||||
MessageBuilder<?> messageBuilder = MessageBuilder.withPayload("payload").setHeaders(headerAccessor);
|
MessageBuilder<?> messageBuilder = MessageBuilder.withPayload("payload").setHeaders(headerAccessor);
|
||||||
|
|
||||||
headerAccessor.setHeader("replyChannel", "foo");
|
headerAccessor.setHeader(MessageHeaders.REPLY_CHANNEL, "foo");
|
||||||
Message<?> message1 = messageBuilder.build();
|
Message<?> message1 = messageBuilder.build();
|
||||||
|
assertThat(message1.getHeaders().get(MessageHeaders.REPLY_CHANNEL)).isEqualTo("foo");
|
||||||
|
|
||||||
headerAccessor.setHeader("hannel", 0);
|
headerAccessor.setHeader("hannel", 0);
|
||||||
Message<?> message2 = messageBuilder.build();
|
Message<?> message2 = messageBuilder.build();
|
||||||
|
|
||||||
assertThat(message1.getHeaders().get("replyChannel")).isEqualTo("foo");
|
|
||||||
assertThat(message2.getHeaders().get("hannel")).isEqualTo(0);
|
assertThat(message2.getHeaders().get("hannel")).isEqualTo(0);
|
||||||
|
|
||||||
assertThatIllegalArgumentException().isThrownBy(() -> headerAccessor.setHeader("replyChannel", 0));
|
assertThatIllegalArgumentException()
|
||||||
|
.isThrownBy(() -> headerAccessor.setHeader(MessageHeaders.REPLY_CHANNEL, 0))
|
||||||
|
.withMessage("'%s' header value must be a MessageChannel or String", MessageHeaders.REPLY_CHANNEL);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue