Skip to content

Commit 1858176

Browse files
author
Tim Watson
committed
Refactor per-message-ttl tests for dead lettered messages
Ensure the expiration property has been correctly removed. Avoid modifying the global (static) MessageProperties.BASIC object during test run.
1 parent 8bd2f53 commit 1858176

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

test/src/com/rabbitmq/client/test/functional/DeadLetterExchange.java

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -179,8 +179,13 @@ public void testDeadLetterPerMessageTTLRemoved() throws Exception {
179179
channel.queueBind(TEST_QUEUE_NAME, "amq.direct", "test");
180180
channel.queueBind(DLQ, DLX, "test");
181181

182-
final BasicProperties props = MessageProperties.BASIC;
183-
props.setExpiration("100");
182+
final BasicProperties props =
183+
new BasicProperties() {{
184+
setContentType("application/octet-stream");
185+
setDeliveryMode(1);
186+
setPriority(0);
187+
setExpiration("100");
188+
}};
184189
publish(props, "test message");
185190

186191
// The message's expiration property should have been removed, thus
@@ -191,6 +196,7 @@ public void testDeadLetterPerMessageTTLRemoved() throws Exception {
191196
consumeN(DLQ, 1, new WithResponse() {
192197
@SuppressWarnings("unchecked")
193198
public void process(GetResponse getResponse) {
199+
assertNull(getResponse.getProps().getExpiration());
194200
Map<String, Object> headers = getResponse.getProps().getHeaders();
195201
assertNotNull(headers);
196202
ArrayList<Object> death = (ArrayList<Object>)headers.get("x-death");

0 commit comments

Comments
 (0)