Meaningless Drivel is fun!*
The moose likes Testing and the fly likes Using Junit to test MDB Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Engineering » Testing
Bookmark "Using Junit to test MDB" Watch "Using Junit to test MDB" New topic
Author

Using Junit to test MDB

Sachin Navari
Greenhorn

Joined: Oct 07, 2005
Posts: 2
I am newbie to Junit and i am writng a Test case for a MDB. BBasically i have to post a message and later check the records in couple of tables to check if the logic is executed correctly to populate the right tables.

Can any body direct me to some pointers.

Thx,
Sachin
Ilja Preuss
author
Sheriff

Joined: Jul 11, 2001
Posts: 14112
The best way I know to do this is to extract the logic into a POJO which the MDB delegates to. You can then test the POJO as usual.


The soul is dyed the color of its thoughts. Think only on those things that are in line with your principles and can bear the light of day. The content of your character is your choice. Day by day, what you do is who you become. Your integrity is your destiny - it is the light that guides your way. - Heraclitus
Lasse Koskela
author
Sheriff

Joined: Jan 23, 2002
Posts: 11962
    
    5
Or, by simply instantiating your MDB class and calling the onMessage() method on it yourself.


Author of Test Driven (2007) and Effective Unit Testing (2013) [Blog] [HowToAskQuestionsOnJavaRanch]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Using Junit to test MDB
 
Similar Threads
JUNIT and writting test case for MDB
Testing Message driven bean in Junit
hibernate MappingException: duplicate import
org.springframework.beans.factory.BeanCreationException
How to get back the Access MDB file password?`