package Ġcom . last minute . cdc . frontend . flight . checkout Ċ Ċ import Ġau . com . di us . p act . consumer . Consumer P act Builder Ċ import Ġau . com . di us . p act . model . Request Response P act Ċ import Ġcom . last minute . cdc . frontend . run With Ċ import Ġio . p act foundation . consumer . dsl . Lambda Dsl . new Json Body Ċ import Ġorg . junit . Test Ċ import Ġorg . springframework . web . client . Rest Template Ċ import Ġjava . util .* Ċ Ċ class ĠRest Flight Checkout Test Ġ{ ĊĠ Ġprivate Ġval Ġflight Id Ġ= ĠUUID . fromString (" 4 7 e 2 f 0 e 6 - a 8 4 8 - 4 8 c 8 - b 1 ab - e 3 dd 8 0 a 8 0 8 2 9 ") ĊĠ Ġprivate Ġval ĠuserId Ġ= Ġ" alice " ĊĊĠ Ġprivate Ġval Ġcheckout Successfully P act : ĠRequest Response P act Ġ= ĠConsumer P act Builder . consumer (" frontend ") ĊĠĠĠ Ġ. has P act With (" checkout ") ĊĊĠĠĠ Ġ. given (" found Ġflight Ġwith Ġid Ġ$ flight Id ") ĊĊĠĠĠ Ġ. upon Re ceiving (" request Ġto Ġcheckout Ġflight Ġwith Ġid Ġ$ flight Id Ġfor Ġuser Ġ$ userId ") ĊĠĠĠ Ġ. method (" POST ") ĊĠĠĠ Ġ. headers ( map Of (" Content - Type " Ġto Ġ" application / json ")) ĊĠĠĠ Ġ. path ("/ checkout /") ĊĠĠĠ Ġ. body ( new Json Body Ġ{ Ġroot Ġ-> ĊĠĠĠĠĠ Ġroot . uuid (" flight Id ", Ġflight Id ) ĊĠĠĠĠĠ Ġroot . string Type (" userId ", ĠuserId ) ĊĠĠĠ Ġ}. build ()) ĊĊĠĠĠ Ġ. will Respond With () ĊĠĠĠ Ġ. status ( 2 0 2 ) ĊĊĠĠĠ Ġ. to P act () ĊĊĠ Ġ@ Test ĊĠ Ġfun Ġ` checkout Ġsuccessfully Ġfor Ġa Ġuser `() Ġ{ ĊĠĠĠ Ġrun With ( checkout Successfully P act ) Ġ{ Ġmock Server Ġ-> ĊĠĠĠĠĠ Ġval Ġflight Checkout Ġ= ĠRest Flight Checkout ( Rest Template (), Ġmock Server . getUrl ()) ĊĠĠĠĠĠ Ġflight Checkout . checkout Flight ( flight Id , ĠuserId ) ĊĠĠĠ Ġ} ĊĠ Ġ} Ċ }