/* Ċ Ġ* ĠCopyright Ġ( C ) Ġ 2 0 1 9 ĠThe ĠAndroid ĠOpen ĠSource ĠProject Ċ Ġ* Ċ Ġ* ĠLicensed Ġunder Ġthe ĠApache ĠLicense , ĠVersion Ġ 2 . 0 Ġ( the Ġ" License "); Ċ Ġ* Ġyou Ġmay Ġnot Ġuse Ġthis Ġfile Ġexcept Ġin Ġcompliance Ġwith Ġthe ĠLicense . Ċ Ġ* ĠYou Ġmay Ġobtain Ġa Ġcopy Ġof Ġthe ĠLicense Ġat Ċ Ġ* Ċ Ġ* ĠĠĠĠĠ Ġhttp :// www . apache . org / licenses / LICENSE - 2 . 0 Ċ Ġ* Ċ Ġ* ĠUnless Ġrequired Ġby Ġapplicable Ġlaw Ġor Ġagreed Ġto Ġin Ġwriting , Ġsoftware Ċ Ġ* Ġdistributed Ġunder Ġthe ĠLicense Ġis Ġdistributed Ġon Ġan Ġ" AS ĠIS " ĠBASIS , Ċ Ġ* ĠWITHOUT ĠWARRANTIES ĠOR ĠCONDITIONS ĠOF ĠANY ĠKIND , Ġeither Ġexpress Ġor Ġimplied . Ċ Ġ* ĠSee Ġthe ĠLicense Ġfor Ġthe Ġspecific Ġlanguage Ġgoverning Ġpermissions Ġand Ċ Ġ* Ġlimitations Ġunder Ġthe ĠLicense . Ċ Ġ*/ Ċ package Ġcom . android . tools . idea . layout inspector . legacy device Ċ Ċ import Ġcom . android . dd m lib . testing . Fake A db Rule Ċ import Ġcom . android . test utils . Mockito Kt . any Ċ import Ġcom . android . test utils . Mockito Kt . eq Ċ import Ġcom . android . test utils . Property Setter Rule Ċ import Ġcom . android . tools . idea . layout inspector . Layout Inspector Ċ import Ġcom . android . tools . idea . layout inspector . model . Inspector Model Ċ import Ġcom . android . tools . idea . layout inspector . resource . Resource Lookup Ċ import Ġcom . android . tools . idea . layout inspector . transport . Inspector Client Ċ import Ġcom . android . tools . idea . testing . Android Project Rule Ċ import Ġcom . google . common . truth . Truth . assertThat Ċ import Ġorg . jetbrains . kotlin . utils . addTo Std lib . first Is Instance Ċ import Ġorg . junit . Rule Ċ import Ġorg . junit . Test Ċ import Ġorg . mockito . Argument Matchers Ċ import Ġorg . mockito . Argument Matchers . arg That Ċ import Ġorg . mockito . Mockito .` when ` Ċ import Ġorg . mockito . Mockito . mock Ċ import Ġorg . mockito . Mockito . verify Ċ Ċ class ĠLegacy Client Test Ġ{ ĊĠ Ġ@ get : Rule ĊĠ Ġval Ġa db Rule Ġ= ĠFake A db Rule () ĊĊĠ Ġ@ get : Rule ĊĠ Ġval Ġproject Rule Ġ= ĠAndroid Project Rule . in Memory () ĊĊĠ Ġ@ get : Rule ĊĠ Ġval Ġclient Factory Rule Ġ= ĠProperty Setter Rule ( ĊĠĠĠ Ġ{ Ġ_, Ġparent Disposable Ġ-> ĠlistOf ( Legacy Client ( Resource Lookup ( project Rule . project ), Ġparent Disposable )) Ġ}, ĊĠĠĠ ĠIns pector Client . Companion :: client Factory ) ĊĊĠ Ġ@ Test ĊĠ Ġfun Ġtest Reload All Windows () Ġ{ ĊĠĠĠ Ġval Ġinspector Ġ= ĠLayout Inspector ( Inspector Model ( project Rule . project ), Ġproject Rule . fixture . project Disposable ) ĊĠĠĠ Ġval Ġclient Ġ= Ġinspector . all Clients . first Is Instance < Legacy Client >() ĊĊĠĠĠ Ġval Ġloader Ġ= Ġmock ( Legacy Tree Loader :: class . java ) ĊĠĠĠ Ġ` when `( loader . getAll Window Ids ( Argument Matchers . any (), Ġeq ( client ))). thenReturn ( listOf (" window 1 ", Ġ" window 2 ", Ġ" window 3 ")) ĊĠĠĠ Ġclient . tree Loader Ġ= Ġloader ĊĊĠĠĠ Ġclient . reload All Windows () ĊĠĠĠ Ġverify ( loader ). load Component Tree ( arg That Ġ{ Ġevent : ĠLegacy Event Ġ-> Ġevent . window Id Ġ== Ġ" window 1 " Ġ}, ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġany ( Resource Lookup :: class . java ), Ġeq ( client ), Ġeq ( project Rule . project )) ĊĠĠĠ Ġverify ( loader ). load Component Tree ( arg That Ġ{ Ġevent : ĠLegacy Event Ġ-> Ġevent . window Id Ġ== Ġ" window 2 " Ġ}, ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġany ( Resource Lookup :: class . java ), Ġeq ( client ), Ġeq ( project Rule . project )) ĊĠĠĠ Ġverify ( loader ). load Component Tree ( arg That Ġ{ Ġevent : ĠLegacy Event Ġ-> Ġevent . window Id Ġ== Ġ" window 3 " Ġ}, ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġany ( Resource Lookup :: class . java ), Ġeq ( client ), Ġeq ( project Rule . project )) ĊĠ Ġ} ĊĊĠ Ġ@ Test ĊĠ Ġfun Ġtest Reload All Windows With None () Ġ{ ĊĠĠĠ Ġval Ġinspector Ġ= ĠLayout Inspector ( Inspector Model ( project Rule . project ), Ġproject Rule . fixture . project Disposable ) ĊĠĠĠ Ġval Ġclient Ġ= Ġinspector . all Clients . first Is Instance < Legacy Client >() ĊĊĠĠĠ Ġval Ġloader Ġ= Ġmock ( Legacy Tree Loader :: class . java ) ĊĠĠĠ Ġ` when `( loader . getAll Window Ids ( Argument Matchers . any (), Ġeq ( client ))). thenReturn ( emptyList ()) ĊĠĠĠ Ġclient . tree Loader Ġ= Ġloader ĊĊĠĠĠ ĠassertThat ( client . reload All Windows ()). isFalse () ĊĠ Ġ} Ċ }