difflicious icon indicating copy to clipboard operation
difflicious copied to clipboard

Custom record (object) differ

Open jatcwang opened this issue 4 years ago • 0 comments

Sometimes we have a record-like class which we'll want to compare a subset of fields.

e.g.

class MyError(field1: String, field2: List[String], cause: Throwable) extends Exception we may only want to compare msg since cause isn't something we can/want to compare.

Ideally we can have have an easy way to create custom record differs, maybe something like:

val differ = Differ.customObj(_.msg, _.field2)

where customObj is overloaded to accept any number of params.

jatcwang avatar Aug 23 '21 11:08 jatcwang