/* * Copyright 2002-2017 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.springframework.amqp.core; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertTrue; import org.junit.Test; /** * @author Dave Syer * @author Artem Yakshin * */ public class MessagePropertiesTests { @Test public void testReplyTo() throws Exception { MessageProperties properties = new MessageProperties(); properties.setReplyTo("foo/bar"); assertEquals("bar", properties.getReplyToAddress().getRoutingKey()); } @Test public void testReplyToNullByDefault() throws Exception { MessageProperties properties = new MessageProperties(); assertEquals(null, properties.getReplyTo()); assertEquals(null, properties.getReplyToAddress()); } @Test public void testDelayHeader() { MessageProperties properties = new MessageProperties(); Integer delay = 100; properties.setDelay(delay); assertEquals(delay, properties.getHeaders().get(MessageProperties.X_DELAY)); properties.setDelay(null); assertFalse(properties.getHeaders().containsKey(MessageProperties.X_DELAY)); } @Test public void testContentLengthSet() { MessageProperties properties = new MessageProperties(); properties.setContentLength(1L); assertTrue(properties.isContentLengthSet()); } }