package Ġcom . m del bel . android . ped idos ya . presentation . location Ċ Ċ import Ġandroidx . arch . core . executor . testing . Instant Task Executor Rule Ċ import Ġcom . google . common . truth . Truth . assertThat Ċ import Ġcom . m del bel . android . ped idos ya . domain . Point Ċ import Ġcom . m del bel . android . ped idos ya . gateway . location . User Location Repository Ċ import Ġcom . n ha ar man . mock it ok otlin 2 . any Ċ import Ġcom . n ha ar man . mock it ok otlin 2 . do Return Ċ import Ġcom . n ha ar man . mock it ok otlin 2 . mock Ċ import Ġcom . n ha ar man . mock it ok otlin 2 . verify Ċ import Ġorg . junit . Rule Ċ import Ġorg . junit . Test Ċ Ċ class ĠUser Location ViewModel Test Ġ{ ĊĊĠĠĠ Ġ@ get : Rule ĊĠĠĠ Ġvar Ġtest Rule Ġ= ĠInstant Task Executor Rule () ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġ` viewModel Ġcreation Ġshould Ġpost Ġlast Ġknown Ġlocation `() Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġexpected Ġ= Ġmock < Point >() ĊĠĠĠĠĠĠĠ Ġval Ġuser Location Repository Ġ= Ġmock < User Location Repository > Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġon Ġ{ Ġobtain Last Known ( any ()) Ġ} Ġdo Return Ġexpected ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠĠĠĠĠ Ġval ĠviewModel Ġ= ĠUser Location ViewModel ( user Location Repository ) ĊĊĠĠĠĠĠĠĠ Ġval Ġpoint Ġ= ĠviewModel . location . value ĊĊĠĠĠĠĠĠĠ ĠassertThat ( point ). isEqualTo ( expected ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġ` viewModel Ġcreation Ġshould Ġpass ĠMont e video Ġas Ġdefault `() Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġuser Location Repository Ġ= Ġmock < User Location Repository >() ĊĠĠĠĠĠĠĠ ĠUser Location ViewModel ( user Location Repository ) ĊĊĠĠĠĠĠĠĠ Ġverify ( user Location Repository ). obtain Last Known ( Point . Mont e video ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġ` update Ġshould Ġnotify Ġvalue `() Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġexpected Ġ= Ġmock < Point >() ĊĠĠĠĠĠĠĠ Ġval Ġuser Location Repository Ġ= Ġmock < User Location Repository >() ĊĠĠĠĠĠĠĠ Ġval ĠviewModel Ġ= ĠUser Location ViewModel ( user Location Repository ) ĊĊĠĠĠĠĠĠĠ ĠviewModel . update ( expected ) ĊĊĠĠĠĠĠĠĠ ĠassertThat ( viewModel . location . value ). isEqualTo ( expected ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġ` save Ġshould Ġupdate Ġvalue Ġon Ġrepository `() Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġexpected Ġ= Ġmock < Point >() ĊĠĠĠĠĠĠĠ Ġval Ġuser Location Repository Ġ= Ġmock < User Location Repository >() ĊĠĠĠĠĠĠĠ Ġval ĠviewModel Ġ= ĠUser Location ViewModel ( user Location Repository ) ĊĊĠĠĠĠĠĠĠ ĠviewModel . save ( expected ) ĊĊĠĠĠĠĠĠĠ Ġverify ( user Location Repository ). save ( expected ) ĊĠĠĠ Ġ} Ċ }