Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Objects not the same after reading from XML

 
Nick Paul Maher
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Sheriff
Posts: 21416
33
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic