/* Ċ Ġ* ĠCopyright Ġ( C ) Ġ 2 0 1 8 Ġ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 . ui builder . property . support Ċ Ċ import Ġcom . android . Sdk Constants . FRAME _ LAYOUT Ċ import Ġcom . android . Sdk Constants . TEXT _ VIEW Ċ import Ġcom . android . tools . idea . ui builder . property . test utils . Support TestUtil Ċ import Ġcom . android . tools . property . panel . api . EnumValue Ċ import Ġcom . android . tools . property . panel . api . Header EnumValue Ċ import Ġcom . google . common . truth . Truth . assertThat Ċ import Ġcom . intellij . openapi . application . Application Manager Ċ import Ġorg . intellij . lang . annotations . Language Ċ import Ġorg . jetbrains . android . Android TestCase Ċ import Ġjava . util . concurrent . Callable Ċ Ċ @ Language (" JAVA ") Ċ private Ġconst Ġval ĠMAIN _ ACTIVITY Ġ= Ġ""" ĊĠ Ġpackage Ġp 1 . p 2 ; ĊĊĠ Ġimport Ġandroid . app . Activity ; ĊĠ Ġimport Ġandroid . os . Bundle ; ĊĠ Ġimport Ġandroid . view . View ; ĊĊĠ Ġpublic Ġclass ĠMainActivity Ġextends ĠActivity Ġ{ ĊĊĠĠĠ Ġ@ Override ĊĠĠĠ Ġprotected Ġvoid ĠonCreate ( Bundle ĠsavedInstanceState ) Ġ{ ĊĠĠĠĠĠ Ġsuper . onCreate ( savedInstanceState ); ĊĠĠĠĠĠ ĠsetContentView ( R . layout . activity _ main ); ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġpublic Ġvoid ĠonClick ( View Ġview ) Ġ{ ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġpublic Ġvoid Ġhelp ( View Ġview ) Ġ{ ĊĠĠĠ Ġ} ĊĠ Ġ} Ċ """ Ċ Ċ @ Language (" JAVA ") Ċ private Ġconst Ġval ĠOTHER _ ACTIVITY Ġ= Ġ""" ĊĠ Ġpackage Ġp 1 . p 2 ; ĊĊĠ Ġimport Ġandroid . app . Activity ; ĊĠ Ġimport Ġandroid . os . Bundle ; ĊĠ Ġimport Ġandroid . view . View ; ĊĊĠ Ġpublic Ġclass ĠOther Activity Ġextends ĠActivity Ġ{ ĊĊĠĠĠ Ġ@ Override ĊĠĠĠ Ġprotected Ġvoid ĠonCreate ( Bundle ĠsavedInstanceState ) Ġ{ ĊĠĠĠĠĠ Ġsuper . onCreate ( savedInstanceState ); ĊĠĠĠĠĠ ĠsetContentView ( R . layout . activity _ main ); ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġpublic Ġvoid ĠonClick ( View Ġview ) Ġ{ ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġpublic Ġvoid Ġstart Processing ( View Ġview ) Ġ{ ĊĠĠĠ Ġ} ĊĠ Ġ} Ċ """ Ċ Ċ @ Language (" JAVA ") Ċ private Ġconst Ġval ĠTH IRD _ ACTIVITY Ġ= Ġ""" ĊĠ Ġpackage Ġp 1 . p 2 ; ĊĊĠ Ġimport Ġandroid . app . Activity ; ĊĠ Ġimport Ġandroid . os . Bundle ; ĊĠ Ġimport Ġandroid . view . View ; ĊĊĠ Ġpublic Ġclass ĠThird Activity Ġextends ĠActivity Ġ{ ĊĊĠĠĠ Ġ@ Override ĊĠĠĠ Ġprotected Ġvoid ĠonCreate ( Bundle ĠsavedInstanceState ) Ġ{ ĊĠĠĠĠĠ Ġsuper . onCreate ( savedInstanceState ); ĊĠĠĠĠĠ ĠsetContentView ( R . layout . activity _ main ); ĊĠĠĠ Ġ} ĊĠ Ġ} Ċ """ Ċ Ċ class ĠOnClick Enum Support Test : ĠAndroid TestCase () Ġ{ ĊĊĠ Ġfun Ġtest With No Activities () Ġ{ ĊĠĠĠ Ġval Ġutil Ġ= ĠSupport TestUtil ( my Facet , Ġmy Fixture , ĠTEXT _ VIEW , Ġparent Tag Ġ= ĠFRAME _ LAYOUT ) ĊĠĠĠ Ġval Ġsupport Ġ= ĠOnClick Enum Support ( util . nl Model ) ĊĠĠĠ Ġval Ġapp Ġ= ĠApplication Manager . getApplication () ĊĠĠĠ Ġval Ġvalues Ġ= Ġapp . execute On P ooled Thread ( Callable < List < EnumValue >> Ġ{ Ġsupport . values Ġ}). get () ĊĠĠĠ ĠassertThat ( values ). isEmpty () ĊĠ Ġ} ĊĊĠ Ġfun Ġtest With Fully Qualified Activity Name () Ġ{ ĊĠĠĠ Ġval Ġsupport Ġ= Ġfind Enum Support For (" p 1 . p 2 . MainActivity ") ĊĠĠĠ Ġval Ġapp Ġ= ĠApplication Manager . getApplication () ĊĠĠĠ Ġval Ġall Values Ġ= Ġapp . execute On P ooled Thread ( Callable < List < EnumValue >> Ġ{ Ġsupport . values Ġ}). get () ĊĠĠĠ ĠassertThat (( all Values [ 0 ] Ġas ĠHeader EnumValue ). header ). isEqualTo (" MainActivity ") ĊĠĠĠ Ġval Ġvalues Ġ= Ġall Values . sub List ( 1 , Ġall Values . size ) ĊĠĠĠ ĠassertThat ( values . map Ġ{ Ġit . display Ġ}). contains Exactly (" help ", Ġ" onClick "). in Order () ĊĠĠĠ ĠassertThat ( values . map Ġ{ Ġit . value Ġ}). contains Exactly (" help ", Ġ" onClick "). in Order () ĊĠ Ġ} ĊĊĠ Ġfun Ġtest With Dot In Activity Name () Ġ{ ĊĠĠĠ Ġval Ġsupport Ġ= Ġfind Enum Support For (". MainActivity ") ĊĠĠĠ Ġval Ġapp Ġ= ĠApplication Manager . getApplication () ĊĠĠĠ Ġval Ġall Values Ġ= Ġapp . execute On P ooled Thread ( Callable < List < EnumValue >> Ġ{ Ġsupport . values Ġ}). get () ĊĠĠĠ ĠassertThat (( all Values [ 0 ] Ġas ĠHeader EnumValue ). header ). isEqualTo (" MainActivity ") ĊĠĠĠ Ġval Ġvalues Ġ= Ġall Values . sub List ( 1 , Ġall Values . size ) ĊĠĠĠ ĠassertThat ( values . map Ġ{ Ġit . display Ġ}). contains Exactly (" help ", Ġ" onClick "). in Order () ĊĠĠĠ ĠassertThat ( values . map Ġ{ Ġit . value Ġ}). contains Exactly (" help ", Ġ" onClick "). in Order () ĊĠ Ġ} ĊĊĠ Ġfun Ġtest With No Activity Name () Ġ{ ĊĠĠĠ Ġval Ġsupport Ġ= Ġfind Enum Support For ("") ĊĠĠĠ Ġval Ġapp Ġ= ĠApplication Manager . getApplication () ĊĠĠĠ Ġval Ġall Values Ġ= Ġapp . execute On P ooled Thread ( Callable < List < EnumValue >> Ġ{ Ġsupport . values Ġ}). get () ĊĠĠĠ ĠassertThat (( all Values [ 0 ] Ġas ĠHeader EnumValue ). header ). isEqualTo (" MainActivity ") ĊĠĠĠ Ġval Ġmain Values Ġ= Ġall Values . sub List ( 1 , Ġ 3 ) ĊĠĠĠ ĠassertThat (( all Values [ 3 ] Ġas ĠHeader EnumValue ). header ). isEqualTo (" Other Activity ") ĊĠĠĠ Ġval Ġother Values Ġ= Ġall Values . sub List ( 4 , Ġ 6 ) ĊĠĠĠ ĠassertThat ( main Values . map Ġ{ Ġit . display Ġ}). contains Exactly (" help ", Ġ" onClick "). in Order () ĊĠĠĠ ĠassertThat ( main Values . map Ġ{ Ġit . value Ġ}). contains Exactly (" help ", Ġ" onClick "). in Order () ĊĠĠĠ ĠassertThat ( other Values . map Ġ{ Ġit . display Ġ}). contains Exactly (" onClick ", Ġ" start Processing "). in Order () ĊĠĠĠ ĠassertThat ( other Values . map Ġ{ Ġit . value Ġ}). contains Exactly (" onClick ", Ġ" start Processing "). in Order () ĊĠĠĠ ĠassertThat ( all Values . size ). isEqualTo ( 6 ) ĊĠ Ġ} ĊĊĠ Ġprivate Ġfun Ġfind Enum Support For ( activity Name : ĠString ): ĠOnClick Enum Support Ġ{ ĊĠĠĠ Ġmy Fixture . addClass ( MAIN _ ACTIVITY . trim Indent ()) ĊĠĠĠ Ġmy Fixture . addClass ( OTHER _ ACTIVITY . trim Indent ()) ĊĠĠĠ Ġmy Fixture . addClass ( TH IRD _ ACTIVITY . trim Indent ()) ĊĠĠĠ Ġval Ġutil Ġ= ĠSupport TestUtil ( my Facet , Ġmy Fixture , ĠTEXT _ VIEW , Ġparent Tag Ġ= ĠFRAME _ LAYOUT , Ġactivity Name Ġ= Ġactivity Name ) ĊĠĠĠ Ġreturn ĠOnClick Enum Support ( util . nl Model ) ĊĠ Ġ} Ċ } Ċ