package Ġcom . sk sam uel . avro 4 k . io Ċ Ċ import Ġio . kot est . core . spec . style . String Spec Ċ import Ġio . kot est . matchers . should Ċ import Ġio . kot est . matchers . should Not Ċ import Ġio . kot est . matchers . string . contain Ċ import Ġkotlinx . serialization . Serializable Ċ import Ġorg . apache . avro . file . Codec Factory Ċ import Ġjava . io . ByteArray OutputStream Ċ Ċ class ĠAv ro Data OutputStream Codec Test Ġ: ĠString Spec ({ ĊĊĠĠ Ġ@ Serializable ĊĠĠ Ġdata Ġclass ĠComposer ( val Ġname : ĠString , Ġval Ġbirth place : ĠString , Ġval Ġcomposition s : ĠList < String >) ĊĊĠĠ Ġval Ġen nio Ġ= ĠComposer (" enn io Ġmor ric one ", Ġ" rome ", ĠlistOf (" legend Ġof Ġ 1 9 0 0 ", Ġ" ec st asy Ġof Ġgold ")) ĊĊĠĠ Ġ" include Ġschema " Ġ Ġ{ ĊĠĠĠĠĠ Ġval Ġba os Ġ= ĠByteArrayOutputStream () ĊĠĠĠĠĠ Ġval Ġoutput Ġ= ĠAv ro OutputStream . data ( Composer . serializer ()). to ( ba os ) ĊĠĠĠĠĠ Ġoutput . write ( enn io ) ĊĠĠĠĠĠ Ġoutput . close () ĊĠĠĠĠĠ ĠString ( ba os . toByteArray ()) Ġshould Ġcontain (" birth place ") ĊĠĠĠĠĠ ĠString ( ba os . toByteArray ()) Ġshould Ġcontain (" composition s ") ĊĠĠ Ġ} ĊĊĠĠ Ġ" include Ġsn appy Ġcoded Ġin Ġmetadata Ġwhen Ġserialized Ġwith Ġsn appy " Ġ Ġ{ ĊĊĠĠĠĠĠ Ġval Ġba os Ġ= ĠByteArrayOutputStream () ĊĠĠĠĠĠ Ġval Ġoutput Ġ= ĠAv ro OutputStream . data ( Composer . serializer ()) ĊĠĠĠĠĠĠĠĠ Ġ. with Codec ( Codec Factory . sn appy Codec ()) ĊĠĠĠĠĠĠĠĠ Ġ. to ( ba os ) ĊĠĠĠĠĠ Ġoutput . write ( enn io ) ĊĠĠĠĠĠ Ġoutput . close () ĊĠĠĠĠĠ ĠString ( ba os . toByteArray ()) Ġshould Ġcontain (" sn appy ") ĊĠĠĠĠĠ ĠString ( ba os . toByteArray ()) Ġshould Not Ġcontain (" b zip 2 ") ĊĠĠĠĠĠ ĠString ( ba os . toByteArray ()) Ġshould Not Ġcontain (" def late ") ĊĠĠ Ġ} ĊĊĠĠ Ġ" include Ġdef late Ġcoded Ġin Ġmetadata Ġwhen Ġserialized Ġwith Ġdef late " Ġ Ġ{ ĊĠĠĠĠĠ Ġval Ġba os Ġ= ĠByteArrayOutputStream () ĊĠĠĠĠĠ Ġval Ġoutput Ġ= ĠAv ro OutputStream . data ( Composer . serializer ()) ĊĠĠĠĠĠĠĠĠ Ġ. with Codec ( Codec Factory . def late Codec ( Codec Factory . DEFAULT _ DE FL ATE _ LEVEL )) ĊĠĠĠĠĠĠĠĠ Ġ. to ( ba os ) ĊĠĠĠĠĠ Ġoutput . write ( enn io ) ĊĠĠĠĠĠ Ġoutput . close () ĊĠĠĠĠĠ ĠString ( ba os . toByteArray ()) Ġshould Ġcontain (" def late ") ĊĠĠĠĠĠ ĠString ( ba os . toByteArray ()) Ġshould Not Ġcontain (" b zip 2 ") ĊĠĠĠĠĠ ĠString ( ba os . toByteArray ()) Ġshould Not Ġcontain (" sn appy ") ĊĠĠ Ġ} ĊĊĠĠ Ġ" include Ġb zip 2 Ġcoded Ġin Ġmetadata Ġwhen Ġserialized Ġwith Ġb zip 2 " Ġ Ġ{ ĊĠĠĠĠĠ Ġval Ġba os Ġ= ĠByteArrayOutputStream () ĊĠĠĠĠĠ Ġval Ġoutput Ġ= ĠAv ro OutputStream . data ( Composer . serializer ()) ĊĠĠĠĠĠĠĠĠ Ġ. with Codec ( Codec Factory . b zip 2 Codec ()) ĊĠĠĠĠĠĠĠĠ Ġ. to ( ba os ) ĊĠĠĠĠĠ Ġoutput . write ( enn io ) ĊĠĠĠĠĠ Ġoutput . close () ĊĠĠĠĠĠ ĠString ( ba os . toByteArray ()) Ġshould Ġcontain (" b zip 2 ") ĊĠĠĠĠĠ ĠString ( ba os . toByteArray ()) Ġshould Not Ġcontain (" def late ") ĊĠĠĠĠĠ ĠString ( ba os . toByteArray ()) Ġshould Not Ġcontain (" sn appy ") ĊĠĠ Ġ} Ċ Ċ })