• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • paul wheaton
  • Ron McLeod
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Liutauras Vilda
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Piet Souris
Bartenders:

Unit testing in ADF application.

 
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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?
 
Ranch Hand
Posts: 1164
Eclipse IDE Firefox Browser Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
To be more precise here is a sample of my code

 
Rancher
Posts: 1776
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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?
 
reply
    Bookmark Topic Watch Topic
  • New Topic