/* Ċ Ġ* Ġ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 . databinding . view binding Ċ Ċ import Ġcom . android . ide . common . gradle . model . stubs . View Binding Options Stub Ċ import Ġcom . android . tools . idea . databinding . util . is View Binding Enabled Ċ import Ġcom . android . tools . idea . res . Resource Repository Manager Ċ import Ġcom . android . tools . idea . testing . Android Project Builder Ċ import Ġcom . android . tools . idea . testing . Android Project Rule Ċ import Ġcom . google . common . truth . Truth . assertThat Ċ import Ġcom . intellij . facet . Facet Manager Ċ import Ġcom . intellij . psi . search . Psi Short Names Cache Ċ import Ġcom . intellij . test Framework . Ed t Rule Ċ import Ġcom . intellij . test Framework . Runs In Ed t Ċ import Ġorg . jetbrains . android . facet . Android Facet Ċ import Ġorg . junit . Before Ċ import Ġorg . junit . Rule Ċ import Ġorg . junit . Test Ċ import Ġorg . junit . rules . Rule Chain Ċ Ċ @ Runs In Ed t Ċ class ĠView Binding ShortName Cache Test Ġ{ ĊĠ Ġprivate Ġval Ġproject Rule Ġ= ĊĠĠĠ ĠAndroid Project Rule . with Android Model ( Android Project Builder ( view Binding Options Ġ= Ġ{ View Binding Options Stub ( true )} )) ĊĊĠ Ġ// ĠThe Ġtests Ġneed Ġto Ġrun Ġon Ġthe ĠE DT Ġthread Ġbut Ġwe Ġmust Ġinitialize Ġthe Ġproject Ġrule Ġoff Ġof Ġit ĊĠ Ġ@ get : Rule ĊĠ Ġval Ġrule Chain Ġ= ĠRule Chain . outer Rule ( project Rule ). around ( Ed t Rule ()) !! ĊĊĠ Ġprivate Ġval Ġfacet ĊĠĠĠ Ġget () Ġ= ĠFac et Manager . getInstance ( project Rule . module ). get Facet ByType ( Android Facet . ID ) !! ĊĊĠ Ġprivate Ġval Ġfixture ĊĠĠĠ Ġget () Ġ= Ġproject Rule . fixture ĊĊĠ Ġ@ Before ĊĠ Ġfun ĠsetUp () Ġ{ ĊĠĠĠ ĠassertThat ( facet . is View Binding Enabled ()). isTrue () ĊĠĠĠ Ġfixture . add File To Project (" src / main / Android Manifest . xml ", Ġ""" ĊĠĠĠĠĠ Ġ<? xml Ġversion =" 1 . 0 " Ġencoding =" utf - 8 "?> ĊĠĠĠĠĠ Ġ< manifest Ġxmlns : android =" http :// schemas . android . com / apk / res / android " Ġpackage =" test . db "> ĊĠĠĠĠĠĠĠ Ġ< application Ġ/> ĊĠĠĠĠĠ Ġ</ manifest > ĊĠĠĠ Ġ""" . trim Indent ()) ĊĠ Ġ} ĊĊĠ Ġ@ Test ĊĠ Ġfun Ġshort Name Cache Contains View Binding Classes And Fields () Ġ{ ĊĠĠĠ Ġfixture . add File To Project (" src / main / res / layout / activity _ main . xml ", Ġ""" ĊĠĠĠĠĠ Ġ<? xml Ġversion =" 1 . 0 " Ġencoding =" utf - 8 "?> ĊĠĠĠĠĠĠĠ Ġ< android x . constraint layout . widget . Constraint Layout Ġxmlns : android =" http :// schemas . android . com / apk / res / android "> ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ< TextView Ġandroid : id ="@ + id / test Id "/> ĊĠĠĠĠĠĠĠ Ġ</ android x . constraint layout . widget . Constraint Layout > ĊĠĠĠ Ġ""" . trim Indent ()) ĊĊĠĠĠ Ġ// Ġinitialize Ġmodule Ġresources ĊĠĠĠ ĠResource Repository Manager . getInstance ( facet ). module Resources ĊĊĠĠĠ Ġval Ġcache Ġ= ĠPsi Short Names Cache . getInstance ( project Rule . project ) ĊĊĠĠĠ ĠassertThat ( cache . all ClassNames . as Iterable ()). contains (" Activity Main Binding ") ĊĠĠĠ ĠassertThat ( cache . all Field Names . as Iterable ()). contains (" test Id ") ĊĠ Ġ} Ċ }