junit tests...
it needs compare 2 single elements excepting fields. can use assertj this:
assertions.assertthat(actual).isequaltoignoringgivenfields(except, "id", "innercollection");
and works good. it's not enough. need compare inner collections also. know ids different in inner collection. possible compare ones like
assertions.assertthat(to.getinnercollection()).isequaltoignoringgivenfields(from.getinnercollection() , {except fields in collection elements});
in case, rather consider create own custom matcher.
that straight-forward task; can find detailed example here.
Comments
Post a Comment