aspose file tools
The moose likes Testing and the fly likes How to test a javabean Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » Testing
Bookmark "How to test a javabean" Watch "How to test a javabean" New topic

How to test a javabean

patt rich

Joined: Apr 07, 2008
Posts: 21
I have a javabean class. I should add Junit test class for that. I am wondering how to add test cases for getter setter methods. Evenif I add, will that be a proper testing of Java? Or are we just testing the java compiler by doing this?

Jeanne Boyarsky
author & internet detective

Joined: May 26, 2003
Posts: 31655

In general, testing getters and setters directly doesn't add much value. However, a good suite of tests will cover those methods indirectly by testing the classes that call those getters and setters.

[OCA 8 book] [Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
I agree. Here's the link:
subject: How to test a javabean