JMS message creation
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Hlodver_Tomasson
Posted On:   Wednesday, January 15, 2003 06:10 AM

I'm trying to create a unit test for a method which creates and returns a custom java-object from a javax.jms.Message.


My question is, "how can I create JMS test messages without dependency on a JMS provider"?


(With JavaMail message this is easy, because javax.mail.MimeMessage constructor takes the mail-session as parameter, which can be null , but JMS-session has a factory method for creation of the message ( QueueSession.createTextMessage() )

Re: JMS message creation

Posted By:   Nick_Maiorano  
Posted On:   Saturday, January 18, 2003 09:12 AM

Hlodver,



You can use mock objects. These are "pretend" implementations of standard classes in java. You can, for example, create a mock JMS queue to send and receive messages to it. The mock object will behave as if it's really a JMS queue but not really do anything. This allows you to test your code but not JMS itself. It can also save you from deploying your whole app server. Take a look at the available mocked objects right here.



More info on mock objects is available here.

About | Sitemap | Contact