EJBs are just annotated pojos so yes they are very easy to test. remember to write your unit tests to test ONLY that EJB and mock out any other resources/dependencies the bean needs. As for TDD, everyone has an opinion and from my experience I would not take this approach. Code your bean, get it working, then use a unit test as a code-quality and -review tool to make your bean better. Once you start coding a unit tests, how to make your bean better will usually be very apparent. Got 20 dependencies in your bean you need to mock...probably you bean is doing too much work and taking too much responsibility. Got to write 10 tests to cover all branches of a method...method is probably too complicated. etc.
Java EE Evangelist — Author, EJB 3 in Action 2nd Edition — Java Community Process Member
First, you drop a couch from the plane, THEN you surf it. Here, take this tiny ad with you:
Free, earth friendly heat - from the CodeRanch trailboss