package Ġdk . cache t . car p . deployment . infrastructure Ċ Ċ import Ġdk . cache t . car p . deployment . domain . Study Deployment Snapshot Ċ import Ġdk . cache t . car p . deployment . domain . create Complex Deployment Ċ import Ġdk . cache t . car p . deployment . domain . study Deployment For Ċ import Ġdk . cache t . car p . protocols . domain . devices . Custom Device Registration Ċ import Ġdk . cache t . car p . protocols . domain . devices . Default Device Registration Ċ import Ġdk . cache t . car p . protocols . infrastructure . test . ST UB S _ SERIAL _ MODULE Ċ import Ġdk . cache t . car p . protocols . infrastructure . test . Stub Master Device Descriptor Ċ import Ġdk . cache t . car p . protocols . infrastructure . test . create Empty Protocol Ċ import Ġdk . cache t . car p . protocols . infrastructure . test . make Unknown Ċ import Ġkotlinx . serialization . Experimental Serialization Api Ċ import Ġkotlin . test .* ĊĊ Ċ /** Ċ Ġ* ĠTests Ġfor Ġ[ Study Deployment Snapshot ] Ġrelying Ġon Ġcore Ġinfrastructure . Ċ Ġ*/ Ċ class ĠStudy Deployment Snapshot Test Ċ { ĊĠĠĠ Ġ@ Before Test ĊĠĠĠ Ġfun Ġinitialize Serializer () ĊĠĠĠ Ġ{ ĊĠĠĠĠĠĠĠ ĠJSON Ġ= Ġcreate Deployment Serializer ( ĠST UB S _ SERIAL _ MODULE Ġ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġcan _ serialize _ and _ deserialize _ snapshot _ using _ JSON () ĊĠĠĠ Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġdeployment Ġ= Ġcreate Complex Deployment () ĊĠĠĠĠĠĠĠ Ġval Ġsnapshot : ĠStudy Deployment Snapshot Ġ= Ġdeployment . get Snapshot () ĊĊĠĠĠĠĠĠĠ Ġval Ġserialized : ĠString Ġ= Ġsnapshot . toJson () ĊĠĠĠĠĠĠĠ Ġval Ġparsed : ĠStudy Deployment Snapshot Ġ= ĠStudy Deployment Snapshot . fromJson ( Ġserialized Ġ) ĊĊĠĠĠĠĠĠĠ ĠassertEquals ( Ġsnapshot , Ġparsed Ġ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ/** ĊĠĠĠĠ Ġ* ĠTypes Ġnot Ġknown Ġat Ġcompile Ġtime Ġshould Ġnot Ġprevent Ġde serializing Ġa Ġdeployment , Ġbut Ġshould Ġbe Ġloaded Ġthrough Ġa Ġ' Custom ' Ġtype Ġwrapper . ĊĠĠĠĠ Ġ*/ ĊĠĠĠ Ġ@ Experimental Serialization Api ĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġunknown _ types _ are _ wrapped _ when _ de serializing () ĊĠĠĠ Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġserialized Ġ= Ġserialize Deployment Snapshot In cluding Unknown Registration () ĊĠĠĠĠĠĠĠ Ġval Ġparsed Ġ= ĠStudy Deployment Snapshot . fromJson ( Ġserialized Ġ) ĊĊĠĠĠĠĠĠĠ Ġval Ġall Regist rations Ġ= Ġparsed . device Registration History . values . flatten () ĊĠĠĠĠĠĠĠ ĠassertEquals ( Ġ 1 , Ġall Regist rations . filter Is Instance < Custom Device Registration >(). count () Ġ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ/** ĊĠĠĠĠ Ġ* ĠTypes Ġwhich Ġwere Ġwrapped Ġin Ġa Ġ' Custom ' Ġtype Ġwrapper Ġupon Ġde serialization Ġshould Ġbe Ġserialized Ġto Ġtheir Ġoriginal Ġform Ġ( return ing Ġthe Ġoriginal Ġtype , Ġnot Ġthe Ġwrapper ). ĊĠĠĠĠ Ġ*/ ĊĠĠĠ Ġ@ Experimental Serialization Api ĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġserial izing _ unknown _ types _ re moves _ the _ wrapper () ĊĠĠĠ Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġserialized : ĠString Ġ= Ġserialize Deployment Snapshot In cluding Unknown Registration () ĊĠĠĠĠĠĠĠ Ġval Ġsnapshot Ġ= ĠStudy Deployment Snapshot . fromJson ( Ġserialized Ġ) ĊĊĠĠĠĠĠĠĠ Ġval Ġcustom Serialized Ġ= Ġsnapshot . toJson () ĊĠĠĠĠĠĠĠ ĠassertEquals ( Ġserialized , Ġcustom Serialized Ġ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ/** ĊĠĠĠĠ Ġ* ĠCreate Ġa Ġserialized Ġdeployment Ġ( snapshot ) Ġof Ġa Ġstudy Ġprotocol Ġwith Ġexactly Ġone Ġmaster Ġdevice Ġwhich Ġis Ġregistered Ġusing Ġan Ġunknown Ġdevice Ġregistration . ĊĠĠĠĠ Ġ*/ ĊĠĠĠ Ġ@ Experimental Serialization Api ĊĠĠĠ Ġprivate Ġfun Ġserialize Deployment Snapshot In cluding Unknown Registration (): ĠString ĊĠĠĠ Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġprotocol Ġ= Ġcreate Empty Protocol () ĊĠĠĠĠĠĠĠ Ġval Ġmaster Ġ= ĠStub Master Device Descriptor ( Ġ" Stub " Ġ) ĊĠĠĠĠĠĠĠ Ġprotocol . add Master Device ( Ġmaster Ġ) ĊĠĠĠĠĠĠĠ Ġval Ġdeployment Ġ= Ġstudy Deployment For ( Ġprotocol Ġ) ĊĠĠĠĠĠĠĠ Ġval Ġregistration Ġ= ĠDefault Device Registration ( Ġ" 0 " Ġ) ĊĠĠĠĠĠĠĠ Ġdeployment . register Device ( Ġmaster , Ġregistration Ġ) ĊĊĠĠĠĠĠĠĠ Ġvar Ġserialized : ĠString Ġ= Ġdeployment . get Snapshot (). toJson () ĊĠĠĠĠĠĠĠ Ġserialized Ġ= Ġserialized . make Unknown ( Ġregistration Ġ) ĊĊĠĠĠĠĠĠĠ Ġreturn Ġserialized ĊĠĠĠ Ġ} Ċ } Ċ