| 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
|
|
|
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]
|
 |
 |
|
|
subject: Using Junit to test MDB
|
|
|