activemq-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Carfield Yim <carfi...@carfield.com.hk>
Subject Re: Question about unit test with activemq
Date Mon, 28 May 2007 06:24:30 GMT



Carfield Yim wrote:
> 
>> How about creating a consumer to receive the message and asserting the
>> message? There are examples of this throughout the ActiveMQ tests.
>> There's a really simple one in the
>> JMSConsumerTest.testReceiveMessageWithConsumer() test:
>>
>> http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/JMSConsumerTest.java?view=markup
>>
> Can I not do that? Look like pretty complicate for just assert value
> in unit test.
> 
> 

The reason I ask that because now I setup the test using very simple code:


public class JmsQueueSenderTest
{
	JmsTemplate102 jt;
	ActiveMQQueue queue;

	@Before
	public void setup()
	{
		ConnectionFactory connectionFactory = new
ActiveMQConnectionFactory("vm://localhost?broker.persistent=false");
		jt = new JmsTemplate102(connectionFactory, false);
		queue = new ActiveMQQueue("queue");
		
	}
	
	@Test
	public void testSimpleSend()
	{
		jt.send(queue, new MessageCreator()
		{
			public Message createMessage(Session session) throws JMSException
			{
				return session.createTextMessage("test");
			}
		});
	}
}

I haven't really create a session and I hope I don't need to do so for just
a unit test
-- 
View this message in context: http://www.nabble.com/Question-about-unit-test-with-activemq-tf3820428s2354.html#a10831734
Sent from the ActiveMQ - User mailing list archive at Nabble.com.


Mime
View raw message