aspose file tools*
The moose likes I/O and Streams and the fly likes Objects not the same after reading from XML Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » I/O and Streams
Bookmark "Objects not the same after reading from XML" Watch "Objects not the same after reading from XML" New topic
Author

Objects not the same after reading from XML

Nick Paul Maher
Greenhorn

Joined: Apr 18, 2011
Posts: 2
Ok so my problem is that I'm JUnit testing a method that uses an XML decoder, however the objects produced fail an assert equals test. The code is below.
Thanks in advance.

from Module class


from JUnit test:
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18993
    
    8

If the assertion that the two objects are "equals" fails, then the first place to look is at the equals() method of the Module class. That's what the assertion is testing, right? And yet you haven't posted that method.
Nick Paul Maher
Greenhorn

Joined: Apr 18, 2011
Posts: 2
Thanks Paul for pointing me in the right direction, I didn't realise you were required to write your own equals method (still learning JAVA). After overriding the equals method in all classes the assertEquals now evaluates to true.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Objects not the same after reading from XML