Win a copy of Rust Web Development this week in the Other Languages forum!
  • 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:
  • Tim Cooke
  • Campbell Ritchie
  • Ron McLeod
  • Liutauras Vilda
  • Jeanne Boyarsky
Sheriffs:
  • Junilu Lacar
  • Rob Spoor
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Tim Moores
  • Jesse Silverman
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Piet Souris
  • Frits Walraven

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.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic