Skip to content

Commit

Permalink
add failing test
Browse files Browse the repository at this point in the history
  • Loading branch information
hughsimpson committed Feb 1, 2025
1 parent 2eae393 commit f45057a
Showing 1 changed file with 16 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package io.scalaland.chimney
import io.scalaland.chimney.dsl.*
import io.scalaland.chimney.fixtures.*

import java.util.UUID
import scala.annotation.unused

class PatcherProductSpec extends ChimneySpec {
Expand All @@ -18,6 +19,21 @@ class PatcherProductSpec extends ChimneySpec {
foo.using(bar).patch ==> Foo(10, "", 10.0)
}

test(
"""patch an product type object with a product type patch object containing a "subset" of fields including a UUID"""
) {
case class Foo(id: Int, externalReference: UUID)
case class Bar(externalReference: UUID)

val uuid1 = UUID.randomUUID()
val uuid2 = UUID.randomUUID()
val foo = Foo(42, uuid1)
val bar = Bar(uuid2)

foo.patchUsing(bar) ==> Foo(42, uuid2)
foo.using(bar).patch ==> Foo(42, uuid2)
}

test(
"patch a product with non-Option field with a product type patch object with all Option fields, applying value from Some and leaving original value in None"
) {
Expand Down

0 comments on commit f45057a

Please sign in to comment.