I've run into a little bit of trouble when trying to test interfacing with an external API. In particular a fair amount of classes that said API uses for data storage don't have equals
and toString
methods, which makes comparing whether the API created the objects I expect pretty difficult, as they are returned in a multitude of complex list-map combinations. Which if I wanted to manually check for equality I'd have to write a custom deep equality check every time.
So I was wondering if it is possible to inject a custom implementation of eqauls
(and maybe even toString
) into that class with PowerMock, Mockito and JUnit 4 (that's my test environment). Or if there is a way to tell JUnit to use a custom method to compare the objects of these data classes.
Libraries that integrate well with that setup are welcome.