microservices-patterns / ftgo-application

Example code for the book Microservice patterns
Other
3.35k stars 1.29k forks source link

Saga tests - parameters of Commands are not considered by verification #67

Open asn25 opened 4 years ago

asn25 commented 4 years ago

Hi,

consider CreateOrderSagaTests.shouldRejectOrderDueToConsumerVerificationFailed test. If I change parameters of expected Commands to arbitrary values, test still passes:

https://imgur.com/a/3fzgN1v

Would be good to add to SagaUnitTestSupport asserts for Command parameters as well, if possible.

=====

@Test public void shouldRejectOrderDueToConsumerVerificationFailed() { given() .saga(makeCreateOrderSaga(), new CreateOrderSagaState(ORDER_ID, CHICKEN_VINDALOO_ORDER_DETAILS)). expect(). // command(new ValidateOrderByConsumer(CONSUMER_ID, ORDER_ID,CHICKEN_VINDALOO_ORDER_TOTAL)). command(new ValidateOrderByConsumer(55555, 77777, null)). to(ConsumerServiceChannels.consumerServiceChannel). andGiven(). failureReply(). expect(). // command(new RejectOrderCommand(ORDER_ID)). command(new RejectOrderCommand(3333333)). to(OrderServiceChannels.orderServiceChannel). andGiven(). successReply(). expectRolledBack() ; }

===

Test PASSED