package Ġau . com . di us . p act . provider . junit Ċ Ċ import Ġau . com . di us . p act . provider . junit . loader . P act Broker Ċ import Ġau . com . di us . p act . support . expressions . Expression Parser . parse Expression Ċ import Ġau . com . di us . p act . support . expressions . Expression Parser . parse List Expression Ċ import Ġorg . hamcrest . Core Matchers .` is ` Ċ import Ġorg . hamcrest . Matcher Assert . assertThat Ċ import Ġorg . hamcrest . Matchers . contains Ċ import Ġorg . hamcrest . Matchers . empty Ċ import Ġorg . hamcrest . collection . Is Array With Size . array With Size Ċ import Ġorg . junit . Before Ċ import Ġorg . junit . Test Ċ import Ġjava . util . Properties Ċ Ċ class ĠP act Broker Annotation Defaults Test Ġ{ ĊĊĠĠĠ Ġval Ġannotation : ĠP act Broker Ġ= ĠSample Broker Class :: class . java . getAnnotation ( P act Broker :: class . java ) ĊĊĠĠĠ Ġval Ġprops : ĠProperties Ġ= ĠSystem . getProperties () ĊĊĠĠĠ Ġ@ Before ĊĠĠĠ Ġfun ĠsetUp () Ġ{ ĊĠĠĠĠĠĠĠ Ġclear P act Broker Properties () ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġfun Ġclear P act Broker Properties () Ġ= ĊĠĠĠĠĠĠĠĠĠĠĠ Ġprops . keys ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ. filter Ġ{ Ġit Ġis ĠString Ġ} ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ. map Ġ{ Ġit Ġas ĠString Ġ} ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ. filter Ġ{ Ġit . startsWith (" p act broker ") Ġ} ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ. forEach Ġ{ Ġprops . remove ( it ) Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġ` default Ġhost Ġis Ġempty `() Ġ{ ĊĠĠĠĠĠĠĠ ĠassertThat ( parse Expression ( annotation . host ), Ġ` is ` ("")) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġ` can Ġset Ġhost `() Ġ{ ĊĠĠĠĠĠĠĠ Ġprops . setProperty (" p act broker . host ", Ġ" my Host ") ĊĠĠĠĠĠĠĠ ĠassertThat ( parse Expression ( annotation . host ), Ġ` is ` (" my Host ")) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġ` default Ġport Ġis Ġempty `() Ġ{ ĊĠĠĠĠĠĠĠ ĠassertThat ( parse Expression ( annotation . port ), Ġ` is ` ("")) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġ` can Ġset Ġport `() Ġ{ ĊĠĠĠĠĠĠĠ Ġprops . setProperty (" p act broker . port ", Ġ" my Port ") ĊĠĠĠĠĠĠĠ ĠassertThat ( parse Expression ( annotation . port ), Ġ` is ` (" my Port ")) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġ` default Ġprotocol Ġis Ġhttp `() Ġ{ ĊĠĠĠĠĠĠĠ ĠassertThat ( parse Expression ( annotation . protocol ), Ġ` is ` (" http ")) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġ` can Ġset Ġprotocol `() Ġ{ ĊĠĠĠĠĠĠĠ Ġprops . setProperty (" p act broker . protocol ", Ġ" my Protocol ") ĊĠĠĠĠĠĠĠ ĠassertThat ( parse Expression ( annotation . protocol ), Ġ` is ` (" my Protocol ")) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġ` default Ġtag Ġis Ġlatest `() Ġ{ ĊĠĠĠĠĠĠĠ ĠassertThat ( annotation . tags , Ġarray With Size ( 1 )) ĊĠĠĠĠĠĠĠ ĠassertThat ( parse List Expression ( annotation . tags [ 0 ]), Ġcontains (" latest ")) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġ` can Ġset Ġsingle Ġtags `() Ġ{ ĊĠĠĠĠĠĠĠ Ġprops . setProperty (" p act broker . tags ", Ġ" my Tag ") ĊĠĠĠĠĠĠĠ ĠassertThat ( parse List Expression ( annotation . tags [ 0 ]), Ġcontains (" my Tag ")) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġ` can Ġset Ġmultiple Ġtags `() Ġ{ ĊĠĠĠĠĠĠĠ Ġprops . setProperty (" p act broker . tags ", Ġ" my Tag 1 , my Tag 2 ") ĊĠĠĠĠĠĠĠ ĠassertThat ( parse List Expression ( annotation . tags [ 0 ]), Ġcontains (" my Tag 1 ", Ġ" my Tag 2 ")) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġ` default Ġconsumer Ġfilter Ġis Ġempty Ġ( all Ġconsumers )` () Ġ{ ĊĠĠĠĠĠĠĠ ĠassertThat ( annotation . consum ers , Ġarray With Size ( 1 )) ĊĠĠĠĠĠĠĠ ĠassertThat ( parse List Expression ( annotation . consum ers [ 0 ]), Ġempty ()) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġ` can Ġset Ġsingle Ġconsumer `() Ġ{ ĊĠĠĠĠĠĠĠ Ġprops . setProperty (" p act broker . consum ers ", Ġ" my Consumer ") ĊĠĠĠĠĠĠĠ ĠassertThat ( parse List Expression ( annotation . consum ers [ 0 ]), Ġcontains (" my Consumer ")) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġ` can Ġset Ġmultiple Ġconsumers `() Ġ{ ĊĠĠĠĠĠĠĠ Ġprops . setProperty (" p act broker . consum ers ", Ġ" my Consumer 1 , my Consumer 2 ") ĊĠĠĠĠĠĠĠ ĠassertThat ( parse List Expression ( annotation . consum ers [ 0 ]), Ġcontains (" my Consumer 1 ", Ġ" my Consumer 2 ")) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġ` default Ġauth Ġscheme Ġis Ġbasic `() Ġ{ ĊĠĠĠĠĠĠĠ ĠassertThat ( parse Expression ( annotation . authentication . scheme ), Ġ` is ` (" basic ")) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġ` can Ġset Ġauth Ġscheme `() Ġ{ ĊĠĠĠĠĠĠĠ Ġprops . setProperty (" p act broker . auth . scheme ", Ġ" my Scheme ") ĊĠĠĠĠĠĠĠ ĠassertThat ( parse List Expression ( annotation . authentication . scheme ), Ġcontains (" my Scheme ")) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġ` default Ġauth Ġusername Ġis Ġempty `() Ġ{ ĊĠĠĠĠĠĠĠ ĠassertThat ( parse Expression ( annotation . authentication . username ), Ġ` is ` ("")) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġ` can Ġset Ġauth Ġusername `() Ġ{ ĊĠĠĠĠĠĠĠ Ġprops . setProperty (" p act broker . auth . username ", Ġ" my User ") ĊĠĠĠĠĠĠĠ ĠassertThat ( parse List Expression ( annotation . authentication . username ), Ġcontains (" my User ")) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġ` default Ġauth Ġpassword Ġis Ġempty `() Ġ{ ĊĠĠĠĠĠĠĠ ĠassertThat ( parse Expression ( annotation . authentication . password ), Ġ` is ` ("")) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġ` can Ġset Ġauth Ġpassword `() Ġ{ ĊĠĠĠĠĠĠĠ Ġprops . setProperty (" p act broker . auth . password ", Ġ" my Pass ") ĊĠĠĠĠĠĠĠ ĠassertThat ( parse List Expression ( annotation . authentication . password ), Ġcontains (" my Pass ")) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ P act Broker ĊĠĠĠ Ġclass ĠSample Broker Class Ċ } Ċ