Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save mucahitkurt/214e487901489e552382dd3082c6a2c0 to your computer and use it in GitHub Desktop.
Save mucahitkurt/214e487901489e552382dd3082c6a2c0 to your computer and use it in GitHub Desktop.
class OrderTest() {
//…
@Test
fun `Should be cancelled if the order is unpaid`() {
val orderSpecification = mockk<OrderSpecification>(relaxed = true)
val order = Order(orderSpecification)
//…make the order unpaid…
every { orderSpecification.isCancellable(order) } returns true
order.cancel()
Assertions.assertTrue(order.isCancelled())
verify(exactly = 1) {
orderSpecification.isCancellable(match {
it == order
})
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment