| Author |
How to write JUnit for Void method
|
Nishan Patel
Ranch Hand
Joined: Sep 07, 2008
Posts: 676
|
|
Hi All,
I am working on Junit test case and we have lot of void return type methods. I want to know how can I test and write JUnit for void return type method.
|
Thanks, Nishan Patel
SCJP 1.5, SCWCD 1.5, OCPJWSD Java Developer,My Blog
|
 |
Nam Ha Minh
Ranch Hand
Joined: Oct 31, 2011
Posts: 346
|
|
Nishan Patel wrote:
Hi All,
I am working on Junit test case and we have lot of void return type methods. I want to know how can I test and write JUnit for void return type method.
What do you expect from those void methods?
|
Job Offer: Online working Java technical writing
|
 |
Nishan Patel
Ranch Hand
Joined: Sep 07, 2008
Posts: 676
|
|
Hi,
I am doing database insert and update which actually return void so I just want to know how can I find whether is it working fine or not.. ?
|
 |
Mohana Rao Sv
Ranch Hand
Joined: Aug 01, 2007
Posts: 485
|
|
|
In HashMap we have clear method right, how do you test it? You know what happens when we called that method. Just test it by iterating over it. If you found any element clear method is wrong or else it's fine. Like that you have to do.
|
ocjp 6 — Feeding a person with food is a great thing in this world. Feeding the same person by transferring the knowledge is far more better thing. The reason is the amount of satisfaction which we get through food is of only one minute or two. But the satisfaction which we can get through the knowledge is of life long.
|
 |
Jeanne Boyarsky
internet detective
Marshal
Joined: May 26, 2003
Posts: 26192
|
|
Nishan Patel wrote:Hi,
I am doing database insert and update which actually return void so I just want to know how can I find whether is it working fine or not.. ?
Have your test do a select to see if the database is correct.
|
[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
|
 |
Nishan Patel
Ranch Hand
Joined: Sep 07, 2008
Posts: 676
|
|
Jeanne Boyarsky wrote:
Nishan Patel wrote:Hi,
I am doing database insert and update which actually return void so I just want to know how can I find whether is it working fine or not.. ?
Have your test do a select to see if the database is correct.
Yes, we have insert, update, delete and select from db.
|
 |
 |
|
|
subject: How to write JUnit for Void method
|
|
|