Skip to content

Instantly share code, notes, and snippets.

@monkey-codes
Created April 8, 2021 22:12
Show Gist options
  • Select an option

  • Save monkey-codes/d95ff025f16a0cddd211f1dc154b8fa2 to your computer and use it in GitHub Desktop.

Select an option

Save monkey-codes/d95ff025f16a0cddd211f1dc154b8fa2 to your computer and use it in GitHub Desktop.
Saga Test
@Test
fun `should start food preparation saga on OrderQueuedEvent`() {
val orderQueuedEvent = orderQueuedEvent()
fixture
.givenNoPriorActivity()
.whenAggregate(ORDER_QUEUE_ID.toString()).publishes(orderQueuedEvent)
.expectActiveSagas(1)
.expectAssociationWith("cookId", COOK_ID)
.expectDispatchedCommands(
PrepareOrderCommand(
cookId = COOK_ID,
orderId = orderQueuedEvent.orderId,
waiterId = orderQueuedEvent.waiterId,
items = orderQueuedEvent.items
)
)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment