package Ġdk . cache t . car p . deployment . infrastructure Ċ Ċ import Ġdk . cache t . car p . common . DateTime Ċ import Ġdk . cache t . car p . common . UUID Ċ import Ġdk . cache t . car p . common . ddd . Service Invoker Ċ import Ġdk . cache t . car p . deployment . application . Deployment Service Ċ import Ġdk . cache t . car p . deployment . application . Deployment Service Mock Ċ import Ġdk . cache t . car p . protocols . domain . devices . Default Device Registration Ċ import Ġdk . cache t . car p . protocols . infrastructure . test . create Empty Protocol Ċ import Ġdk . cache t . car p . test . run Suspend Test Ċ import Ġkotlin . test .* ĊĊ Ċ /** Ċ Ġ* ĠTests Ġfor Ġ[ Deployment Service Request ]' s . Ċ Ġ*/ Ċ class ĠDeployment Service Requests Test Ċ { ĊĠĠĠ Ġcompanion Ġobject ĊĠĠĠ Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġrequests : ĠList < Deployment Service Request > Ġ= ĠlistOf ( ĊĠĠĠĠĠĠĠĠĠĠĠ ĠDeployment Service Request . Create Study Deployment ( Ġcreate Empty Protocol (). get Snapshot () Ġ), ĊĠĠĠĠĠĠĠĠĠĠĠ ĠDeployment Service Request . Get Study Deployment Status ( ĠUUID . randomUUID () Ġ), ĊĠĠĠĠĠĠĠĠĠĠĠ ĠDeployment Service Request . Get Study Deployment Status List ( Ġset Of ( ĠUUID . randomUUID () Ġ) Ġ), ĊĠĠĠĠĠĠĠĠĠĠĠ ĠDeployment Service Request . Register Device ( ĠUUID . randomUUID (), Ġ" Test Ġrole ", ĠDefault Device Registration ( Ġ" Device ĠID " Ġ) Ġ), ĊĠĠĠĠĠĠĠĠĠĠĠ ĠDeployment Service Request . Unregister Device ( ĠUUID . randomUUID (), Ġ" Test Ġrole " Ġ), ĊĠĠĠĠĠĠĠĠĠĠĠ ĠDeployment Service Request . GetDevice Deployment For ( ĠUUID . randomUUID (), Ġ" Test Ġrole " Ġ), ĊĠĠĠĠĠĠĠĠĠĠĠ ĠDeployment Service Request . Deployment Successful ( ĠUUID . randomUUID (), Ġ" Test Ġrole ", ĠDateTime . now () Ġ), ĊĠĠĠĠĠĠĠĠĠĠĠ ĠDeployment Service Request . Stop ( ĠUUID . randomUUID () Ġ) ĊĠĠĠĠĠĠĠ Ġ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġprivate Ġval Ġmock Ġ= ĠDeployment Service Mock () ĊĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġcan _ serialize _ and _ deserialize _ requests () ĊĠĠĠ Ġ{ ĊĠĠĠĠĠĠĠ Ġrequests . forEach Ġ{ Ġrequest Ġ-> ĊĠĠĠĠĠĠĠĠĠĠĠ Ġval Ġserializer Ġ= ĠDeployment Service Request . serializer () ĊĠĠĠĠĠĠĠĠĠĠĠ Ġval Ġserialized Ġ= ĠJSON . encode ToString ( Ġserializer , Ġrequest Ġ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġval Ġparsed Ġ= ĠJSON . decode FromString ( Ġserializer , Ġserialized Ġ) ĊĠĠĠĠĠĠĠĠĠĠĠ ĠassertEquals ( Ġrequest , Ġparsed Ġ) ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Suppress ( Ġ" UN CHECK ED _ CAST " Ġ) ĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġinvoke On _ requests _ call _ service () Ġ= Ġrun Suspend Test Ġ{ ĊĠĠĠĠĠĠĠ Ġrequests . forEach Ġ{ Ġrequest Ġ-> ĊĠĠĠĠĠĠĠĠĠĠĠ Ġval Ġservice Invoker Ġ= Ġrequest Ġas ĠService Invoker < Deployment Service , Ġ*> ĊĠĠĠĠĠĠĠĠĠĠĠ Ġval Ġfunction Ġ= Ġservice Invoker . function ĊĠĠĠĠĠĠĠĠĠĠĠ Ġservice Invoker . invoke On ( Ġmock Ġ) ĊĠĠĠĠĠĠĠĠĠĠĠ ĠassertTrue ( Ġmock . was Called ( Ġfunction , Ġservice Invoker . overload Identifier Ġ) Ġ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġmock . reset () ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠ Ġ} Ċ } Ċ