/* Ċ Ġ* ĠCopyright Ġ( C ) Ġ 2 0 1 3 ĠSquare , Ġ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 Ġcom . squareup . pic asso 3 Ċ Ċ import Ġandroid . graphics . Bitmap Ċ import Ġandroid . graphics . Bitmap . Config . ARGB _ 8 8 8 8 Ċ import Ġandroid . graphics . drawable . Color Drawable Ċ import Ġandroid . graphics . drawable . Drawable Ċ import Ġcom . google . common . truth . Truth . assertThat Ċ import Ġcom . squareup . pic asso 3 . Memory Policy . NO _ CACHE Ċ import Ġcom . squareup . pic asso 3 . Pic asso . Loaded From . MEMORY Ċ import Ġcom . squareup . pic asso 3 . Pic asso . Priority . HIGH Ċ import Ġcom . squareup . pic asso 3 . Pic asso . Priority . LOW Ċ import Ġcom . squareup . pic asso 3 . Pic asso . Priority . NORMAL Ċ import Ġcom . squareup . pic asso 3 . Remote Views Action . App Widget Action Ċ import Ġcom . squareup . pic asso 3 . Remote Views Action . Notification Action Ċ import Ġcom . squareup . pic asso 3 . TestUtils . CUSTOM _ HEADER _ NAME Ċ import Ġcom . squareup . pic asso 3 . TestUtils . CUSTOM _ HEADER _ VALUE Ċ import Ġcom . squareup . pic asso 3 . TestUtils . NO _ EVENT _ LIST EN ERS Ċ import Ġcom . squareup . pic asso 3 . TestUtils . NO _ HAND L ERS Ċ import Ġcom . squareup . pic asso 3 . TestUtils . NO _ TRANSFORM ERS Ċ import Ġcom . squareup . pic asso 3 . TestUtils . ST ABLE _ 1 Ċ import Ġcom . squareup . pic asso 3 . TestUtils . ST ABLE _ URI _ KEY _ 1 Ċ import Ġcom . squareup . pic asso 3 . TestUtils . UNUSED _ CALL _ FACTORY Ċ import Ġcom . squareup . pic asso 3 . TestUtils . URI _ 1 Ċ import Ġcom . squareup . pic asso 3 . TestUtils . URI _ KEY _ 1 Ċ import Ġcom . squareup . pic asso 3 . TestUtils . any Ċ import Ġcom . squareup . pic asso 3 . TestUtils . argument Captor Ċ import Ġcom . squareup . pic asso 3 . TestUtils . eq Ċ import Ġcom . squareup . pic asso 3 . TestUtils . make Bitmap Ċ import Ġcom . squareup . pic asso 3 . TestUtils . mock Callback Ċ import Ġcom . squareup . pic asso 3 . TestUtils . mock Fit ImageView Target Ċ import Ġcom . squareup . pic asso 3 . TestUtils . mock ImageView Target Ċ import Ġcom . squareup . pic asso 3 . TestUtils . mock Notification Ċ import Ġcom . squareup . pic asso 3 . TestUtils . mock Pic asso Ċ import Ġcom . squareup . pic asso 3 . TestUtils . mock Remote Views Ċ import Ġcom . squareup . pic asso 3 . TestUtils . mock Request Creator Ċ import Ġcom . squareup . pic asso 3 . TestUtils . mock Target Ċ import Ġorg . junit . Assert . fail Ċ import Ġorg . junit . Test Ċ import Ġorg . junit . runner . RunWith Ċ import Ġorg . mockito . Argument Captor Ċ import Ġorg . mockito . Argument Matchers . any String Ċ import Ġorg . mockito . Mockito .` when ` Ċ import Ġorg . mockito . Mockito . do Call Real Method Ċ import Ġorg . mockito . Mockito . do Return Ċ import Ġorg . mockito . Mockito . mock Ċ import Ġorg . mockito . Mockito . never Ċ import Ġorg . mockito . Mockito . spy Ċ import Ġorg . mockito . Mockito . verify Ċ import Ġorg . mockito . Mockito . verify No More Interactions Ċ import Ġorg . ro bo lectric . Ro bo lectric TestRunner Ċ import Ġorg . ro bo lectric . Runtime Environment Ċ import Ġorg . ro bo lectric . Shadow s . shadow Of Ċ import Ġjava . io . IOException Ċ import Ġjava . util . concurrent . Count DownLatch Ċ Ċ @ RunWith ( Ro bo lectric TestRunner :: class ) Ċ class ĠRequest Creator Test Ġ{ ĊĠ Ġprivate Ġval Ġaction Captor Ġ= Ġargument Captor < Action >() ĊĠ Ġprivate Ġval Ġpic asso Ġ= Ġspy ( mock Pic asso ( Runtime Environment . application )) ĊĠ Ġprivate Ġval Ġbitmap Ġ= Ġmake Bitmap () ĊĊĠ Ġ@ Test Ġfun Ġget On Main Cr ashes () Ġ{ ĊĠĠĠ Ġtry Ġ{ ĊĠĠĠĠĠ ĠRequest Creator ( pic asso , ĠURI _ 1 , Ġ 0 ). get () ĊĠĠĠĠĠ Ġfail (" Calling Ġget () Ġon Ġmain Ġthread Ġshould Ġthrow Ġexception ") ĊĠĠĠ Ġ} Ġcatch Ġ( ignored : ĠIllegalStateException ) Ġ{ ĊĠĠĠ Ġ} ĊĠ Ġ} ĊĊĠ Ġ@ Test Ġfun Ġload With Shutdown Cr ashes () Ġ{ ĊĠĠĠ Ġpic asso . shutdown Ġ= Ġtrue ĊĠĠĠ Ġtry Ġ{ ĊĠĠĠĠĠ ĠRequest Creator ( pic asso , ĠURI _ 1 , Ġ 0 ). fetch () ĊĠĠĠĠĠ Ġfail (" Should Ġhave Ġcr ashed Ġwith Ġa Ġshutdown Ġpic asso .") ĊĠĠĠ Ġ} Ġcatch Ġ( ignored : ĠIllegalStateException ) Ġ{ ĊĠĠĠ Ġ} ĊĠ Ġ} ĊĊĠ Ġ@ Test Ġfun Ġget Returns Null If Null Uri And ResourceId () Ġ{ ĊĠĠĠ Ġval Ġl atch Ġ= ĠCount DownLatch ( 1 ) ĊĠĠĠ Ġval Ġresult Ġ= ĠarrayOf Null s < Bitmap >( 1 ) ĊĠĠĠ ĠThread Ġ{ ĊĠĠĠĠĠ Ġtry Ġ{ ĊĠĠĠĠĠĠĠ Ġresult [ 0 ] Ġ= ĠRequest Creator ( pic asso , Ġnull , Ġ 0 ). get () ĊĠĠĠĠĠ Ġ} Ġcatch Ġ( e : ĠIOException ) Ġ{ ĊĠĠĠĠĠĠĠ Ġfail ( e . message ) ĊĠĠĠĠĠ Ġ} Ġfinally Ġ{ ĊĠĠĠĠĠĠĠ Ġl atch . count Down () ĊĠĠĠĠĠ Ġ} ĊĠĠĠ Ġ}. start () ĊĠĠĠ Ġl atch . await () ĊĊĠĠĠ ĠassertThat ( result [ 0 ]). isNull () ĊĠĠĠ Ġverify ( pic asso ). default Bitmap Config ĊĠĠĠ Ġverify ( pic asso ). shutdown ĊĠĠĠ Ġverify No More Interactions ( pic asso ) ĊĠ Ġ} ĊĊĠ Ġ@ Test Ġfun Ġfetch Submit s Fetch Request () Ġ{ ĊĠĠĠ ĠRequest Creator ( pic asso , ĠURI _ 1 , Ġ 0 ). fetch () ĊĠĠĠ Ġverify ( pic asso ). submit ( action Captor . capture ()) ĊĠĠĠ ĠassertThat ( action Captor . value ). isInstanceOf ( Fetch Action :: class . java ) ĊĠ Ġ} ĊĊĠ Ġ@ Test Ġfun Ġfetch With Fit Throws () Ġ{ ĊĠĠĠ Ġtry Ġ{ ĊĠĠĠĠĠ ĠRequest Creator ( pic asso , ĠURI _ 1 , Ġ 0 ). fit (). fetch () ĊĠĠĠĠĠ Ġfail (" Calling Ġfetch () Ġwith Ġfit () Ġshould Ġthrow Ġan Ġexception ") ĊĠĠĠ Ġ} Ġcatch Ġ( ignored : ĠIllegalStateException ) Ġ{ ĊĠĠĠ Ġ} ĊĠ Ġ} ĊĊĠ Ġ@ Test Ġfun Ġfetch WithDefault Priority () Ġ{ ĊĠĠĠ ĠRequest Creator ( pic asso , ĠURI _ 1 , Ġ 0 ). fetch () ĊĠĠĠ Ġverify ( pic asso ). submit ( action Captor . capture ()) ĊĠĠĠ ĠassertThat ( action Captor . value . request . priority ). isEqualTo ( LOW ) ĊĠ Ġ} ĊĊĠ Ġ@ Test Ġfun Ġfetch With Custom Priority () Ġ{ ĊĠĠĠ ĠRequest Creator ( pic asso , ĠURI _ 1 , Ġ 0 ). priority ( HIGH ). fetch () ĊĠĠĠ Ġverify ( pic asso ). submit ( action Captor . capture ()) ĊĠĠĠ ĠassertThat ( action Captor . value . request . priority ). isEqualTo ( HIGH ) ĊĠ Ġ} ĊĊĠ Ġ@ Test Ġfun Ġfetch With Cache () Ġ{ ĊĠĠĠ Ġ` when `( pic asso . quick Memory Cache Check ( URI _ KEY _ 1 )). thenReturn ( bitmap ) ĊĠĠĠ ĠRequest Creator ( pic asso , ĠURI _ 1 , Ġ 0 ). memory Policy ( NO _ CACHE ). fetch () ĊĠĠĠ Ġverify ( pic asso , Ġnever ()). enqueue And Submit ( any ( Action :: class . java )) ĊĠ Ġ} ĊĊĠ Ġ@ Test Ġfun Ġfetch With Memory Policy No Cache () Ġ{ ĊĠĠĠ ĠRequest Creator ( pic asso , ĠURI _ 1 , Ġ 0 ). memory Policy ( NO _ CACHE ). fetch () ĊĠĠĠ Ġverify ( pic asso , Ġnever ()). quick Memory Cache Check ( URI _ KEY _ 1 ) ĊĠĠĠ Ġverify ( pic asso ). submit ( action Captor . capture ()) ĊĠ Ġ} ĊĊĠ Ġ@ Test Ġfun Ġinto Target With Fit Throws () Ġ{ ĊĠĠĠ Ġtry Ġ{ ĊĠĠĠĠĠ ĠRequest Creator ( pic asso , ĠURI _ 1 , Ġ 0 ). fit (). into ( mock Target ()) ĊĠĠĠĠĠ Ġfail (" Calling Ġinto () Ġtarget Ġwith Ġfit () Ġshould Ġthrow Ġexception ") ĊĠĠĠ Ġ} Ġcatch Ġ( ignored : ĠIllegalStateException ) Ġ{ ĊĠĠĠ Ġ} ĊĠ Ġ} ĊĊĠ Ġ@ Test Ġfun Ġinto Target No Placeholder Call sWith Null () Ġ{ ĊĠĠĠ Ġval Ġtarget Ġ= Ġmock Target () ĊĠĠĠ ĠRequest Creator ( pic asso , ĠURI _ 1 , Ġ 0 ). no Placeholder (). into ( target ) ĊĠĠĠ Ġverify ( target ). on Prepare Load ( null ) ĊĠ Ġ} ĊĊĠ Ġ@ Test Ġfun Ġinto Target With Null Uri And ResourceId Sk ips And Cancel s () Ġ{ ĊĠĠĠ Ġval Ġtarget Ġ= Ġmock Target () ĊĠĠĠ Ġval Ġplace Holder Drawable Ġ= Ġmock ( Drawable :: class . java ) ĊĠĠĠ ĠRequest Creator ( pic asso , Ġnull , Ġ 0 ). placeholder ( place Holder Drawable ). into ( target ) ĊĠĠĠ Ġverify ( pic asso ). default Bitmap Config ĊĠĠĠ Ġverify ( pic asso ). shutdown ĊĠĠĠ Ġverify ( pic asso ). cancel Request ( target ) ĊĠĠĠ Ġverify ( target ). on Prepare Load ( place Holder Drawable ) ĊĠĠĠ Ġverify No More Interactions ( pic asso ) ĊĠ Ġ} ĊĊĠ Ġ@ Test Ġfun Ġinto Target With Quick Memory Cache Check DoesNot Submit () Ġ{ ĊĠĠĠ Ġ` when `( pic asso . quick Memory Cache Check ( URI _ KEY _ 1 )). thenReturn ( bitmap ) ĊĠĠĠ Ġval Ġtarget Ġ= Ġmock Target () ĊĠĠĠ ĠRequest Creator ( pic asso , ĠURI _ 1 , Ġ 0 ). into ( target ) ĊĠĠĠ Ġverify ( target ). on Bitmap Loaded ( bitmap , ĠMEM ORY ) ĊĠĠĠ Ġverify ( pic asso ). cancel Request ( target ) ĊĠĠĠ Ġverify ( pic asso , Ġnever ()). enqueue And Submit ( any ( Action :: class . java )) ĊĠ Ġ} ĊĊĠ Ġ@ Test Ġfun Ġinto Target With Skip Memory Policy () Ġ{ ĊĠĠĠ Ġval Ġtarget Ġ= Ġmock Target () ĊĠĠĠ ĠRequest Creator ( pic asso , ĠURI _ 1 , Ġ 0 ). memory Policy ( NO _ CACHE ). into ( target ) ĊĠĠĠ Ġverify ( pic asso , Ġnever ()). quick Memory Cache Check ( URI _ KEY _ 1 ) ĊĠ Ġ} ĊĊĠ Ġ@ Test Ġfun Ġinto Target And NotIn Cache Submit s Target Request () Ġ{ ĊĠĠĠ Ġval Ġtarget Ġ= Ġmock Target () ĊĠĠĠ Ġval Ġplace Holder Drawable Ġ= Ġmock ( Drawable :: class . java ) ĊĠĠĠ ĠRequest Creator ( pic asso , ĠURI _ 1 , Ġ 0 ). placeholder ( place Holder Drawable ). into ( target ) ĊĠĠĠ Ġverify ( target ). on Prepare Load ( place Holder Drawable ) ĊĠĠĠ Ġverify ( pic asso ). enqueue And Submit ( action Captor . capture ()) ĊĠĠĠ ĠassertThat ( action Captor . value ). isInstanceOf ( Bitmap Target Action :: class . java ) ĊĠ Ġ} ĊĊĠ Ġ@ Test Ġfun Ġtarget Action WithDefault Priority () Ġ{ ĊĠĠĠ ĠRequest Creator ( pic asso , ĠURI _ 1 , Ġ 0 ). into ( mock Target ()) ĊĠĠĠ Ġverify ( pic asso ). enqueue And Submit ( action Captor . capture ()) ĊĠĠĠ ĠassertThat ( action Captor . value . request . priority ). isEqualTo ( NORMAL ) ĊĠ Ġ} ĊĊĠ Ġ@ Test Ġfun Ġtarget Action With Custom Priority () Ġ{ ĊĠĠĠ ĠRequest Creator ( pic asso , ĠURI _ 1 , Ġ 0 ). priority ( HIGH ). into ( mock Target ()) ĊĠĠĠ Ġverify ( pic asso ). enqueue And Submit ( action Captor . capture ()) ĊĠĠĠ ĠassertThat ( action Captor . value . request . priority ). isEqualTo ( HIGH ) ĊĠ Ġ} ĊĊĠ Ġ@ Test Ġfun Ġtarget Action WithDefault Tag () Ġ{ ĊĠĠĠ ĠRequest Creator ( pic asso , ĠURI _ 1 , Ġ 0 ). into ( mock Target ()) ĊĠĠĠ Ġverify ( pic asso ). enqueue And Submit ( action Captor . capture ()) ĊĠĠĠ ĠassertThat ( action Captor . value . tag ). isEqualTo ( action Captor . value ) ĊĠ Ġ} ĊĊĠ Ġ@ Test Ġfun Ġtarget Action With Custom Tag () Ġ{ ĊĠĠĠ ĠRequest Creator ( pic asso , ĠURI _ 1 , Ġ 0 ). tag (" tag "). into ( mock Target ()) ĊĠĠĠ Ġverify ( pic asso ). enqueue And Submit ( action Captor . capture ()) ĊĠĠĠ ĠassertThat ( action Captor . value . tag ). isEqualTo (" tag ") ĊĠ Ġ} ĊĊĠ Ġ@ Test Ġfun Ġinto ImageView With Null Uri And ResourceId Sk ips And Cancel s () Ġ{ ĊĠĠĠ Ġval Ġtarget Ġ= Ġmock ImageView Target () ĊĠĠĠ ĠRequest Creator ( pic asso , Ġnull , Ġ 0 ). into ( target ) ĊĠĠĠ Ġverify ( pic asso ). cancel Request ( target ) ĊĠĠĠ Ġverify ( pic asso , Ġnever ()). quick Memory Cache Check ( any String ()) ĊĠĠĠ Ġverify ( pic asso , Ġnever ()). enqueue And Submit ( any ( Action :: class . java )) ĊĠ Ġ} ĊĊĠ Ġ@ Test Ġfun Ġinto ImageView With Quick Memory Cache Check DoesNot Submit () Ġ{ ĊĠĠĠ Ġval Ġcache Ġ= ĠPlatform L ru Cache ( 0 ) ĊĠĠĠ Ġval Ġpic asso Ġ= Ġspy ( ĊĠĠĠĠĠ ĠPic asso ( ĊĠĠĠĠĠĠĠ ĠRuntime Environment . application , Ġmock ( Dispatcher :: class . java ), ĠUN USED _ CALL _ FACTORY , ĊĠĠĠĠĠĠĠ Ġnull , Ġcache , Ġnull , ĠNO _ TRANSFORM ERS , ĠNO _ HAND L ERS , ĠNO _ EVENT _ LIST EN ERS , ĠAR GB _ 8 8 8 8 , ĊĠĠĠĠĠĠĠ Ġindicators Enabled Ġ= Ġfalse , Ġis Logging Enabled Ġ= Ġfalse ĊĠĠĠĠĠ Ġ) ĊĠĠĠ Ġ) ĊĠĠĠ Ġdo Return ( bitmap ). ` when `( pic asso ). quick Memory Cache Check ( URI _ KEY _ 1 ) ĊĠĠĠ Ġval Ġtarget Ġ= Ġmock ImageView Target () ĊĠĠĠ Ġval Ġcallback Ġ= Ġmock Callback () ĊĠĠĠ ĠRequest Creator ( pic asso , ĠURI _ 1 , Ġ 0 ). into ( target , Ġcallback ) ĊĠĠĠ Ġverify ( target ). setImage Drawable ( any ( Pic asso Drawable :: class . java )) ĊĠĠĠ Ġverify ( callback ). on Success () ĊĠĠĠ Ġverify ( pic asso ). cancel Request ( target ) ĊĠĠĠ Ġverify ( pic asso , Ġnever ()). enqueue And Submit ( any ( Action :: class . java )) ĊĠ Ġ} ĊĊĠ Ġ@ Test Ġfun Ġinto ImageView Sets Placeholder Drawable () Ġ{ ĊĠĠĠ Ġval Ġcache Ġ= ĠPlatform L ru Cache ( 0 ) ĊĠĠĠ Ġval Ġpic asso Ġ= Ġspy ( ĊĠĠĠĠĠ ĠPic asso ( ĊĠĠĠĠĠĠĠ ĠRuntime Environment . application , Ġmock ( Dispatcher :: class . java ), ĠUN USED _ CALL _ FACTORY , ĊĠĠĠĠĠĠĠ Ġnull , Ġcache , Ġnull , ĠNO _ TRANSFORM ERS , ĠNO _ HAND L ERS , ĠNO _ EVENT _ LIST EN ERS , ĠAR GB _ 8 8 8 8 , ĊĠĠĠĠĠĠĠ Ġfalse , Ġfalse ĊĠĠĠĠĠ Ġ) ĊĠĠĠ Ġ) ĊĠĠĠ Ġval Ġtarget Ġ= Ġmock ImageView Target () ĊĠĠĠ Ġval Ġplace Holder Drawable Ġ= Ġmock ( Drawable :: class . java ) ĊĠĠĠ ĠRequest Creator ( pic asso , ĠURI _ 1 , Ġ 0 ). placeholder ( place Holder Drawable ). into ( target ) ĊĠĠĠ Ġverify ( target ). setImage Drawable ( place Holder Drawable ) ĊĠĠĠ Ġverify ( pic asso ). enqueue And Submit ( action Captor . capture ()) ĊĠĠĠ ĠassertThat ( action Captor . value ). isInstanceOf ( ImageView Action :: class . java ) ĊĠ Ġ} ĊĊĠ Ġ@ Test Ġfun Ġinto ImageView No Placeholder Drawable () Ġ{ ĊĠĠĠ Ġval Ġcache Ġ= ĠPlatform L ru Cache ( 0 ) ĊĠĠĠ Ġval Ġpic asso Ġ= Ġspy ( ĊĠĠĠĠĠ ĠPic asso ( ĊĠĠĠĠĠĠĠ ĠRuntime Environment . application , Ġmock ( Dispatcher :: class . java ), ĠUN USED _ CALL _ FACTORY , ĊĠĠĠĠĠĠĠ Ġnull , Ġcache , Ġnull , ĠNO _ TRANSFORM ERS , ĠNO _ HAND L ERS , ĠNO _ EVENT _ LIST EN ERS , ĠAR GB _ 8 8 8 8 , ĊĠĠĠĠĠĠĠ Ġindicators Enabled Ġ= Ġfalse , Ġis Logging Enabled Ġ= Ġfalse ĊĠĠĠĠĠ Ġ) ĊĠĠĠ Ġ) ĊĠĠĠ Ġval Ġtarget Ġ= Ġmock ImageView Target () ĊĠĠĠ ĠRequest Creator ( pic asso , ĠURI _ 1 , Ġ 0 ). no Placeholder (). into ( target ) ĊĠĠĠ Ġverify No More Interactions ( target ) ĊĠĠĠ Ġverify ( pic asso ). enqueue And Submit ( action Captor . capture ()) ĊĠĠĠ ĠassertThat ( action Captor . value ). isInstanceOf ( ImageView Action :: class . java ) ĊĠ Ġ} ĊĊĠ Ġ@ Test Ġfun Ġinto ImageView Sets Placeholder With ResourceId () Ġ{ ĊĠĠĠ Ġval Ġcache Ġ= ĠPlatform L ru Cache ( 0 ) ĊĠĠĠ Ġval Ġpic asso Ġ= Ġspy ( ĊĠĠĠĠĠ ĠPic asso ( ĊĠĠĠĠĠĠĠ ĠRuntime Environment . application , Ġmock ( Dispatcher :: class . java ), ĠUN USED _ CALL _ FACTORY , ĊĠĠĠĠĠĠĠ Ġnull , Ġcache , Ġnull , ĠNO _ TRANSFORM ERS , ĠNO _ HAND L ERS , ĠNO _ EVENT _ LIST EN ERS , ĠAR GB _ 8 8 8 8 , ĊĠĠĠĠĠĠĠ Ġindicators Enabled Ġ= Ġfalse , Ġis Logging Enabled Ġ= Ġfalse ĊĠĠĠĠĠ Ġ) ĊĠĠĠ Ġ) ĊĠĠĠ Ġval Ġtarget Ġ= Ġmock ImageView Target () ĊĠĠĠ ĠRequest Creator ( pic asso , ĠURI _ 1 , Ġ 0 ). placeholder ( android . R . drawable . picture _ frame ). into ( target ) ĊĠĠĠ Ġval Ġdrawable Captor Ġ= ĠArgument Captor . for Class ( Drawable :: class . java ) ĊĠĠĠ Ġverify ( target ). setImage Drawable ( drawable Captor . capture ()) ĊĠĠĠ ĠassertThat ( shadow Of ( drawable Captor . value ). created From Res Id ) ĊĠĠĠĠĠ Ġ. isEqualTo ( android . R . drawable . picture _ frame ) ĊĠĠĠ Ġverify ( pic asso ). enqueue And Submit ( action Captor . capture ()) ĊĠĠĠ ĠassertThat ( action Captor . value ). isInstanceOf ( ImageView Action :: class . java ) ĊĠ Ġ} ĊĊĠ Ġ@ Test Ġfun Ġcancel Not On MainThread Cr ashes () Ġ{ ĊĠĠĠ Ġdo Call Real Method (). ` when `( pic asso ). cancel Request ( any ( Bitmap Target :: class . java )) ĊĠĠĠ Ġval Ġl atch Ġ= ĠCount DownLatch ( 1 ) ĊĠĠĠ ĠThread Ġ{ ĊĠĠĠĠĠ Ġtry Ġ{ ĊĠĠĠĠĠĠĠ ĠRequest Creator ( pic asso , Ġnull , Ġ 0 ). into ( mock Target ()) ĊĠĠĠĠĠĠĠ Ġfail (" Should Ġhave Ġthrown ĠIllegalStateException ") ĊĠĠĠĠĠ Ġ} Ġcatch Ġ( ignored : ĠIllegalStateException ) Ġ{ ĊĠĠĠĠĠ Ġ} Ġfinally Ġ{ ĊĠĠĠĠĠĠĠ Ġl atch . count Down () ĊĠĠĠĠĠ Ġ} ĊĠĠĠ Ġ}. start () ĊĠĠĠ Ġl atch . await () ĊĠ Ġ} ĊĊĠ Ġ@ Test Ġfun Ġinto Not On MainThread Cr ashes () Ġ{ ĊĠĠĠ Ġdo Call Real Method (). ` when `( pic asso ). enqueue And Submit ( any ( Action :: class . java )) ĊĠĠĠ Ġval Ġl atch Ġ= ĠCount DownLatch ( 1 ) ĊĠĠĠ ĠThread Ġ{ ĊĠĠĠĠĠ Ġtry Ġ{ ĊĠĠĠĠĠĠĠ ĠRequest Creator ( pic asso , ĠURI _ 1 , Ġ 0 ). into ( mock ImageView Target ()) ĊĠĠĠĠĠĠĠ Ġfail (" Should Ġhave Ġthrown ĠIllegalStateException ") ĊĠĠĠĠĠ Ġ} Ġcatch Ġ( ignored : ĠIllegalStateException ) Ġ{ ĊĠĠĠĠĠ Ġ} Ġfinally Ġ{ ĊĠĠĠĠĠĠĠ Ġl atch . count Down () ĊĠĠĠĠĠ Ġ} ĊĠĠĠ Ġ}. start () ĊĠĠĠ Ġl atch . await () ĊĠ Ġ} ĊĊĠ Ġ@ Test Ġfun Ġinto ImageView And NotIn Cache Submit s ImageView Request () Ġ{ ĊĠĠĠ Ġval Ġtarget Ġ= Ġmock ImageView Target () ĊĠĠĠ ĠRequest Creator ( pic asso , ĠURI _ 1 , Ġ 0 ). into ( target ) ĊĠĠĠ Ġverify ( pic asso ). enqueue And Submit ( action Captor . capture ()) ĊĠĠĠ ĠassertThat ( action Captor . value ). isInstanceOf ( ImageView Action :: class . java ) ĊĠ Ġ} ĊĊĠ Ġ@ Test Ġfun Ġinto ImageView With Fit And No Dimensions Queues Deferred ImageView Request () Ġ{ ĊĠĠĠ Ġval Ġtarget Ġ= Ġmock Fit ImageView Target ( true ) ĊĠĠĠ Ġ` when `( target . width ). thenReturn ( 0 ) ĊĠĠĠ Ġ` when `( target . height ). thenReturn ( 0 ) ĊĠĠĠ ĠRequest Creator ( pic asso , ĠURI _ 1 , Ġ 0 ). fit (). into ( target ) ĊĠĠĠ Ġverify ( pic asso , Ġnever ()). enqueue And Submit ( any ( Action :: class . java )) ĊĠĠĠ Ġverify ( pic asso ). defer ( eq ( target ), Ġany ( Deferred Request Creator :: class . java )) ĊĠ Ġ} ĊĊĠ Ġ@ Test Ġfun Ġinto ImageView With Fit And Dimensions Queues ImageView Request () Ġ{ ĊĠĠĠ Ġval Ġtarget Ġ= Ġmock Fit ImageView Target ( true ) ĊĠĠĠ Ġ` when `( target . width ). thenReturn ( 1 0 0 ) ĊĠĠĠ Ġ` when `( target . height ). thenReturn ( 1 0 0 ) ĊĠĠĠ ĠRequest Creator ( pic asso , ĠURI _ 1 , Ġ 0 ). fit (). into ( target ) ĊĠĠĠ Ġverify ( pic asso ). enqueue And Submit ( action Captor . capture ()) ĊĠĠĠ ĠassertThat ( action Captor . value ). isInstanceOf ( ImageView Action :: class . java ) ĊĠ Ġ} ĊĊĠ Ġ@ Test Ġfun Ġinto ImageView With Skip Memory Cache Policy () Ġ{ ĊĠĠĠ Ġval Ġtarget Ġ= Ġmock ImageView Target () ĊĠĠĠ ĠRequest Creator ( pic asso , ĠURI _ 1 , Ġ 0 ). memory Policy ( NO _ CACHE ). into ( target ) ĊĠĠĠ Ġverify ( pic asso , Ġnever ()). quick Memory Cache Check ( URI _ KEY _ 1 ) ĊĠ Ġ} ĊĊĠ Ġ@ Test Ġfun Ġinto ImageView With Fit And Resize Throws () Ġ{ ĊĠĠĠ Ġtry Ġ{ ĊĠĠĠĠĠ Ġval Ġtarget Ġ= Ġmock ImageView Target () ĊĠĠĠĠĠ ĠRequest Creator ( pic asso , ĠURI _ 1 , Ġ 0 ). fit (). resize ( 1 0 , Ġ 1 0 ). into ( target ) ĊĠĠĠĠĠ Ġfail (" Calling Ġinto () ĠImageView Ġwith Ġfit () Ġand Ġresize () Ġshould Ġthrow Ġexception ") ĊĠĠĠ Ġ} Ġcatch Ġ( ignored : ĠIllegalStateException ) Ġ{ ĊĠĠĠ Ġ} ĊĠ Ġ} ĊĊĠ Ġ@ Test Ġfun ĠimageView Action WithDefault Priority () Ġ{ ĊĠĠĠ ĠRequest Creator ( pic asso , ĠURI _ 1 , Ġ 0 ). into ( mock ImageView Target ()) ĊĠĠĠ Ġverify ( pic asso ). enqueue And Submit ( action Captor . capture ()) ĊĠĠĠ ĠassertThat ( action Captor . value . request . priority ). isEqualTo ( NORMAL ) ĊĠ Ġ} ĊĊĠ Ġ@ Test Ġfun ĠimageView Action With Custom Priority () Ġ{ ĊĠĠĠ ĠRequest Creator ( pic asso , ĠURI _ 1 , Ġ 0 ). priority ( HIGH ). into ( mock ImageView Target ()) ĊĠĠĠ Ġverify ( pic asso ). enqueue And Submit ( action Captor . capture ()) ĊĠĠĠ ĠassertThat ( action Captor . value . request . priority ). isEqualTo ( HIGH ) ĊĠ Ġ} ĊĊĠ Ġ@ Test Ġfun ĠimageView Action WithDefault Tag () Ġ{ ĊĠĠĠ ĠRequest Creator ( pic asso , ĠURI _ 1 , Ġ 0 ). into ( mock ImageView Target ()) ĊĠĠĠ Ġverify ( pic asso ). enqueue And Submit ( action Captor . capture ()) ĊĠĠĠ ĠassertThat ( action Captor . value . tag ). isEqualTo ( action Captor . value ) ĊĠ Ġ} ĊĊĠ Ġ@ Test Ġfun ĠimageView Action With Custom Tag () Ġ{ ĊĠĠĠ ĠRequest Creator ( pic asso , ĠURI _ 1 , Ġ 0 ). tag (" tag "). into ( mock ImageView Target ()) ĊĠĠĠ Ġverify ( pic asso ). enqueue And Submit ( action Captor . capture ()) ĊĠĠĠ ĠassertThat ( action Captor . value . tag ). isEqualTo (" tag ") ĊĠ Ġ} ĊĊĠ Ġ@ Test Ġfun Ġinto Remote Views Widget Queues App Widget Action () Ġ{ ĊĠĠĠ ĠRequest Creator ( pic asso , ĠURI _ 1 , Ġ 0 ). into ( mock Remote Views (), Ġ 0 , Ġint ArrayOf ( 1 , Ġ 2 , Ġ 3 )) ĊĠĠĠ Ġverify ( pic asso ). enqueue And Submit ( action Captor . capture ()) ĊĠĠĠ ĠassertThat ( action Captor . value ). isInstanceOf ( App Widget Action :: class . java ) ĊĠ Ġ} ĊĊĠ Ġ@ Test Ġfun Ġinto Remote Views Notification Queues Notification Action () Ġ{ ĊĠĠĠ ĠRequest Creator ( pic asso , ĠURI _ 1 , Ġ 0 ). into ( mock Remote Views (), Ġ 0 , Ġ 0 , Ġmock Notification ()) ĊĠĠĠ Ġverify ( pic asso ). enqueue And Submit ( action Captor . capture ()) ĊĠĠĠ ĠassertThat ( action Captor . value ). isInstanceOf ( Notification Action :: class . java ) ĊĠ Ġ} ĊĊĠ Ġ@ Test Ġfun Ġinto Remote Views Widget With Placeholder Drawable Throws () Ġ{ ĊĠĠĠ Ġtry Ġ{ ĊĠĠĠĠĠ ĠRequest Creator ( pic asso , ĠURI _ 1 , Ġ 0 ). placeholder ( Color Drawable ( 0 )) ĊĠĠĠĠĠĠĠ Ġ. into ( mock Remote Views (), Ġ 0 , Ġint ArrayOf ( 1 , Ġ 2 , Ġ 3 )) ĊĠĠĠĠĠ Ġfail (" Calling Ġinto () Ġwith Ġplaceholder Ġdrawable Ġshould Ġthrow Ġexception ") ĊĠĠĠ Ġ} Ġcatch Ġ( ignored : ĠIllegalArgumentException ) Ġ{ ĊĠĠĠ Ġ} ĊĠ Ġ} ĊĊĠ Ġ@ Test Ġfun Ġinto Remote Views Widget WithError Drawable Throws () Ġ{ ĊĠĠĠ Ġtry Ġ{ ĊĠĠĠĠĠ ĠRequest Creator ( pic asso , ĠURI _ 1 , Ġ 0 ). error ( Color Drawable ( 0 )) ĊĠĠĠĠĠĠĠ Ġ. into ( mock Remote Views (), Ġ 0 , Ġint ArrayOf ( 1 , Ġ 2 , Ġ 3 )) ĊĠĠĠĠĠ Ġfail (" Calling Ġinto () Ġwith Ġerror Ġdrawable Ġshould Ġthrow Ġexception ") ĊĠĠĠ Ġ} Ġcatch Ġ( ignored : ĠIllegalArgumentException ) Ġ{ ĊĠĠĠ Ġ} ĊĠ Ġ} ĊĊĠ Ġ@ Test Ġfun Ġinto Remote Views Notification With Placeholder Drawable Throws () Ġ{ ĊĠĠĠ Ġtry Ġ{ ĊĠĠĠĠĠ ĠRequest Creator ( pic asso , ĠURI _ 1 , Ġ 0 ). placeholder ( Color Drawable ( 0 )) ĊĠĠĠĠĠĠĠ Ġ. into ( mock Remote Views (), Ġ 0 , Ġ 0 , Ġmock Notification ()) ĊĠĠĠĠĠ Ġfail (" Calling Ġinto () Ġwith Ġerror Ġdrawable Ġshould Ġthrow Ġexception ") ĊĠĠĠ Ġ} Ġcatch Ġ( ignored : ĠIllegalArgumentException ) Ġ{ ĊĠĠĠ Ġ} ĊĠ Ġ} ĊĊĠ Ġ@ Test Ġfun Ġinto Remote Views Notification WithError Drawable Throws () Ġ{ ĊĠĠĠ Ġtry Ġ{ ĊĠĠĠĠĠ ĠRequest Creator ( pic asso , ĠURI _ 1 , Ġ 0 ). error ( Color Drawable ( 0 )) ĊĠĠĠĠĠĠĠ Ġ. into ( mock Remote Views (), Ġ 0 , Ġ 0 , Ġmock Notification ()) ĊĠĠĠĠĠ Ġfail (" Calling Ġinto () Ġwith Ġerror Ġdrawable Ġshould Ġthrow Ġexception ") ĊĠĠĠ Ġ} Ġcatch Ġ( ignored : ĠIllegalArgumentException ) Ġ{ ĊĠĠĠ Ġ} ĊĠ Ġ} ĊĊĠ Ġ@ Test Ġfun Ġinto Remote Views Widget With Fit Throws () Ġ{ ĊĠĠĠ Ġtry Ġ{ ĊĠĠĠĠĠ Ġval Ġremote Views Ġ= Ġmock Remote Views () ĊĠĠĠĠĠ ĠRequest Creator ( pic asso , ĠURI _ 1 , Ġ 0 ). fit (). into ( remote Views , Ġ 1 , Ġint ArrayOf ( 1 , Ġ 2 , Ġ 3 )) ĊĠĠĠĠĠ Ġfail (" Calling Ġfit () Ġinto Ġremote Ġviews Ġshould Ġthrow Ġexception ") ĊĠĠĠ Ġ} Ġcatch Ġ( ignored : ĠIllegalStateException ) Ġ{ ĊĠĠĠ Ġ} ĊĠ Ġ} ĊĊĠ Ġ@ Test Ġfun Ġinto Remote Views Notification With Fit Throws () Ġ{ ĊĠĠĠ Ġtry Ġ{ ĊĠĠĠĠĠ Ġval Ġremote Views Ġ= Ġmock Remote Views () ĊĠĠĠĠĠ ĠRequest Creator ( pic asso , ĠURI _ 1 , Ġ 0 ). fit (). into ( remote Views , Ġ 1 , Ġ 1 , Ġmock Notification ()) ĊĠĠĠĠĠ Ġfail (" Calling Ġfit () Ġinto Ġremote Ġviews Ġshould Ġthrow Ġexception ") ĊĠĠĠ Ġ} Ġcatch Ġ( ignored : ĠIllegalStateException ) Ġ{ ĊĠĠĠ Ġ} ĊĠ Ġ} ĊĊĠ Ġ@ Test Ġfun Ġinto Target No Resize With Center Inside Or Center Crop Throws () Ġ{ ĊĠĠĠ Ġtry Ġ{ ĊĠĠĠĠĠ ĠRequest Creator ( pic asso , ĠURI _ 1 , Ġ 0 ). center Inside (). into ( mock Target ()) ĊĠĠĠĠĠ Ġfail (" Center Ġinside Ġwith Ġunknown Ġwidth Ġshould Ġthrow Ġexception .") ĊĠĠĠ Ġ} Ġcatch Ġ( ignored : ĠIllegalStateException ) Ġ{ ĊĠĠĠ Ġ} ĊĠĠĠ Ġtry Ġ{ ĊĠĠĠĠĠ ĠRequest Creator ( pic asso , ĠURI _ 1 , Ġ 0 ). center Crop (). into ( mock Target ()) ĊĠĠĠĠĠ Ġfail (" Center Ġinside Ġwith Ġunknown Ġheight Ġshould Ġthrow Ġexception .") ĊĠĠĠ Ġ} Ġcatch Ġ( ignored : ĠIllegalStateException ) Ġ{ ĊĠĠĠ Ġ} ĊĠ Ġ} ĊĊĠ Ġ@ Test Ġfun Ġapp Widget Action WithDefault Priority () Ġ{ ĊĠĠĠ ĠRequest Creator ( pic asso , ĠURI _ 1 , Ġ 0 ). into ( mock Remote Views (), Ġ 0 , Ġint ArrayOf ( 1 , Ġ 2 , Ġ 3 )) ĊĠĠĠ Ġverify ( pic asso ). enqueue And Submit ( action Captor . capture ()) ĊĠĠĠ ĠassertThat ( action Captor . value . request . priority ). isEqualTo ( NORMAL ) ĊĠ Ġ} ĊĊĠ Ġ@ Test Ġfun Ġapp Widget Action With Custom Priority () Ġ{ ĊĠĠĠ ĠRequest Creator ( pic asso , ĠURI _ 1 , Ġ 0 ). priority ( HIGH ). into ( mock Remote Views (), Ġ 0 , Ġint ArrayOf ( 1 , Ġ 2 , Ġ 3 )) ĊĠĠĠ Ġverify ( pic asso ). enqueue And Submit ( action Captor . capture ()) ĊĠĠĠ ĠassertThat ( action Captor . value . request . priority ). isEqualTo ( HIGH ) ĊĠ Ġ} ĊĊĠ Ġ@ Test Ġfun Ġnotification Action WithDefault Priority () Ġ{ ĊĠĠĠ ĠRequest Creator ( pic asso , ĠURI _ 1 , Ġ 0 ). into ( mock Remote Views (), Ġ 0 , Ġ 0 , Ġmock Notification ()) ĊĠĠĠ Ġverify ( pic asso ). enqueue And Submit ( action Captor . capture ()) ĊĠĠĠ ĠassertThat ( action Captor . value . request . priority ). isEqualTo ( NORMAL ) ĊĠ Ġ} ĊĊĠ Ġ@ Test Ġfun Ġnotification Action With Custom Priority () Ġ{ ĊĠĠĠ ĠRequest Creator ( pic asso , ĠURI _ 1 , Ġ 0 ). priority ( HIGH ) ĊĠĠĠĠĠ Ġ. into ( mock Remote Views (), Ġ 0 , Ġ 0 , Ġmock Notification ()) ĊĠĠĠ Ġverify ( pic asso ). enqueue And Submit ( action Captor . capture ()) ĊĠĠĠ ĠassertThat ( action Captor . value . request . priority ). isEqualTo ( HIGH ) ĊĠ Ġ} ĊĊĠ Ġ@ Test Ġfun Ġapp Widget Action WithDefault Tag () Ġ{ ĊĠĠĠ ĠRequest Creator ( pic asso , ĠURI _ 1 , Ġ 0 ). into ( mock Remote Views (), Ġ 0 , Ġint ArrayOf ( 1 , Ġ 2 , Ġ 3 )) ĊĠĠĠ Ġverify ( pic asso ). enqueue And Submit ( action Captor . capture ()) ĊĠĠĠ ĠassertThat ( action Captor . value . tag ). isEqualTo ( action Captor . value ) ĊĠ Ġ} ĊĊĠ Ġ@ Test Ġfun Ġapp Widget Action With Custom Tag () Ġ{ ĊĠĠĠ ĠRequest Creator ( pic asso , ĠURI _ 1 , Ġ 0 ). tag (" tag ") ĊĠĠĠĠĠ Ġ. into ( remote Views Ġ= Ġmock Remote Views (), Ġview Id Ġ= Ġ 0 , Ġapp Widget Ids Ġ= Ġint ArrayOf ( 1 , Ġ 2 , Ġ 3 )) ĊĠĠĠ Ġverify ( pic asso ). enqueue And Submit ( action Captor . capture ()) ĊĠĠĠ ĠassertThat ( action Captor . value . tag ). isEqualTo (" tag ") ĊĠ Ġ} ĊĊĠ Ġ@ Test Ġfun Ġnotification Action WithDefault Tag () Ġ{ ĊĠĠĠ ĠRequest Creator ( pic asso , ĠURI _ 1 , Ġ 0 ) ĊĠĠĠĠĠ Ġ. into ( ĊĠĠĠĠĠĠĠ Ġremote Views Ġ= Ġmock Remote Views (), ĊĠĠĠĠĠĠĠ Ġview Id Ġ= Ġ 0 , ĊĠĠĠĠĠĠĠ Ġnotification Id Ġ= Ġ 0 , ĊĠĠĠĠĠĠĠ Ġnotification Ġ= Ġmock Notification () ĊĠĠĠĠĠ Ġ) ĊĠĠĠ Ġverify ( pic asso ). enqueue And Submit ( action Captor . capture ()) ĊĠĠĠ ĠassertThat ( action Captor . value . tag ). isEqualTo ( action Captor . value ) ĊĠ Ġ} ĊĊĠ Ġ@ Test Ġfun Ġnotification Action With Custom Tag () Ġ{ ĊĠĠĠ ĠRequest Creator ( pic asso , ĠURI _ 1 , Ġ 0 ). tag (" tag ") ĊĠĠĠĠĠ Ġ. into ( mock Remote Views (), Ġ 0 , Ġ 0 , Ġmock Notification ()) ĊĠĠĠ Ġverify ( pic asso ). enqueue And Submit ( action Captor . capture ()) ĊĠĠĠ ĠassertThat ( action Captor . value . tag ). isEqualTo (" tag ") ĊĠ Ġ} ĊĊĠ Ġ@ Test Ġfun Ġinvalid Resize () Ġ{ ĊĠĠĠ Ġtry Ġ{ ĊĠĠĠĠĠ Ġmock Request Creator ( pic asso ). resize (- 1 , Ġ 1 0 ) ĊĠĠĠĠĠ Ġfail (" Negative Ġwidth Ġshould Ġthrow Ġexception .") ĊĠĠĠ Ġ} Ġcatch Ġ( ignored : ĠIllegalArgumentException ) Ġ{ ĊĠĠĠ Ġ} ĊĠĠĠ Ġtry Ġ{ ĊĠĠĠĠĠ Ġmock Request Creator ( pic asso ). resize ( 1 0 , Ġ- 1 ) ĊĠĠĠĠĠ Ġfail (" Negative Ġheight Ġshould Ġthrow Ġexception .") ĊĠĠĠ Ġ} Ġcatch Ġ( ignored : ĠIllegalArgumentException ) Ġ{ ĊĠĠĠ Ġ} ĊĠĠĠ Ġtry Ġ{ ĊĠĠĠĠĠ Ġmock Request Creator ( pic asso ). resize ( 0 , Ġ 0 ) ĊĠĠĠĠĠ Ġfail (" Zero Ġdimensions Ġshould Ġthrow Ġexception .") ĊĠĠĠ Ġ} Ġcatch Ġ( ignored : ĠIllegalArgumentException ) Ġ{ ĊĠĠĠ Ġ} ĊĠ Ġ} ĊĊĠ Ġ@ Test Ġfun Ġinvalid Center Crop () Ġ{ ĊĠĠĠ Ġtry Ġ{ ĊĠĠĠĠĠ Ġmock Request Creator ( pic asso ). resize ( 1 0 , Ġ 1 0 ). center Inside (). center Crop () ĊĠĠĠĠĠ Ġfail (" Calling Ġcenter Ġcrop Ġafter Ġcenter Ġinside Ġshould Ġthrow Ġexception .") ĊĠĠĠ Ġ} Ġcatch Ġ( ignored : ĠIllegalStateException ) Ġ{ ĊĠĠĠ Ġ} ĊĠ Ġ} ĊĊĠ Ġ@ Test Ġfun Ġinvalid Center Inside () Ġ{ ĊĠĠĠ Ġtry Ġ{ ĊĠĠĠĠĠ Ġmock Request Creator ( pic asso ). resize ( 1 0 , Ġ 1 0 ). center Crop (). center Inside () ĊĠĠĠĠĠ Ġfail (" Calling Ġcenter Ġinside Ġafter Ġcenter Ġcrop Ġshould Ġthrow Ġexception .") ĊĠĠĠ Ġ} Ġcatch Ġ( ignored : ĠIllegalStateException ) Ġ{ ĊĠĠĠ Ġ} ĊĠ Ġ} ĊĊĠ Ġ@ Test Ġfun Ġinvalid Placeholder Image () Ġ{ ĊĠĠĠ Ġtry Ġ{ ĊĠĠĠĠĠ Ġmock Request Creator ( pic asso ). placeholder ( 0 ) ĊĠĠĠĠĠ Ġfail (" Resource ĠID Ġof Ġzero Ġshould Ġthrow Ġexception .") ĊĠĠĠ Ġ} Ġcatch Ġ( ignored : ĠIllegalArgumentException ) Ġ{ ĊĠĠĠ Ġ} ĊĠĠĠ Ġtry Ġ{ ĊĠĠĠĠĠ Ġmock Request Creator ( pic asso ). placeholder ( 1 ). placeholder ( Color Drawable ( 0 )) ĊĠĠĠĠĠ Ġfail (" Two Ġplaceholders Ġshould Ġthrow Ġexception .") ĊĠĠĠ Ġ} Ġcatch Ġ( ignored : ĠIllegalStateException ) Ġ{ ĊĠĠĠ Ġ} ĊĠĠĠ Ġtry Ġ{ ĊĠĠĠĠĠ Ġmock Request Creator ( pic asso ). placeholder ( Color Drawable ( 0 )). placeholder ( 1 ) ĊĠĠĠĠĠ Ġfail (" Two Ġplaceholders Ġshould Ġthrow Ġexception .") ĊĠĠĠ Ġ} Ġcatch Ġ( ignored : ĠIllegalStateException ) Ġ{ ĊĠĠĠ Ġ} ĊĠ Ġ} ĊĊĠ Ġ@ Test Ġfun Ġinvalid No Placeholder () Ġ{ ĊĠĠĠ Ġtry Ġ{ ĊĠĠĠĠĠ Ġmock Request Creator ( pic asso ). no Placeholder (). placeholder ( Color Drawable ( 0 )) ĊĠĠĠĠĠ Ġfail (" Placeholder Ġafter Ġno Ġplaceholder Ġshould Ġthrow Ġexception .") ĊĠĠĠ Ġ} Ġcatch Ġ( ignored : ĠIllegalStateException ) Ġ{ ĊĠĠĠ Ġ} ĊĠĠĠ Ġtry Ġ{ ĊĠĠĠĠĠ Ġmock Request Creator ( pic asso ). no Placeholder (). placeholder ( 1 ) ĊĠĠĠĠĠ Ġfail (" Placeholder Ġafter Ġno Ġplaceholder Ġshould Ġthrow Ġexception .") ĊĠĠĠ Ġ} Ġcatch Ġ( ignored : ĠIllegalStateException ) Ġ{ ĊĠĠĠ Ġ} ĊĠĠĠ Ġtry Ġ{ ĊĠĠĠĠĠ Ġmock Request Creator ( pic asso ). placeholder ( 1 ). no Placeholder () ĊĠĠĠĠĠ Ġfail (" No Ġplaceholder Ġafter Ġplaceholder Ġshould Ġthrow Ġexception .") ĊĠĠĠ Ġ} Ġcatch Ġ( ignored : ĠIllegalStateException ) Ġ{ ĊĠĠĠ Ġ} ĊĠĠĠ Ġtry Ġ{ ĊĠĠĠĠĠ Ġmock Request Creator ( pic asso ). placeholder ( Color Drawable ( 0 )). no Placeholder () ĊĠĠĠĠĠ Ġfail (" No Ġplaceholder Ġafter Ġplaceholder Ġshould Ġthrow Ġexception .") ĊĠĠĠ Ġ} Ġcatch Ġ( ignored : ĠIllegalStateException ) Ġ{ ĊĠĠĠ Ġ} ĊĠ Ġ} ĊĊĠ Ġ@ Test Ġfun Ġinvalid Error Image () Ġ{ ĊĠĠĠ Ġtry Ġ{ ĊĠĠĠĠĠ Ġmock Request Creator ( pic asso ). error ( 0 ) ĊĠĠĠĠĠ Ġfail (" Resource ĠID Ġof Ġzero Ġshould Ġthrow Ġexception .") ĊĠĠĠ Ġ} Ġcatch Ġ( ignored : ĠIllegalArgumentException ) Ġ{ ĊĠĠĠ Ġ} ĊĠĠĠ Ġtry Ġ{ ĊĠĠĠĠĠ Ġmock Request Creator ( pic asso ). error ( 1 ). error ( Color Drawable ( 0 )) ĊĠĠĠĠĠ Ġfail (" Two Ġerror Ġplaceholders Ġshould Ġthrow Ġexception .") ĊĠĠĠ Ġ} Ġcatch Ġ( ignored : ĠIllegalStateException ) Ġ{ ĊĠĠĠ Ġ} ĊĠĠĠ Ġtry Ġ{ ĊĠĠĠĠĠ Ġmock Request Creator ( pic asso ). error ( Color Drawable ( 0 )). error ( 1 ) ĊĠĠĠĠĠ Ġfail (" Two Ġerror Ġplaceholders Ġshould Ġthrow Ġexception .") ĊĠĠĠ Ġ} Ġcatch Ġ( ignored : ĠIllegalStateException ) Ġ{ ĊĠĠĠ Ġ} ĊĠ Ġ} ĊĊĠ Ġ@ Test Ġfun Ġinvalid Priority () Ġ{ ĊĠĠĠ Ġtry Ġ{ ĊĠĠĠĠĠ Ġmock Request Creator ( pic asso ). priority ( LOW ). priority ( HIGH ) ĊĠĠĠĠĠ Ġfail (" Two Ġprior ities Ġshould Ġthrow Ġexception .") ĊĠĠĠ Ġ} Ġcatch Ġ( ignored : ĠIllegalStateException ) Ġ{ ĊĠĠĠ Ġ} ĊĠ Ġ} ĊĊĠ Ġ@ Test Ġfun Ġalready Set Tag Throws () Ġ{ ĊĠĠĠ Ġtry Ġ{ ĊĠĠĠĠĠ Ġmock Request Creator ( pic asso ). tag (" tag 1 "). tag (" tag 2 ") ĊĠĠĠĠĠ Ġfail (" Two Ġtags Ġshould Ġthrow Ġexception .") ĊĠĠĠ Ġ} Ġcatch Ġ( ignored : ĠIllegalStateException ) Ġ{ ĊĠĠĠ Ġ} ĊĠ Ġ} ĊĊĠ Ġ@ Test Ġfun Ġtransformation List Implementation Valid () Ġ{ ĊĠĠĠ Ġval Ġtransformations Ġ= ĠlistOf ( Test Transformation (" test ")) ĊĠĠĠ Ġmock Request Creator ( pic asso ). transform ( transform ations ) ĊĠĠĠ Ġ// ĠTODO Ġverify Ġsomething ! ĊĠ Ġ} ĊĊĠ Ġ@ Test Ġfun ĠimageView Action With Stable Key () Ġ{ ĊĠĠĠ ĠRequest Creator ( pic asso , ĠURI _ 1 , Ġ 0 ). stable Key ( ST ABLE _ 1 ). into ( mock ImageView Target ()) ĊĠĠĠ Ġverify ( pic asso ). enqueue And Submit ( action Captor . capture ()) ĊĠĠĠ ĠassertThat ( action Captor . value . request . key ). isEqualTo ( ST ABLE _ URI _ KEY _ 1 ) ĊĠ Ġ} ĊĊĠ Ġ@ Test Ġfun ĠimageView Action With Custom Headers () Ġ{ ĊĠĠĠ ĠRequest Creator ( pic asso , ĠURI _ 1 , Ġ 0 ) ĊĠĠĠĠĠ Ġ. add Header ( CUSTOM _ HEADER _ NAME , ĠCUSTOM _ HEADER _ VALUE ) ĊĠĠĠĠĠ Ġ. into ( mock ImageView Target ()) ĊĠĠĠ Ġverify ( pic asso ). enqueue And Submit ( action Captor . capture ()) ĊĠĠĠ ĠassertThat ( action Captor . value . request . headers ! ![ CUSTOM _ HEADER _ NAME ]) ĊĠĠĠĠĠ Ġ. isEqualTo ( CUSTOM _ HEADER _ VALUE ) ĊĠ Ġ} Ċ } Ċ