package Ġcom . street o graphy . st phot omap . scenes . st phot omap Ċ Ċ import Ġandroid . view . View Ċ import Ġandroidx . test . core . app . Application Provider Ċ import Ġcom . google . android . gms . maps . model . LatLng Ċ import Ġcom . street o graphy . st phot omap . R Ċ import Ġcom . street o graphy . st phot omap . models . coordinate . Coordinate Ċ import Ġcom . street o graphy . st phot omap . models . entity _ level . Entity Level Ċ import Ġcom . street o graphy . st phot omap . models . location . ST Location Ċ import Ġcom . street o graphy . st phot omap . scenes . st phot omap . seeds . ST Photo Map Seed s Ċ import Ġcom . street o graphy . st phot omap . scenes . st phot omap . test . double s . ST Entity Level View Spy Ċ import Ġcom . street o graphy . st phot omap . scenes . st phot omap . test . double s . ST Photo Map Business Logic Spy Ċ import Ġcom . street o graphy . st phot omap . scenes . st phot omap . test . double s . ST Photo MapView Delegate Spy Ċ import Ġcom . street o graphy . st phot omap . scenes . st phot omap . views . ST Location Overlay View Ċ import Ġjunit . framework . TestCase Ċ import Ġorg . junit . After Ċ import Ġorg . junit . Before Ċ import Ġorg . junit . Test Ċ import Ġorg . junit . runner . RunWith Ċ import Ġorg . ro bo lectric . Ro bo lectric TestRunner Ċ import Ġjava . util .* Ċ Ċ @ RunWith ( Ro bo lectric TestRunner :: class ) Ċ class ĠS TP h oto MapView Tests : ĠTestCase () Ġ{ ĊĠĠĠ Ġlateinit Ġvar Ġsut : ĠS TP h oto MapView ĊĠĠĠ Ġlateinit Ġvar Ġinter actor Spy : ĠS TP h oto Map Business Logic Spy ĊĠĠĠ Ġlateinit Ġvar Ġentity Level View Spy : ĠSTE ntity Level View Spy ĊĊĠĠĠ Ġprivate Ġfun Ġsetup Subject UnderTest () Ġ{ ĊĠĠĠĠĠĠĠ Ġthis . sut Ġ= ĠS TP h oto MapView ( Application Provider . getApplicationContext ()) ĊĊĠĠĠĠĠĠĠ Ġthis . inter actor Spy Ġ= ĠS TP h oto Map Business Logic Spy () ĊĠĠĠĠĠĠĠ Ġthis . sut . inter actor Ġ= Ġthis . inter actor Spy ĊĠĠĠĠĠĠĠ Ġthis . entity Level View Spy Ġ= ĠSTE ntity Level View Spy ( Application Provider . getApplicationContext ()) ĊĠĠĠĠĠĠĠ Ġthis . sut . entity Level View Ġ= Ġthis . entity Level View Spy ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Before ĊĠĠĠ Ġpublic Ġoverride Ġfun ĠsetUp () Ġ{ ĊĠĠĠĠĠĠĠ Ġsuper . setUp () ĊĠĠĠĠĠĠĠ Ġthis . setup Subject UnderTest () ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ After ĊĠĠĠ Ġpublic Ġoverride Ġfun ĠtearDown () Ġ{ ĊĠĠĠĠĠĠĠ Ġsuper . te ar Down () ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ// region ĠBusiness Ġlogic Ġtests ĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġtest Should Update Visible Tiles When Camera Idle () Ġ{ ĊĠĠĠĠĠĠĠ Ġthis . sut . on Camera Idle () ĊĠĠĠĠĠĠĠ ĠassertTrue (" The Ġinter actor Ġshould Ġupdate Ġvisible Ġtiles Ġwhen Ġcamera Ġis Ġon Ġidle .", Ġthis . inter actor Spy . should Update Visible Tiles Called ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġtest Should Det ermine Entity Level When Camera Idle () Ġ{ ĊĠĠĠĠĠĠĠ Ġthis . sut . on Camera Idle () ĊĠĠĠĠĠĠĠ ĠassertTrue (" The Ġinter actor Ġshould Ġdetermine Ġentity Ġlevel Ġwhen Ġcamera Ġis Ġon Ġidle .", Ġthis . inter actor Spy . should Det ermine Entity Level Called ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġtest Should Cache Geo json Objects When Camera Idle () Ġ{ ĊĠĠĠĠĠĠĠ Ġthis . sut . on Camera Idle () ĊĠĠĠĠĠĠĠ ĠassertTrue ( this . inter actor Spy . should Cache Geo json Objects Called ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġtest Should Update BoundingBox Parameter When On Camera Move () Ġ{ ĊĠĠĠĠĠĠĠ Ġthis . sut . on Camera Move () ĊĠĠĠĠĠĠĠ ĠassertTrue ( this . inter actor Spy . should Update BoundingBox Called ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġtest Should Det ermine Location Level When Camera Idle () Ġ{ ĊĠĠĠĠĠĠĠ Ġthis . sut . on Camera Idle () ĊĠĠĠĠĠĠĠ ĠassertTrue (" The Ġinter actor Ġshould Ġdetermine Ġlocation Ġlevel Ġwhen Ġcamera Ġis Ġon Ġidle .", Ġthis . inter actor Spy . should Det ermine Location Level Called ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġtest Should Navigate To Photo Details When Photo Map Marker Handler Did Re select Photo () Ġ{ ĊĠĠĠĠĠĠĠ Ġthis . sut . photo Map Marker Handler Did Re select Photo (" photo Id ") ĊĠĠĠĠĠĠĠ ĠassertTrue ( this . inter actor Spy . should Navigate To Photo Details Called ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġtest Should Get Photo Details For Photo Marker When Photo Map Marker Handler Did Select Photo () Ġ{ ĊĠĠĠĠĠĠĠ Ġthis . sut . photo Map Marker Handler Did Select Photo (" photo Id ") ĊĠĠĠĠĠĠĠ ĠassertTrue ( this . inter actor Spy . should Get Photo Details For Photo Marker Called ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġtest Should Navigate To Photo Collection When OnClick On Map () Ġ{ ĊĠĠĠĠĠĠĠ Ġthis . sut . on Map Click ( LatLng ( 5 0 . 0 , Ġ 5 0 . 0 )) ĊĠĠĠĠĠĠĠ ĠassertTrue ( this . inter actor Spy . should Navigate To Photo Collection Called ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġtest Should Zoom To Coordinate For When Photo Marker () Ġ{ ĊĠĠĠĠĠĠĠ Ġthis . sut . photo Map Marker Handler Zoom To Coordinate ( Coordinate ( 5 0 . 0 , Ġ 5 0 . 0 )) ĊĠĠĠĠĠĠĠ ĠassertTrue ( this . inter actor Spy . should Zoom To Coordinate Called ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġtest Should Ask For Location Permissions When User Did Click User Location Button () Ġ{ ĊĠĠĠĠĠĠĠ Ġthis . sut . did Click User Location Button () ĊĠĠĠĠĠĠĠ ĠassertTrue ( this . inter actor Spy . should Ask For Location Permissions Called ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġtest Request User Location Should Ask The Interactor To Request User Location () Ġ{ ĊĠĠĠĠĠĠĠ Ġthis . sut . request User Location () ĊĠĠĠĠĠĠĠ ĠassertTrue ( this . inter actor Spy . should Request User Location Called ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġtest Should Open Data Sources Link When User Did Click Data Sources Button () Ġ{ ĊĠĠĠĠĠĠĠ Ġthis . sut . did Click Data Sources Button () ĊĠĠĠĠĠĠĠ ĠassertTrue ( this . inter actor Spy . should Open Data Sources Link Called ) ĊĠĠĠ Ġ} ĊĠĠĠ Ġ// endregion ĊĊĠĠĠ Ġ// region ĠDisplay Ġlogic Ġtests ĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġtest Display Loading State () Ġ{ ĊĠĠĠĠĠĠĠ Ġthis . sut . progress Bar ?. visibility Ġ= ĠView . GONE ĊĠĠĠĠĠĠĠ Ġthis . sut . progress Bar ?. progress Ġ= Ġ 0 ĊĊĠĠĠĠĠĠĠ Ġthis . sut . display Loading State () ĊĊĠĠĠĠĠĠĠ Ġthis . sut . post Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ ĠassertEquals ( View . VISIBLE , Ġthis . sut . progress Bar ?. visibility ) ĊĠĠĠĠĠĠĠĠĠĠĠ ĠassertEquals ( 1 0 0 , Ġthis . sut . progress Bar ?. progress ) ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġtest Display Not Loading State () Ġ{ ĊĠĠĠĠĠĠĠ Ġthis . sut . progress Bar ?. visibility Ġ= ĠView . VISIBLE ĊĠĠĠĠĠĠĠ Ġthis . sut . progress Bar ?. progress Ġ= Ġ 1 0 0 ĊĊĠĠĠĠĠĠĠ Ġthis . sut . display Not Loading State () ĊĊĠĠĠĠĠĠĠ Ġthis . sut . post Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ ĠassertEquals ( View . GONE , Ġthis . sut . progress Bar ?. visibility ) ĊĠĠĠĠĠĠĠĠĠĠĠ ĠassertEquals ( 0 , Ġthis . sut . progress Bar ?. progress ) ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġtest Display Entity Level () Ġ{ ĊĠĠĠĠĠĠĠ Ġval ĠviewModel Ġ= ĠS TP h oto Map Models . Entity Zoom Level . ViewModel ( R . string . st _ photo _ map _ block _ level _ title , ĠR . drawable . st _ entity _ level _ location ) ĊĠĠĠĠĠĠĠ Ġthis . sut . display Entity Level ( viewModel ) ĊĊĠĠĠĠĠĠĠ ĠassertTrue ( this . entity Level View Spy . setTitle Called ) ĊĠĠĠĠĠĠĠ ĠassertTrue ( this . entity Level View Spy . setImage Called ) ĊĠĠĠĠĠĠĠ ĠassertTrue ( this . entity Level View Spy . show Called ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġtest Display Navigate To Photo Details () Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġdelegate Spy Ġ= ĠS TP h oto MapView Delegate Spy () ĊĠĠĠĠĠĠĠ Ġthis . sut . delegate Ġ= Ġdelegate Spy ĊĊĠĠĠĠĠĠĠ Ġthis . sut . display Navigate To Photo Details ( ST Photo Map Models . Photo Details Navigation . ViewModel (" photo Id ")) ĊĠĠĠĠĠĠĠ ĠassertTrue ( delegate Spy . photo MapView Navigate To Photo Details For Photo Id Called ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġtest Display Navigate To Photo Collection () Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġdelegate Spy Ġ= ĠS TP h oto MapView Delegate Spy () ĊĠĠĠĠĠĠĠ Ġthis . sut . delegate Ġ= Ġdelegate Spy ĊĊĠĠĠĠĠĠĠ Ġthis . sut . display Navigate To Photo Collection ( ST Photo Map Models . Photo Collection Navigation . ViewModel ( ST Location ( 5 0 . 0 , Ġ 5 0 . 0 ), ĠEntity Level . city , Ġ" userId ", Ġnull )) ĊĠĠĠĠĠĠĠ ĠassertTrue ( delegate Spy . photo MapView Navigate To Photo Collection Called ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġtest Display Location Overlay Should Show Location Overlay View () Ġ{ ĊĠĠĠĠĠĠĠ Ġthis . sut . location Overlay View ?. visibility Ġ= ĠView . GONE ĊĊĠĠĠĠĠĠĠ Ġthis . sut . display Location Overlay ( ST Photo Map Models . Location Overlay . ViewModel (" photo Id ", Ġ" Title ", Ġ" 2 7 ĠMay , Ġ 2 0 1 9 ", Ġ" Description ")) ĊĊĠĠĠĠĠĠĠ Ġthis . sut . post Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ ĠassertEquals ( View . VISIBLE , Ġthis . sut . location Overlay View ?. visibility ) ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġtest Display Location Overlay Should Update Location Overlay ViewModel () Ġ{ ĊĠĠĠĠĠĠĠ Ġthis . sut . location Overlay View ?. model Ġ= ĠST Location Overlay View . Model (" photo Id ", Ġ" Title ", Ġ" 2 7 ĠMay , Ġ 2 0 1 9 ", Ġ" Description ") ĊĊĠĠĠĠĠĠĠ Ġval Ġphoto Id Ġ= Ġ" new Photo Id " ĊĠĠĠĠĠĠĠ Ġval Ġtitle Ġ= Ġ" New Ġtitle " ĊĠĠĠĠĠĠĠ Ġval Ġtime Ġ= Ġ" 1 9 ĠJuly , Ġ 2 0 1 9 " ĊĠĠĠĠĠĠĠ Ġval Ġdescription Ġ= Ġ" New Ġdescription " ĊĠĠĠĠĠĠĠ Ġthis . sut . display Location Overlay ( ST Photo Map Models . Location Overlay . ViewModel ( photo Id , Ġtitle , Ġtime , Ġdescription )) ĊĊĠĠĠĠĠĠĠ Ġthis . sut . post Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ ĠassertEquals ( photo Id , Ġthis . sut . location Overlay View ?. model ?. photo Id ) ĊĠĠĠĠĠĠĠĠĠĠĠ ĠassertEquals ( title , Ġthis . sut . location Overlay View ?. model ?. title ) ĊĠĠĠĠĠĠĠĠĠĠĠ ĠassertEquals ( time , Ġthis . sut . location Overlay View ?. model ?. time ) ĊĠĠĠĠĠĠĠĠĠĠĠ ĠassertEquals ( description , Ġthis . sut . location Overlay View ?. model ?. description ) ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġtest Display Remove Location Overlay Should Hide Location Overlay View () Ġ{ ĊĠĠĠĠĠĠĠ Ġthis . sut . location Overlay View ?. visibility Ġ= ĠView . VISIBLE ĊĊĠĠĠĠĠĠĠ Ġthis . sut . display Remove Location Overlay () ĊĊĠĠĠĠĠĠĠ Ġthis . sut . post Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ ĠassertEquals ( View . GONE , Ġthis . sut . location Overlay View ?. visibility ) ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġtest Display Remove Location Overlay Should Remove Location Overlay Model () Ġ{ ĊĠĠĠĠĠĠĠ Ġthis . sut . location Overlay View ?. model Ġ= ĠST Location Overlay View . Model (" photo Id ", Ġ" Title ", Ġ" 2 7 ĠMay , Ġ 2 0 1 9 ", Ġ" Description ") ĊĊĠĠĠĠĠĠĠ Ġthis . sut . display Remove Location Overlay () ĊĊĠĠĠĠĠĠĠ Ġthis . sut . post Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ ĠassertNull ( this . sut . location Overlay View ?. model ) ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠ Ġ} ĊĠĠĠ Ġ// endregion ĊĊĠĠĠ Ġ// region ĠLocation Ġlevel ĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġtest Display Location Markers () Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġphoto Markers Ġ= ĠS TP h oto Map Seed s (). photo Markers () ĊĊĠĠĠĠĠĠĠ ĠTimer (). schedule ( object Ġ: ĠTimer Task () Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġoverride Ġfun Ġrun () Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġsut . move Map Camera To ( photo Markers . get ( 0 ). position ) ĊĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġval ĠviewModel Ġ= ĠS TP h oto Map Models . Location Markers . ViewModel ( photo Markers ) ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġsut . display Location Markers ( viewModel ) ĊĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ ĠassertEquals ( sut . marker Handler ?. markers ?. size , Ġphoto Markers . size ) ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ ĠassertEquals ( sut . marker Handler ?. cluster Manager ?. marker Collection ?. markers ?. size , Ġphoto Markers . size ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ} ĊĠĠĠĠĠĠĠ Ġ}, Ġ 5 0 0 0 ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġtest Display Remove Location Markers () Ġ{ ĊĠĠĠĠĠĠĠ ĠTimer (). schedule ( object Ġ: ĠTimer Task () Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġoverride Ġfun Ġrun () Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġsut . display Remove Location Markers () ĊĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ ĠassertEquals ( sut . marker Handler ?. markers ?. size , Ġ 0 ) ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ ĠassertEquals ( sut . marker Handler ?. cluster Manager ?. marker Collection ?. markers ?. size , Ġ 0 ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ} ĊĠĠĠĠĠĠĠ Ġ}, Ġ 5 0 0 0 ) ĊĠĠĠ Ġ} ĊĠĠĠ Ġ// endregion Ċ }