Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Using Junit to test MDB

 
Sachin Navari
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 14112
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Lasse Koskela
author
Sheriff
Posts: 11962
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Or, by simply instantiating your MDB class and calling the onMessage() method on it yourself.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic