package Ġio . cl app r . player . app . plugin Ċ Ċ import Ġandroid . app . Application Ċ import Ġandroid . widget . TextView Ċ import Ġio . cl app r . player . Build Config Ċ import Ġio . cl app r . player . app . R Ċ import Ġio . cl app r . player . app . plugin . util . Fake Playback Ċ import Ġio . cl app r . player . app . plugin . assert Plugin . assert Ui Plugin Hidden Ċ import Ġio . cl app r . player . app . plugin . assert Plugin . assert Ui Plugin Shown Ċ import Ġio . cl app r . player . base . Base Object Ċ import Ġio . cl app r . player . base . Event Ċ import Ġio . cl app r . player . base . Options Ċ import Ġio . cl app r . player . components . Container Ċ import Ġio . cl app r . player . plugin . Loader Ċ import Ġorg . junit . Before Ċ import Ġorg . junit . Test Ċ import Ġorg . junit . runner . RunWith Ċ import Ġorg . ro bo lectric . Ro bo lectric TestRunner Ċ import Ġorg . ro bo lectric . annotation . Config Ċ import Ġorg . ro bo lectric . shadow s . Shadow Application Ċ import Ġkotlin . test . assertEquals Ċ import Ġkotlin . test . assertNotNull Ċ Ċ @ RunWith ( Ro bo lectric TestRunner :: class ) Ċ @ Config ( constants Ġ= ĠBuild Config :: class , Ġsdk Ġ= Ġ[ 2 3 ], Ġapplication Ġ= ĠApplication :: class ) Ċ class ĠPlay back Status Plugin Test Ġ{ ĊĊĠĠĠ Ġprivate Ġlateinit Ġvar Ġcontainer : ĠContainer ĊĊĠĠĠ Ġprivate Ġlateinit Ġvar Ġplayback Status Plugin : ĠPlay back Status Plugin ĊĊĠĠĠ Ġprivate Ġval Ġsource Ġ= Ġ" url " ĊĊĠĠĠ Ġ@ Before ĊĠĠĠ Ġfun Ġsetup () Ġ{ ĊĠĠĠĠĠĠĠ ĠBase Object . application Context Ġ= ĠShadow Application . getInstance (). application Context ĊĊĠĠĠĠĠĠĠ Ġcontainer Ġ= ĠContainer ( Options ( source Ġ= Ġsource )) ĊĊĠĠĠĠĠĠĠ Ġplayback Status Plugin Ġ= ĠPlay back Status Plugin ( container ) ĊĊĠĠĠĠĠĠĠ Ġ// Trigger ĠPlay back Ġchange Ġevents ĊĠĠĠĠĠĠĠ Ġcontainer . playback Ġ= ĠFake Playback ("") ĊĊĠĠĠĠĠĠĠ Ġplayback Status Plugin . render () ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġshould Hide View After DidChange Playback Event Is Triggered () Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġnew Playback Ġ= ĠFake Playback ( source ) ĊĠĠĠĠĠĠĠ Ġcontainer . playback Ġ= Ġnew Playback ĊĊĠĠĠĠĠĠĠ Ġassert Ui Plugin Hidden ( playback Status Plugin ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġshould Show View When St all ing Event Is Triggered () Ġ{ ĊĠĠĠĠĠĠĠ Ġassert Label On Event ( Event . ST ALL ING . value ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġshould Show View When Did Pause Event Is Triggered () Ġ{ ĊĠĠĠĠĠĠĠ Ġassert Label On Event ( Event . DID _ PAUSE . value ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġshould Show View W he Did Stop Event Is Triggered () Ġ{ ĊĠĠĠĠĠĠĠ Ġassert Label On Event ( Event . DID _ STOP . value ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġshould Show View When Did Complete Event Is Triggered () Ġ{ ĊĠĠĠĠĠĠĠ Ġassert Label On Event ( Event . DID _ COMPLETE . value ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġshould Show View When Error Event Is Triggered () Ġ{ ĊĠĠĠĠĠĠĠ Ġassert Label On Event ( Event . ERROR . value ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġshould Stop Listening Old Playback When DidChange Playback Event Is Triggered () Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġold Playback Ġ= Ġcontainer . playback ĊĊĠĠĠĠĠĠĠ Ġassert Ui Plugin Hidden ( playback Status Plugin ) ĊĊĠĠĠĠĠĠĠ Ġval Ġnew Playback Ġ= ĠFake Playback ( source ) ĊĠĠĠĠĠĠĠ Ġcontainer . playback Ġ= Ġnew Playback ĊĊĠĠĠĠĠĠĠ Ġold Playback ?. trigger ( Event . W ILL _ PLAY . value ) ĊĊĠĠĠĠĠĠĠ Ġassert Ui Plugin Hidden ( playback Status Plugin ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġshould Stop Listening Old Playback When Plugin Is Destroyed () Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġold Playback Ġ= Ġcontainer . playback ĊĊĠĠĠĠĠĠĠ Ġplayback Status Plugin . destroy () ĊĊĠĠĠĠĠĠĠ Ġold Playback ?. trigger ( Event . W ILL _ PLAY . value ) ĊĊĠĠĠĠĠĠĠ Ġassert Ui Plugin Hidden ( playback Status Plugin ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġprivate Ġfun Ġassert Label On Event ( eventName : ĠString ) Ġ{ ĊĠĠĠĠĠĠĠ Ġcontainer . playback ?. trigger ( eventName ) ĊĊĠĠĠĠĠĠĠ Ġassert Text ( eventName ) ĊĠĠĠĠĠĠĠ Ġassert Ui Plugin Shown ( playback Status Plugin ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġprivate Ġfun Ġassert Text ( text : ĠString ) Ġ{ ĊĠĠĠĠĠĠĠ Ġplayback Status Plugin . view . findViewById < TextView >( R . id . status ). let Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ ĠassertNotNull ( it ) ĊĠĠĠĠĠĠĠĠĠĠĠ ĠassertEquals ( text , Ġit . text . toString ()) ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠ Ġ} Ċ }