package Ġeventually . test . client . activities . re ceiv ers Ċ Ċ import Ġandroid . content . Context Ċ import Ġandroid . content . Intent Ċ import Ġeventually . client . activities . re ceiv ers . System Started Receiver Ċ import Ġeventually . client . scheduling . Scheduler Service Ċ import Ġio . mock k . every Ċ import Ġio . mock k . mock k Ċ import Ġio . mock k . slot Ċ import Ġorg . hamcrest . Core Matchers . equalTo Ċ import Ġorg . hamcrest . Matcher Assert . assertThat Ċ 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 Ċ Ċ @ RunWith ( Ro bo lectric TestRunner :: class ) Ċ @ Config ( sdk Ġ= Ġ[ Config . OL DEST _ SDK ]) Ċ class ĠSystem Started Receiver Spec Ġ{ ĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġstart Scheduler Service On Boot () Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġintent Ġ= Ġslot < Intent >() ĊĊĠĠĠĠĠĠĠ Ġval Ġcontext Ġ= Ġmock k < Context >( relax ed Ġ= Ġtrue ) ĊĠĠĠĠĠĠĠ Ġevery Ġ{ Ġcontext . packageName Ġ} Ġreturns Ġ" test " ĊĠĠĠĠĠĠĠ Ġevery Ġ{ Ġcontext . start Foreground Service ( capture ( intent )) Ġ} Ġreturns Ġnull ĊĊĠĠĠĠĠĠĠ Ġval Ġreceiver Ġ= ĠSystem Started Receiver () ĊĠĠĠĠĠĠĠ Ġreceiver . on Receive ( ĊĠĠĠĠĠĠĠĠĠĠĠ Ġcontext , ĊĠĠĠĠĠĠĠĠĠĠĠ ĠIntent ( context , ĠSystem Started Receiver :: class . java ). apply Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġaction Ġ= ĠIntent . ACTION _ BOOT _ COMPLETED ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ} ĊĠĠĠĠĠĠĠ Ġ) ĊĊĠĠĠĠĠĠĠ ĠassertThat ( intent . captured . component ?. className , ĠequalTo ( Scheduler Service :: class . java . name )) ĊĠĠĠĠĠĠĠ ĠassertThat ( intent . captured . action , ĠequalTo ( null )) ĊĠĠĠ Ġ} Ċ } Ċ