• 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
  • Jeanne Boyarsky
  • Ron McLeod
Sheriffs:
  • Paul Clapham
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Piet Souris
Bartenders:

Objects not the same after reading from XML

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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:
 
Sheriff
Posts: 28385
99
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
reply
    Bookmark Topic Watch Topic
  • New Topic