Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to write JUnit for Void method

 
Nishan Patel
Ranch Hand
Posts: 689
Eclipse IDE Java Scala
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

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.


 
Nam Ha Minh
Ranch Hand
Posts: 504
Eclipse IDE Firefox Browser Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?
 
Nishan Patel
Ranch Hand
Posts: 689
Eclipse IDE Java Scala
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 485
Eclipse IDE Firefox Browser Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 34973
379
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Nishan Patel
Ranch Hand
Posts: 689
Eclipse IDE Java Scala
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.

 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic