Jim,

I currently do not unit test either Entity or Session Beans.  Entity Beans
are trivial to write, and I trust that the application server will persist
them as advertised.  To unit test Session Beans would require that they be
deployed.  Since deployment complicates unit testing and complicated or
difficult unit tests suggest that the design could be done
differently/better, I design Session Beans to be controllers of a number of
collaborating objects.  These objects are simply business objects that
encode the business logic of the system.  Since they are plain Java classes,
I can unit test them very easily.

Consider a message-driven bean.  As I generally design them, MDBs receive a
message, hand it to a parser, hand the results of parsing to other objects
that do something with the message contents, hand the results of that work
to a communictator, which knows how to send the final results where they
need to go.  So, I don't test any part of the MDB; rather, I test the
various collaborating business objects.  If I'm confident that they all
behave as expected, I'm confident that they will also do so when they
interact via one another's interface.

Hope that helps,
Craig


-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
_______________________________________________
JBoss-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-user

Reply via email to