### Question:
AmqpMessageProducer extends AmqpAbstract { public void sendMessage(String message) throws JMSException { logger.info("Sending message to queue/topic: " + queueOrTopic); logger.debug("Message: " + message); TextMessage testMessage = session.createTextMessage(message); messageProducer.send(testMessage, DeliveryMode.NON_PERSISTENT, Message.DEFAULT_PRIORITY, Message.DEFAULT_TIME_TO_LIVE); } AmqpMessageProducer(String user, String password, String queueOrTopic);  AmqpMessageProducer(String url, String user, String password, String queueOrTopicName, boolean topic); void sendMessage(String message);  }### Answer:
@Test public void sendMessageTest() throws Exception { AmqpMessageReceiver receiver = new AmqpMessageReceiver("guest", "guest", "myTopicLookup"); AmqpBasicListener listener = new AmqpBasicListener(); receiver.setMessageConsumer(listener); AmqpMessageProducer producer = new AmqpMessageProducer("guest", "guest", "myTopicLookup"); producer.sendMessage("testX"); Thread.sleep(1000l); assertEquals("topic.pepito", listener.getDestination()); assertEquals("testX", listener.getMessage()); receiver.close(); producer.close(); }
@Test public void sendMessageTestWithDinamicTopic() throws Exception { AmqpMessageReceiver receiver = new AmqpMessageReceiver(null, null, null, "my.topic.queue", true); AmqpBasicListener listener = new AmqpBasicListener(); receiver.setMessageConsumer(listener); AmqpMessageProducer producer = new AmqpMessageProducer(null, null, null, "my.topic.queue", true); producer.sendMessage("testX"); Thread.sleep(1000l); assertEquals("my.topic.queue", listener.getDestination()); assertEquals("testX", listener.getMessage()); receiver.close(); producer.close(); }