Win a copy of Securing DevOps this week in the Security forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

How to write Junit Test cases of a Java class.  RSS feed

 
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a class  made using STRUTS and these are action classes. I need to write JUNIT Test cases of all the methods of that class. Please help
 
Saloon Keeper
Posts: 8481
155
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Do you mean that you want to unit test a controller? You can just test it like any other class. Just mock your dependencies (such as repositories) and then run test cases.

Have you used JUnit before?
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!