Hi,
I have a question regarding the behaviour of the diff for case classes. Here is a short example:
import com.softwaremill.diffx._
case class FooBar(
foo: String,
bar: String
)
object FooBar {
implicit val fooBarDiff: Diff[FooBar] = Diff.derived
}
"compare" should "return IdenticalValue for the same instance" in {
val fooBarInstance = FooBar("a", "b")
val diffResult = compare(fooBarInstance, fooBarInstance)
diffResult shouldBe IdenticalValue(fooBarInstance)
}
In a case like this, it was obvious that I'd receive IdenticalValue. Instead, the test fails with:
DiffResultObject(FooBar,ListMap(foo -> IdenticalValue(a), bar -> IdenticalValue(b))) was not equal to IdenticalValue(FooBar(a,b))
Is it intended behaviour? If it is, is there any alternative that will allow me to receive an IdenticalValue when the fields are identical and DiffResultObject when the fields are different? Of course, my example is simplified. My real scenario contains a larger hierarchy of nested objects, so manually creating a Diff will be quite hard.
I know that I can use isIdentical but I'd like to extract the whole identical entity from the diff. DiffResultObject contains only the name and a map of fields.
When I was using version 0.4.5 it worked as expected. My current diffx version is 0.8.0.
Hi,
I have a question regarding the behaviour of the diff for case classes. Here is a short example:
In a case like this, it was obvious that I'd receive
IdenticalValue. Instead, the test fails with:Is it intended behaviour? If it is, is there any alternative that will allow me to receive an
IdenticalValuewhen the fields are identical andDiffResultObjectwhen the fields are different? Of course, my example is simplified. My real scenario contains a larger hierarchy of nested objects, so manually creating aDiffwill be quite hard.I know that I can use
isIdenticalbut I'd like to extract the whole identical entity from the diff.DiffResultObjectcontains only the name and a map of fields.When I was using version 0.4.5 it worked as expected. My current diffx version is 0.8.0.