mercredi 14 septembre 2016

using AssertJ usingComparatorForType method with inheritance

I found the assertj (3.5.2) method : usingComparatorForType and fall in love with it.

But I wanted to compare 2 XmlGregorianCalendar dates with an error margin. And this magic method doesn't worked for this case...

Here is why :

  • XmlGregorianCalendar is an Abstract class
  • The real object type is : XmlGregorianCalendarImpl
  • This class (XmlGregorianCalendarImpl) is private, so I can't create a specific comparator for this class.

Do you have any solution for this case ? Is there another method which works fine with inheritance ?

Thanks in advance.

Aucun commentaire:

Enregistrer un commentaire