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.