Created
November 22, 2021 15:09
-
-
Save JohanneA/70d06121e507a0e94b436bad2ba0eb82 to your computer and use it in GitHub Desktop.
Kotlin test DSL
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fun getShipmentWithOneBox(): ShipmentBuilder { | |
return buildShipment { | |
id = 1L | |
buildBoxes { | |
id = 1L | |
buildProduct { | |
id = 1L | |
name = "Pink Fussy Jacket" | |
} | |
} | |
} | |
} | |
@Test | |
fun `shipment should have one box with snowboard in it`() { | |
val shipment = getShipmentWithOneBox().override { | |
overrideBox(1L) { | |
overrideProduct(1L) { | |
name = "Custom Snowboard" | |
} | |
} | |
}.build() | |
val firstBoxContent = shipment.boxes.first().contents.first() | |
assertThat(firstBoxContent.name).isEqualTo("Custom Snowboard") | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment