package Ġmg . h enk inn . location manager . configuration Ċ Ċ import Ġcom . google . android . gms . location . Location Request Ċ import Ġorg . assertj . core . api . Assertions . assertThat Ċ import Ġorg . hamcrest . Core Matchers Ċ import Ġorg . junit . Rule Ċ import Ġorg . junit . Test Ċ import Ġorg . junit . rules . Expected Exception ĊĊ Ċ class ĠGoogle Play Services Configuration Test Ġ{ ĊĠĠĠ Ġ@ Rule ĊĠĠĠ Ġ@ Jvm Field ĊĠĠĠ Ġvar Ġexpected Exception : ĠExpected Exception Ġ= ĠExpected Exception . none () ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġcheck Default Values () Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġconfiguration Ġ= ĠGoogle Play Services Configuration . Builder (). build () ĊĠĠĠĠĠĠĠ ĠassertThat ( configuration . location Request ()) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. isEqualTo ( create Default Location Request ()) ĊĠĠĠĠĠĠĠ ĠassertThat ( configuration . fallback To Default ()). isTrue ĊĠĠĠĠĠĠĠ ĠassertThat ( configuration . ask For Google Play Services ()). isFalse ĊĠĠĠĠĠĠĠ ĠassertThat ( configuration . ask For Settings Api ()). isTrue ĊĠĠĠĠĠĠĠ ĠassertThat ( configuration . fail On Settings Api Sus pended ()). isFalse ĊĠĠĠĠĠĠĠ ĠassertThat ( configuration . ignore Last K now Location ()). isFalse ĊĠĠĠĠĠĠĠ ĠassertThat ( configuration . google Play Services Wait Period ()) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. isEqualTo (( 2 0 Ġ* ĠSE COND ). to Long ()) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġset Wait Period Should Throw Exception When Google Play Services Wait Period IsSet () Ġ{ ĊĠĠĠĠĠĠĠ Ġexpected Exception . expect ( IllegalArgumentException :: class . java ) ĊĠĠĠĠĠĠĠ Ġexpected Exception . expect Message ( Core Matchers . startsWith (" wait Period ")) ĊĠĠĠĠĠĠĠ ĠGoogle Play Services Configuration . Builder (). set Wait Period (- 1 ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġcl ones Should Share Same Instances () Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġconfiguration : ĠGoogle Play Services Configuration Ġ= ĊĠĠĠĠĠĠĠĠĠĠĠ ĠGoogle Play Services Configuration . Builder (). build () ĊĠĠĠĠĠĠĠ Ġval Ġfirst Clone Ġ= Ġconfiguration . newBuilder (). build () ĊĠĠĠĠĠĠĠ Ġval Ġsecond Clone Ġ= Ġconfiguration . newBuilder (). build () ĊĠĠĠĠĠĠĠ ĠassertThat ( first Clone . location Request ()) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. isEqualTo ( second Clone . location Request ()) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. isEqualTo ( create Default Location Request ()) ĊĠĠĠĠĠĠĠ ĠassertThat ( first Clone . ask For Google Play Services ()) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. isEqualTo ( second Clone . ask For Google Play Services ()) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. isFalse ĊĠĠĠĠĠĠĠ ĠassertThat ( first Clone . ask For Settings Api ()) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. isEqualTo ( second Clone . ask For Settings Api ()) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. isTrue ĊĠĠĠĠĠĠĠ ĠassertThat ( first Clone . fail On Settings Api Sus pended ()) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. isEqualTo ( second Clone . fail On Settings Api Sus pended ()) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. isFalse ĊĠĠĠĠĠĠĠ ĠassertThat ( first Clone . ignore Last K now Location ()) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. isEqualTo ( second Clone . ignore Last K now Location ()) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. isFalse ĊĠĠĠĠĠĠĠ ĠassertThat ( first Clone . google Play Services Wait Period ()) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. isEqualTo ( second Clone . google Play Services Wait Period ()) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. isEqualTo (( 2 0 Ġ* ĠSE COND ). to Long ()) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġprivate Ġfun Ġcreate Default Location Request (): ĠLocation Request Ġ{ ĊĠĠĠĠĠĠĠ Ġreturn ĠLocation Request . create () ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. set Priority ( Location Request . PRIORITY _ BAL ANCED _ POWER _ AC CUR ACY ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. set Interval (( 5 Ġ* ĠMIN UTE ). to Long ()) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. set Fast est Interval ( MINUTE . to Long ()) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġcompanion Ġobject Ġ{ ĊĠĠĠĠĠĠĠ Ġprivate Ġconst Ġval ĠSE COND Ġ= Ġ 1 0 0 0 ĊĠĠĠĠĠĠĠ Ġprivate Ġconst Ġval ĠMIN UTE Ġ= Ġ 6 0 Ġ* ĠSE COND ĊĠĠĠ Ġ} Ċ }