• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

EJB wit TDD

 
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Can EJB be developed with a Test Driven Development approach?

Is that possible with Junit or should it require other tools/frameworks?

I am also interested in understanding which mocks should I consider and which part of the IJB code must instead be tested?


Thanks in advance :-)

Beppe
 
Author
Posts: 131
7
Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
reply
    Bookmark Topic Watch Topic
  • New Topic