package Ġcom . cle vert ap . android . x ps Ċ Ċ import Ġandroid . content . Context Ċ import Ġcom . cle vert ap . android . shared . test . Base TestCase Ċ import Ġcom . cle vert ap . android . shared . test . Test Application Ċ import Ġcom . xia omi . mip ush . sdk . Mi Push Command Message Ċ import Ġcom . xia omi . mip ush . sdk . Mi Push Message Ċ import Ġorg . junit .* Ċ import Ġorg . junit . runner .* Ċ import Ġorg . mockito . Mockito .* Ċ import Ġorg . ro bo lectric . Ro bo lectric TestRunner Ċ import Ġorg . ro bo lectric . annotation . Config Ċ Ċ @ RunWith ( Ro bo lectric TestRunner :: class ) Ċ @ Config ( sdk Ġ= Ġ[ 2 8 ], Ġapplication Ġ= ĠTest Application :: class ) Ċ class ĠX ia omi Message Receiver Test Ġ: ĠBase TestCase () Ġ{ ĊĊĠĠĠ Ġprivate Ġlateinit Ġvar Ġreceiver : ĠX ia omi Message Receiver ĊĠĠĠ Ġprivate Ġlateinit Ġvar Ġm Handler CT : ĠC TX ia omi MessageHandler ĊĊĠĠĠ Ġ@ Before ĊĠĠĠ Ġoverride Ġfun ĠsetUp () Ġ{ ĊĠĠĠĠĠĠĠ Ġsuper . setUp () ĊĠĠĠĠĠĠĠ Ġreceiver Ġ= ĠX ia omi Message Receiver () ĊĠĠĠĠĠĠĠ Ġm Handler CT Ġ= Ġmock ( CTX ia omi MessageHandler :: class . java ) ĊĠĠĠĠĠĠĠ Ġreceiver . set Handler ( m Handler CT ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġtest On Receive Pass Through Message () Ġ{ ĊĠĠĠĠĠĠĠ Ġreceiver . on Receive Pass Through Message ( application , ĠMi Push Message ()) ĊĠĠĠĠĠĠĠ Ġverify ( m Handler CT ). create Notification ( any ( Context :: class . java ), Ġany ( Mi Push Message :: class . java )) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġtest On Receive Register Result () Ġ{ ĊĠĠĠĠĠĠĠ Ġreceiver . on Receive Register Result ( application , ĠMi Push Command Message ()) ĊĠĠĠĠĠĠĠ Ġverify ( m Handler CT ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. on Receive Register Result ( any ( Context :: class . java ), Ġany ( Mi Push Command Message :: class . java )) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġtest On Notification Message Ar rived () Ġ{ ĊĠĠĠĠĠĠĠ Ġreceiver . on Notification Message Ar rived ( application , ĠMi Push Message ()) ĊĠĠĠĠĠĠĠ Ġverify ( m Handler CT ). create Notification ( any ( Context :: class . java ), Ġany ( Mi Push Message :: class . java )) ĊĠĠĠ Ġ} Ċ }