package Ġcom . mar cin mos k ala . kotlin app ĊĊ Ċ import Ġandroid . support . test . Instrumentation Registry Ċ import Ġandroid . support . test . filters . Sdk Suppress Ċ import Ġandroid . support . test . rule . Activity Test Rule Ċ import Ġandroid . support . test . runner . Android JUnit 4 Ċ import Ġandroid . support . test . uia utom ator . By Ċ import Ġandroid . support . test . uia utom ator . Ui Device Ċ import Ġandroid . support . test . uia utom ator . Until Ċ import Ġcom . mar cin mos k ala . kotlin app . notification . Notification Publisher Ċ import Ġjunit . framework . Assert . assertEquals Ċ import Ġorg . junit . Rule Ċ import Ġorg . junit . Test Ċ import Ġorg . junit . runner . RunWith ĊĊ Ċ @ RunWith ( Android JUnit 4 :: class ) Ċ @ Sdk Suppress ( min Sdk Version Ġ= Ġ 1 8 ) Ċ class ĠNotification Test Ġ{ ĊĊĠĠĠ Ġ@ Rule Ġ@ Jvm Field Ġvar Ġactivity Test Rule Ġ= ĠActivity Test Rule ( MainActivity :: class . java , Ġtrue , Ġfalse ) ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġshould See Notification Test () Ġ{ ĊĠĠĠĠĠĠĠ Ġactivity Test Rule . launch Activity ( MainActivity Starter . get Intent ( Instrumentation Registry . getTarget Context ())) ĊĊĠĠĠĠĠĠĠ Ġval Ġexpected Title Ġ= ĠNotification Publisher . getText Title ( MainActivity . notification Id ) ĊĠĠĠĠĠĠĠ Ġval Ġexpected Subtitle Ġ= ĠNotification Publisher . getText Subtitle ( MainActivity . notification Time ) ĊĊĠĠĠĠĠĠĠ Ġval Ġdevice Ġ= ĠUi Device . getInstance ( Instrumentation Registry . get Instrumentation ()) ĊĠĠĠĠĠĠĠ Ġdevice . open Notification () ĊĠĠĠĠĠĠĠ Ġdevice . wait ( Until . has Object ( By . text ( expected Title )), Ġ 5 0 0 0 ) ĊĠĠĠĠĠĠĠ ĠassertEquals ( expected Title , Ġdevice . find Object ( By . text ( expected Title )). text ) ĊĠĠĠĠĠĠĠ ĠassertEquals ( expected Subtitle , Ġdevice . find Object ( By . text Contains ( expected Subtitle )). text ) ĊĠĠĠĠĠĠĠ Ġdevice . press Back () ĊĠĠĠ Ġ} Ċ } Ċ