package Ġcom . bu . self study Ċ Ċ import Ġandroidx . appcompat . app . AppCompat Delegate Ċ import Ġandroidx . test . core . app . Application Provider Ċ import Ġandroidx . test . ext . junit . runners . Android JUnit 4 Ċ import Ġorg . junit . Before Ċ import Ġorg . junit . Test Ċ import Ġcom . google . common . truth . Truth . assertThat Ċ import Ġorg . junit . runner . RunWith Ċ Ċ @ RunWith ( Android JUnit 4 :: class ) Ċ class ĠApplication Test { ĊĊĠĠĠ Ġlateinit Ġvar Ġapplication : ĠSelf Study Application ĊĊĠĠĠ Ġ@ Before ĊĠĠĠ Ġfun Ġset Context (){ ĊĠĠĠĠĠĠĠ Ġapplication Ġ= ĠApplication Provider . getApplicationContext () ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġcheck AppContext (){ ĊĠĠĠĠĠĠĠ ĠassertThat ( application . packageName ). isEqualTo (" com . bu . self study ") ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġcheck Setting Theme (){ ĊĠĠĠĠĠĠĠ ĠassertThat ( application . getCurrent Theme ()). isIn ( listOf (" day ", Ġ" night ")) ĊĊĠĠĠĠĠĠĠ Ġapplication . set Theme (" day ") ĊĠĠĠĠĠĠĠ ĠassertThat ( application . getCurrent Theme ()). isEqualTo (" day ") ĊĠĠĠĠĠĠĠ ĠassertThat ( AppCompat Delegate . getDefault Night Mode ()). isEqualTo ( AppCompat Delegate . MODE _ N IGHT _ NO ) ĊĊĠĠĠĠĠĠĠ Ġapplication . set Theme (" night ") ĊĠĠĠĠĠĠĠ ĠassertThat ( application . getCurrent Theme ()). isEqualTo (" night ") ĊĠĠĠĠĠĠĠ ĠassertThat ( AppCompat Delegate . getDefault Night Mode ()). isEqualTo ( AppCompat Delegate . MODE _ N IGHT _ YES ) ĊĊĊĠĠĠĠĠĠĠ Ġapplication . set Theme (" any Ġerror Ġtext ") ĊĠĠĠĠĠĠĠ ĠassertThat ( application . getCurrent Theme ()). isEqualTo (" day ") ĊĠĠĠĠĠĠĠ ĠassertThat ( AppCompat Delegate . getDefault Night Mode ()). isEqualTo ( AppCompat Delegate . MODE _ N IGHT _ NO ) ĊĠĠĠ Ġ} ĊĊ Ċ }