dcsimg
Comparing the Objects created by User Defined Classes in JUnit Test Case
3 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   sandeep_suhdkaran
Posted On:   Tuesday, October 5, 2004 04:14 AM


Hi,




--->I have considerable problems comparing the various objects of a user defined class. I have a function that returns a class named say ABC with 5 variables say a, b, c, d and e. Do I have to use assertEquals for each of the variables to compare the results or is there a method that can be used to compare objects and the object variables get compared automaticaly. The question might be trivial but if there is an answer please let me know.




Thanks and Regards,


Sandeep

Re: Comparing the Objects created by User Defined Classes in JUnit Test Case

Posted By:   Avram_a  
Posted On:   Wednesday, October 20, 2004 01:34 AM

you need to have an equal method in all your classes and when sending two object of the same class into asserequal it will use the equal method to compare them ...

Re: Comparing the Objects created by User Defined Classes in JUnit Test Case

Posted By:   Avram_a  
Posted On:   Wednesday, October 20, 2004 01:34 AM

you need to have an equal method in all your classes and when sending two object of the same class into asserequal it will use the equal method to compare them ...

Re: Comparing the Objects created by User Defined Classes in JUnit Test Case

Posted By:   Anonymous  
Posted On:   Wednesday, October 6, 2004 08:37 AM

No, you just need to implement ABC.equals correctly.
About | Sitemap | Contact