/* Ċ Ġ* ĠĠĠ ĠCopyright Ġ 2 0 1 9 ĠAPP N EX US ĠINC Ċ Ġ* Ċ Ġ* ĠĠĠ Ġ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 Ġapp nexus . com . app nexus sdk test app . functional . banner Ċ Ċ import Ġandroid . content . Intent Ċ import Ġandroid . content . res . Resources Ċ import Ġandroid . view . View Ċ import Ġandroidx . test . espress o . Esp ress o Ċ import Ġandroidx . test . espress o . Esp ress o . on View Ċ import Ġandroidx . test . espress o . Id ling Policies Ċ import Ġandroidx . test . espress o . Id ling Registry Ċ import Ġandroidx . test . espress o . action . View Actions Ċ import Ġandroidx . test . espress o . assertion . View Assertions Ċ import Ġandroidx . test . espress o . assertion . View Assertions . matches Ċ import Ġandroidx . test . espress o . intent . Intent s Ċ import Ġandroidx . test . espress o . intent . matcher . Intent Matchers Ċ import Ġandroidx . test . espress o . intent . rule . Intent s Test Rule Ċ import Ġandroidx . test . espress o . matcher . View Matchers Ċ import Ġandroidx . test . espress o . matcher . View Matchers . is Displayed Ċ import Ġandroidx . test . espress o . matcher . View Matchers . with Text Ċ import Ġandroidx . test . runner . Android JUnit 4 Ċ import Ġandroidx . test . rule . Activity Test Rule Ċ import Ġapp nexus . com . app nexus sdk test app . Banner Activity Ċ import Ġapp nexus . com . app nexus sdk test app . R Ċ import Ġcom . app nexus . opens dk . AN Click Through Action Ċ import Ġcom . app nexus . opens dk . Ad Activity Ċ import Ġcom . app nexus . opens dk . SDK Settings Ċ import Ġcom . app nexus . opens dk . utils . StringUtil Ċ import Ġcom . app nexus . opens dk . utils . View Util Ċ import Ġcom . microsoft . app center . espress o . Factory Ċ import Ġorg . junit .* Ċ Ċ import Ġorg . junit . runner . RunWith Ċ import Ġjava . util . concurrent . TimeUnit Ċ Ċ /** Ċ Ġ* ĠInstrument ed Ġtest , Ġwhich Ġwill Ġexecute Ġon Ġan ĠAndroid Ġdevice . Ċ Ġ* Ċ Ġ* ĠSee Ġ[ testing Ġdocumentation ]( http :// d . android . com / tools / testing ). Ċ Ġ*/ Ċ @ RunWith ( Android JUnit 4 :: class ) Ċ class ĠBanner Native Test Ġ{ ĊĠĠĠ Ġval ĠInt . dp : ĠInt ĊĠĠĠĠĠĠĠ Ġget () Ġ= Ġ( this Ġ/ ĠResources . getSystem (). display Metrics . density ). toInt () ĊĠĠĠ Ġval ĠInt . px : ĠInt ĊĠĠĠĠĠĠĠ Ġget () Ġ= Ġ( this Ġ* ĠResources . getSystem (). display Metrics . density ). toInt () ĊĊĠĠĠ Ġ@ get : Rule ĊĠĠĠ Ġvar Ġreport Helper Ġ= ĠFactory . get Report Helper () ĊĊĠĠĠ Ġ@ Rule ĊĠĠĠ Ġ@ Jvm Field ĊĠĠĠ Ġvar Ġm Activity Test Rule Ġ= ĠInt ents Test Rule ( Banner Activity :: class . java , Ġfalse , Ġfalse ) ĊĊĠĠĠ Ġlateinit Ġvar Ġbanner Activity : ĠBanner Activity ĊĊĠĠĠ Ġ@ Before ĊĠĠĠ Ġfun Ġsetup () Ġ{ ĊĠĠĠĠĠĠĠ ĠId ling Policies . set Master Policy Timeout ( 1 , ĠTimeUnit . MIN UTES ) ĊĠĠĠĠĠĠĠ ĠId ling Policies . setId ling Resource Timeout ( 1 , ĠTimeUnit . MIN UTES ) ĊĠĠĠĠĠĠĠ Ġvar Ġintent Ġ= ĠIntent () ĊĠĠĠĠĠĠĠ Ġm Activity Test Rule . launch Activity ( intent ) ĊĠĠĠĠĠĠĠ Ġbanner Activity Ġ= Ġm Activity Test Rule . activity ĊĠĠĠĠĠĠĠ ĠId ling Registry . getInstance (). register ( banner Activity . id ling Resource ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ After ĊĠĠĠ Ġfun Ġdestroy () Ġ{ ĊĠĠĠĠĠĠĠ ĠId ling Registry . getInstance (). unregister ( banner Activity . id ling Resource ) ĊĠĠĠĠĠĠĠ Ġreport Helper . label (" Stopping ĠApp ") ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ/* ĊĠĠĠ Ġ* ĠTest Ġfor Ġthe ĠInvalid ĠRenderer ĠUrl Ġfor ĠBanner ĠNative ĠAd Ġ( Native Assembly Renderer ) ĊĠĠĠ Ġ* Ġ*/ ĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġbanner Native Assembly Renderer Load Wrong Renderer Url Test () Ġ{ ĊĊĠĠĠĠĠĠĠ Ġbanner Activity . trigger Ad Load (" 1 4 7 9 0 1 8 7 ", Ġallow Native Demand Ġ= Ġtrue , Ġrenderer Id Ġ= Ġ 5 0 2 , Ġuse Native Renderer Ġ= Ġtrue , Ġcre ative Id Ġ= Ġ 1 6 2 0 3 9 3 7 7 ) ĊĠĠĠĠĠĠĠ ĠE sp ress o . on View ( View Matchers . with Id ( R . id . linear Layout )) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. check ( View Assertions . matches ( View Matchers . is Displayed ())) ĊĠĠĠĠĠĠĠ ĠE sp ress o . on View ( View Matchers . with Id ( R . id . linear Layout )) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. check ( View Assertions . matches ( View Matchers . has Child Count ( 1 ))) ĊĠĠĠĠĠĠĠ ĠE sp ress o . on View ( View Matchers . with Id ( R . id . title )) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. check ( View Assertions . matches ( is Displayed ())) ĊĠĠĠĠĠĠĠ ĠE sp ress o . on View ( View Matchers . with Id ( R . id . description )) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. check ( View Assertions . matches ( is Displayed ())) ĊĠĠĠĠĠĠĠ Ġon View ( with Text (" What Ġis Ġin Ġthe ĠName .... ")). check ( matches ( is Displayed ())); ĊĠĠĠĠĠĠĠ Ġon View ( with Text (" The Ġperson Ġwho Ġsaid Ġ\" What Ġis Ġin Ġthe ĠName \" Ġwrote Ġhis Ġname Ġbelow Ġthe Ġquote ... ")). check ( matches ( is Displayed ())); ĊĠĠĠĠĠĠĠ ĠThread . sleep ( 5 0 0 0 ) ĊĠĠĠĠĠĠĠ ĠE sp ress o . on View ( View Matchers . with Id ( R . id . icon )) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. check ( View Assertions . matches ( View Matchers . is Displayed ())) ĊĠĠĠĠĠĠĠ ĠE sp ress o . on View ( View Matchers . with Id ( R . id . image )) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. check ( View Assertions . matches ( View Matchers . is Displayed ())) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ/* ĊĠĠĠ Ġ* ĠTest ĠClick through ĠAction Ġ- ĠSDK Browser ĊĠĠĠ Ġ* Ġ*/ ĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġbanner Native Assembly Renderer Click Through SDK Browser Test () Ġ{ ĊĊĠĠĠĠĠĠĠ Ġbanner Activity . trigger Ad Load (" 1 7 9 8 2 2 3 7 ", Ġallow Native Demand Ġ= Ġtrue , Ġrenderer Id Ġ= Ġ 5 0 2 , Ġuse Native Renderer Ġ= Ġtrue , Ġclick Through Action Ġ= ĠAN Click Through Action . OPEN _ SDK _ BROWSER , Ġcre ative Id Ġ= Ġ 1 6 2 0 3 9 3 7 7 ) ĊĠĠĠĠĠĠĠ ĠE sp ress o . on View ( View Matchers . with Id ( R . id . linear Layout )) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. check ( View Assertions . matches ( View Matchers . is Displayed ())) ĊĠĠĠĠĠĠĠ ĠE sp ress o . on View ( View Matchers . with Id ( R . id . linear Layout )) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. check ( View Assertions . matches ( View Matchers . has Child Count ( 1 ))) ĊĠĠĠĠĠĠĠ ĠE sp ress o . on View ( View Matchers . with Id ( banner Activity . banner _ id )) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. check ( View Assertions . matches ( View Matchers . is Displayed ())) ĊĠĠĠĠĠĠĠ ĠE sp ress o . on View ( View Matchers . with Id ( banner Activity . banner _ id )) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. perform ( View Actions . click ()) ĊĊĠĠĠĠĠĠĠ Ġ// check Ġif Ġthe Ġtriggered Ġintent Ġis Ġpointing Ġto Ġthe ĠAd Activity ĊĠĠĠĠĠĠĠ ĠInt ents . int ended ( Intent Matchers . has Component ( Ad Activity :: class . java . name )) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ/* ĊĠĠĠ Ġ* ĠTest ĠClick through ĠAction Ġ- ĠDevice Browser ĊĠĠĠ Ġ* Ġ*/ ĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġbanner Native Assembly Renderer Click Through Device Browser Test () Ġ{ ĊĊĠĠĠĠĠĠĠ Ġbanner Activity . trigger Ad Load (" 1 7 9 8 2 2 3 7 ", Ġallow Native Demand Ġ= Ġtrue , Ġrenderer Id Ġ= Ġ 5 0 2 , Ġuse Native Renderer Ġ= Ġtrue , Ġclick Through Action Ġ= ĠAN Click Through Action . OPEN _ DEVICE _ BROWSER , Ġcre ative Id Ġ= Ġ 1 6 2 0 3 9 3 7 7 ) ĊĠĠĠĠĠĠĠ ĠE sp ress o . on View ( View Matchers . with Id ( R . id . linear Layout )) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. check ( View Assertions . matches ( View Matchers . is Displayed ())) ĊĠĠĠĠĠĠĠ ĠE sp ress o . on View ( View Matchers . with Id ( R . id . linear Layout )) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. check ( View Assertions . matches ( View Matchers . has Child Count ( 1 ))) ĊĠĠĠĠĠĠĠ ĠE sp ress o . on View ( View Matchers . with Id ( banner Activity . banner _ id )) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. check ( View Assertions . matches ( View Matchers . is Displayed ())) ĊĠĠĠĠĠĠĠ ĠE sp ress o . on View ( View Matchers . with Id ( banner Activity . banner _ id )) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. perform ( View Actions . click ()) ĊĊĠĠĠĠĠĠĠ Ġ// check Ġif Ġthe Ġtriggered Ġintent Ġhas ĠAction Ġset Ġas ĠACTION _ VIEW ĊĠĠĠĠĠĠĠ ĠInt ents . int ended ( Intent Matchers . has Action ( Intent . ACTION _ VIEW )) ĊĠĠĠ Ġ} ĊĊĊĠĠĠ Ġ/* ĊĠĠĠ Ġ* ĠTest ĠClick through ĠAction Ġ- ĠReturn Url ĊĠĠĠ Ġ* Ġ*/ ĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġbanner Native Assembly Renderer Click Through Return Url Test () Ġ{ ĊĊĠĠĠĠĠĠĠ Ġbanner Activity . trigger Ad Load (" 1 7 9 8 2 2 3 7 ", Ġallow Native Demand Ġ= Ġtrue , Ġrenderer Id Ġ= Ġ 5 0 2 , Ġuse Native Renderer Ġ= Ġtrue , Ġclick Through Action Ġ= ĠAN Click Through Action . RETURN _ URL , Ġcre ative Id Ġ= Ġ 1 6 2 0 3 9 3 7 7 ) ĊĠĠĠĠĠĠĠ ĠE sp ress o . on View ( View Matchers . with Id ( R . id . linear Layout )) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. check ( View Assertions . matches ( View Matchers . is Displayed ())) ĊĠĠĠĠĠĠĠ ĠE sp ress o . on View ( View Matchers . with Id ( R . id . linear Layout )) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. check ( View Assertions . matches ( View Matchers . has Child Count ( 1 ))) ĊĠĠĠĠĠĠĠ ĠE sp ress o . on View ( View Matchers . with Id ( banner Activity . banner _ id )) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. check ( View Assertions . matches ( View Matchers . is Displayed ())) ĊĠĠĠĠĠĠĠ ĠE sp ress o . on View ( View Matchers . with Id ( banner Activity . banner _ id )) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. perform ( View Actions . click ()) ĊĊĠĠĠĠĠĠĠ ĠAssert . assertFalse ( StringUtil . isEmpty ( banner Activity . click Url )) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ/* ĊĠĠĠ Ġ* ĠResize To Fit Container Size ĠTest Ġfor Ġthe ĠBanner ĠNative ĠAssembly ĠRenderer ĠAd ĊĠĠĠ Ġ* Ġ*/ ĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġbanner Native Assembly Renderer Resize To Fit Container Test () Ġ{ ĊĊĠĠĠĠĠĠĠ Ġbanner Activity . trigger Ad Load (" 1 7 9 8 2 2 3 7 ", Ġwidth Ġ= Ġ 3 0 0 , Ġheight Ġ= Ġ 2 5 0 , Ġallow Native Demand Ġ= Ġtrue , Ġrenderer Id Ġ= Ġ 5 0 2 , Ġuse Native Renderer Ġ= Ġtrue , Ġresize To Fit Container Ġ= Ġtrue , Ġexp ands To Fit Screen Width Ġ= Ġfalse , Ġcre ative Id Ġ= Ġ 1 6 2 0 3 9 3 7 7 ) ĊĠĠĠĠĠĠĠ ĠE sp ress o . on View ( View Matchers . with Id ( R . id . linear Layout )) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. check ( View Assertions . matches ( View Matchers . is Displayed ())) ĊĠĠĠĠĠĠĠ ĠE sp ress o . on View ( View Matchers . with Id ( R . id . linear Layout )) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. check ( View Assertions . matches ( View Matchers . has Child Count ( 1 ))) ĊĠĠĠĠĠĠĠ ĠE sp ress o . on View ( View Matchers . with Id ( banner Activity . banner _ id )) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. check ( View Assertions . matches ( View Matchers . is Displayed ())) ĊĊĠĠĠĠĠĠĠ Ġvar Ġwidth Ġ= ĠView Util . getValue In DP ( banner Activity , Ġbanner Activity . banner . width ) ĊĠĠĠĠĠĠĠ Ġvar Ġheight Ġ= ĠView Util . getValue In DP ( banner Activity , Ġbanner Activity . banner . height ) Ċ // ĠĠĠĠĠĠĠ ĠAssert . assertTrue (" Width ĠResize ĠAssertion ĠFailure Ġexpected Ġ= Ġ 3 0 0 , Ġactual Ġ= Ġ" Ġ+ Ġwidth , Ġwidth Ġ>= Ġ 2 9 9 Ġ&& Ġwidth Ġ<= Ġ 3 0 1 ) ĊĠĠĠĠĠĠĠ ĠAssert . assertTrue (" Height ĠResize ĠAssertion ĠFailure Ġexpected Ġ= Ġ 2 5 0 , Ġactual Ġ= Ġ" Ġ+ Ġheight , Ġheight Ġ>= Ġ 2 4 9 Ġ&& Ġheight Ġ<= Ġ 2 5 1 ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ/* ĊĠĠĠ Ġ* ĠExpand To Fit Screen Width ĠTest Ġfor Ġthe ĠBanner ĠNative ĠAssembly ĠRenderer ĠAd ĊĠĠĠ Ġ* Ġ*/ ĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġbanner Native Assembly Renderer Expand To Fit Screen Test () Ġ{ ĊĊĠĠĠĠĠĠĠ Ġbanner Activity . trigger Ad Load (" 1 7 9 8 2 2 3 7 ", Ġwidth Ġ= Ġ 3 0 0 , Ġheight Ġ= Ġ 2 5 0 , Ġallow Native Demand Ġ= Ġtrue , Ġrenderer Id Ġ= Ġ 5 0 2 , Ġuse Native Renderer Ġ= Ġtrue , Ġexp ands To Fit Screen Width Ġ= Ġtrue , Ġcre ative Id Ġ= Ġ 1 6 2 0 3 9 3 7 7 ) ĊĠĠĠĠĠĠĠ ĠE sp ress o . on View ( View Matchers . with Id ( R . id . linear Layout )) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. check ( View Assertions . matches ( View Matchers . is Displayed ())) ĊĠĠĠĠĠĠĠ ĠE sp ress o . on View ( View Matchers . with Id ( R . id . linear Layout )) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. check ( View Assertions . matches ( View Matchers . has Child Count ( 1 ))) ĊĠĠĠĠĠĠĠ ĠE sp ress o . on View ( View Matchers . with Id ( banner Activity . banner _ id )) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. check ( View Assertions . matches ( View Matchers . is Displayed ())) ĊĊĠĠĠĠĠĠĠ Ġvar Ġwidth Ġ= ĠView Util . getValue In DP ( banner Activity , Ġbanner Activity . banner . width ) ĊĠĠĠĠĠĠĠ ĠAssert . assertTrue (" Screen ĠWidth ĠResize ĠAssertion ĠFailure Ġexpected Ġ= Ġ" Ġ+ ĠView Util . get Screen Size As DP ( banner Activity )[ 0 ] Ġ+ Ġ", Ġactual Ġ= Ġ" Ġ+ Ġwidth , Ġwidth Ġ== ĠView Util . get Screen Size As DP ( banner Activity )[ 0 ]) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ/* ĊĠĠĠ Ġ* ĠSan ity ĠTest Ġfor Ġthe ĠBanner ĠNative ĠAd ĠImp ression ĊĠĠĠ Ġ* Ġ*/ ĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġbanner Native Load Imp ression Test () Ġ{ ĊĊĠĠĠĠĠĠĠ Ġbanner Activity . trigger Ad Load (" 1 7 9 8 2 2 3 7 ", Ġallow Native Demand Ġ= Ġtrue , Ġcre ative Id Ġ= Ġ 1 8 2 4 2 6 5 2 1 ) ĊĠĠĠĠĠĠĠ Ġon View ( View Matchers . with Id ( R . id . linear Layout )) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. check ( matches ( is Displayed ())) ĊĠĠĠĠĠĠĠ ĠAssert . assertTrue ( banner Activity . imp ression Logged ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ/* ĊĠĠĠ Ġ* ĠSan ity ĠTest Ġfor Ġthe ĠBanner ĠNative ĠAd ĠImp ression Ġwhen ĠCont ian er Ġview Ġis Ġattached Ġlater ĊĠĠĠ Ġ* Ġ*/ ĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġbanner Native Load Imp ression Test With View Attached Later () Ġ{ ĊĊĠĠĠĠĠĠĠ Ġbanner Activity . should Display Ġ= Ġfalse ĊĠĠĠĠĠĠĠ Ġbanner Activity . trigger Ad Load (" 1 7 9 8 2 2 3 7 ", Ġallow Native Demand Ġ= Ġtrue , Ġcre ative Id Ġ= Ġ 1 8 2 4 2 6 5 2 1 ) ĊĠĠĠĠĠĠĠ Ġon View ( View Matchers . with Id ( R . id . linear Layout )) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. check ( matches ( is Displayed ())) ĊĠĠĠĠĠĠĠ ĠAssert . assertFalse ( banner Activity . imp ression Logged ) ĊĠĠĠĠĠĠĠ Ġbanner Activity . attach Native () ĊĠĠĠĠĠĠĠ ĠThread . sleep ( 1 0 0 0 ) ĊĠĠĠĠĠĠĠ ĠE sp ress o . on View ( View Matchers . with Id ( R . id . linear Layout )) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. check ( View Assertions . matches ( View Matchers . is Displayed ())) ĊĠĠĠĠĠĠĠ ĠE sp ress o . on View ( View Matchers . with Id ( R . id . linear Layout )) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. check ( View Assertions . matches ( View Matchers . has Child Count ( 1 ))) ĊĠĠĠĠĠĠĠ ĠAssert . assertTrue ( banner Activity . imp ression Logged ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ/* ĊĠĠĠ Ġ* ĠSan ity ĠTest Ġfor Ġthe ĠBanner ĠNative ĠAd ĠImp ression ĊĠĠĠ Ġ* Ġ*/ ĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġbanner Native Load Imp ression Test One Px () Ġ{ ĊĊĠĠĠĠĠĠĠ ĠSDK Settings . set Count Imp ression On 1 px Rendering ( true ) ĊĠĠĠĠĠĠĠ Ġbanner Activity . trigger Ad Load (" 1 7 9 8 2 2 3 7 ", Ġallow Native Demand Ġ= Ġtrue , Ġcre ative Id Ġ= Ġ 1 8 2 4 2 6 5 2 1 ) ĊĠĠĠĠĠĠĠ ĠThread . sleep ( 1 0 0 0 ) ĊĠĠĠĠĠĠĠ ĠE sp ress o . on View ( View Matchers . with Id ( R . id . linear Layout )) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. check ( View Assertions . matches ( View Matchers . is Displayed ())) ĊĠĠĠĠĠĠĠ ĠE sp ress o . on View ( View Matchers . with Id ( R . id . linear Layout )) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. check ( View Assertions . matches ( View Matchers . has Child Count ( 1 ))) ĊĠĠĠĠĠĠĠ ĠAssert . assertTrue ( banner Activity . imp ression Logged ) ĊĠĠĠĠĠĠĠ ĠSDK Settings . set Count Imp ression On 1 px Rendering ( false ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ/* ĊĠĠĠ Ġ* ĠSan ity ĠTest Ġfor Ġthe ĠBanner ĠNative ĠAd ĠImp ression Ġwhen ĠContainer Ġview Ġis Ġattached Ġlater ĊĠĠĠ Ġ* Ġ*/ ĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġbanner Native Load Imp ression Test One Px With View Attached Later () Ġ{ ĊĠĠĠĠĠĠĠ ĠSDK Settings . set Count Imp ression On 1 px Rendering ( true ) ĊĠĠĠĠĠĠĠ Ġbanner Activity . should Display Ġ= Ġfalse ĊĠĠĠĠĠĠĠ Ġbanner Activity . trigger Ad Load (" 1 7 9 8 2 2 3 7 ", Ġallow Native Demand Ġ= Ġtrue , Ġcre ative Id Ġ= Ġ 1 8 2 4 2 6 5 2 1 ) ĊĠĠĠĠĠĠĠ Ġon View ( View Matchers . with Id ( R . id . linear Layout )) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. check ( matches ( is Displayed ())) ĊĠĠĠĠĠĠĠ ĠAssert . assertFalse ( banner Activity . imp ression Logged ) ĊĠĠĠĠĠĠĠ Ġbanner Activity . attach Native ( false ) ĊĠĠĠĠĠĠĠ ĠThread . sleep ( 1 0 0 0 ) ĊĠĠĠĠĠĠĠ ĠAssert . assertFalse ( banner Activity . imp ression Logged ) ĊĠĠĠĠĠĠĠ Ġbanner Activity . attach Native () ĊĠĠĠĠĠĠĠ ĠThread . sleep ( 1 0 0 0 ) ĊĠĠĠĠĠĠĠ ĠE sp ress o . on View ( View Matchers . with Id ( R . id . linear Layout )) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. check ( View Assertions . matches ( View Matchers . is Displayed ())) ĊĠĠĠĠĠĠĠ ĠE sp ress o . on View ( View Matchers . with Id ( R . id . linear Layout )) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. check ( View Assertions . matches ( View Matchers . has Child Count ( 1 ))) ĊĠĠĠĠĠĠĠ ĠAssert . assertTrue ( banner Activity . imp ression Logged ) ĊĠĠĠĠĠĠĠ ĠSDK Settings . set Count Imp ression On 1 px Rendering ( false ) ĊĠĠĠ Ġ} Ċ } Ċ