Win a copy of Java 9 Modularity: Patterns and Practices for Developing Maintainable Applications this week in the Java 9 forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

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

 
Sumit RawalArora
Greenhorn
Posts: 27
  • 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
 
Stephan van Hulst
Saloon Keeper
Posts: 7927
143
  • 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!