Hi Julie,
I'm afraid there's no way around this issue at the moment, apart from
making your formatPk method concrete (which, I realise, is not what
you want).
The reason is that EqualsVerifier will always compare your objects
with instances of their superclass, even if they are concrete. As you
can read in Effective Java, this is very important, because this is
where symmetry and transitivity errors most easily pop up.
Unfortunately, EqualsVerifier calls these toString methods as well, to
generate error messages. There error messages are generated whether
they are needed or not, because of the way Java works. Consider a
JUnit assert statement:
CityBO city = ...
CityBO otherCity = ...
assertEquals("Cities not equal: " + city + " and " + otherCity, city,
otherCity);
As you can see, the error message is generated before the call to
assertEquals takes place.
There is a way around this, but it would require some re-architecting
of EqualsVerifier, which I unfortunately don't have time for in the
near future.
Regards,
Jan