• Post Reply Bookmark Topic Watch Topic
  • New Topic

Unit testing in ADF application.  RSS feed

 
bhaskar hazarika
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How do i test a method wher the logic is like
"there is a need to pass the current class instance as an argument to a method of another object".
Any suggestion?
 
Mansukhdeep Thind
Ranch Hand
Posts: 1163
Eclipse IDE Firefox Browser Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to the ranch Bhaskar.

JUnit is a good framework designed to handle most of the scenarios that need to be tested when we implement any functionality in java. See this tutorial.

bhaskar wrote: "there is a need to pass the current class instance as an argument to a method of another object".


Not sure what you mean by method of another object. Objects don't have methods, classes do. Yes, a method runs on an instance of a class which points to the object. Please clarify what is it exactly that you are trying to say here.
 
bhaskar hazarika
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you for the reply.
The scenario is like i m testing a method in the application module..the method calls an another method in the service class and it passes the instances of the application module class.
 
bhaskar hazarika
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
To be more precise here is a sample of my code

 
John Jai
Rancher
Posts: 1776
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
bhaskar hazarika wrote:"there is a need to pass the current class instance as an argument to a method of another object".

You can achieve this by using this. By another object, do you mean by the object of the same class?
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!