package Ġcom . mapbox . maps . plugin . location component . anim ators Ċ Ċ import Ġandroid . animation . Value Animator Ċ import Ġandroid . os . Looper Ċ import Ġcom . mapbox . maps . plugin . location component . On Indicator Be aring Changed Listener Ċ import Ġio . mock k .* Ċ import Ġorg . junit . Assert Ċ import Ġorg . junit . Before Ċ import Ġorg . junit . Test Ċ import Ġorg . junit . runner . RunWith Ċ import Ġorg . ro bo lectric . Ro bo lectric TestRunner Ċ import Ġorg . ro bo lectric . Shadow s Ċ import Ġorg . ro bo lectric . annotation . Looper Mode Ċ Ċ @ RunWith ( Ro bo lectric TestRunner :: class ) Ċ @ Looper Mode ( Looper Mode . Mode . PA USED ) Ċ class ĠP uck Be aring Animator Test Ġ{ ĊĊĠ Ġprivate Ġlateinit Ġvar Ġbe aring Animator : ĠP uck Be aring Animator ĊĠ Ġprivate Ġlateinit Ġvar Ġuser Configured Animator : ĠValue Animator ĊĊĠ Ġprivate Ġval Ġbe aring ChangeListener Ġ= Ġmock k < On Indicator Be aring Changed Listener >( relax ed Ġ= Ġtrue ) ĊĊĠ Ġ@ Before ĊĠ Ġfun ĠsetUp () Ġ{ ĊĠĠĠ Ġval Ġanim ator Ġ= ĠP uck Be aring Animator ( be aring ChangeListener ) ĊĠĠĠ Ġuser Configured Animator Ġ= Ġspy k ( anim ator . clone ()) ĊĠĠĠ Ġanim ator . user Configured Animator Ġ= Ġuser Configured Animator ĊĠĠĠ Ġbe aring Animator Ġ= Ġspy k ( anim ator ) ĊĠ Ġ} ĊĊĠ Ġ@ Test ĊĠ Ġfun Ġanimate Update Listener () Ġ{ ĊĠĠĠ ĠShadow s . shadow Of ( Looper . get Main Looper ()). pause () ĊĠĠĠ Ġbe aring Animator . animate ( 0 . 0 , Ġ 1 0 . 0 ) ĊĠĠĠ ĠShadow s . shadow Of ( Looper . get Main Looper ()). idle () ĊĠĠĠ Ġverify Ġ{ ĊĠĠĠĠĠ Ġbe aring ChangeListener . on Indicator Be aring Changed ( any ()) ĊĠĠĠ Ġ} ĊĠĠĠ ĠAssert . assertEquals ( 1 0 . 0 , Ġbe aring Animator . animated Value Ġas ĠDouble , Ġ 0 . 0 0 0 1 ) ĊĠ Ġ} ĊĊĠ Ġ@ Test ĊĠ Ġfun Ġanimate Pre defined () Ġ{ ĊĠĠĠ ĠShadow s . shadow Of ( Looper . get Main Looper ()). pause () ĊĠĠĠ Ġbe aring Animator . animate ( 0 . 0 , Ġ 1 0 . 0 ) ĊĠĠĠ ĠShadow s . shadow Of ( Looper . get Main Looper ()). idle () ĊĠĠĠ Ġverify ( exact ly Ġ= Ġ 0 ) Ġ{ Ġbe aring Animator . cancel () Ġ} ĊĠĠĠ Ġverify ( exact ly Ġ= Ġ 0 ) Ġ{ Ġuser Configured Animator . cancel () Ġ} ĊĠĠĠ Ġverify ( exact ly Ġ= Ġ 1 ) Ġ{ Ġbe aring Animator . start () Ġ} ĊĠĠĠ Ġverify ( exact ly Ġ= Ġ 0 ) Ġ{ Ġuser Configured Animator . start () Ġ} ĊĠ Ġ} ĊĊĠ Ġ@ Test ĊĠ Ġfun Ġanimate Custom Animator Options () Ġ{ ĊĠĠĠ ĠShadow s . shadow Of ( Looper . get Main Looper ()). pause () ĊĠĠĠ Ġbe aring Animator . animate ( 0 . 0 , Ġ 1 0 . 0 , Ġoptions Ġ= Ġ{}) ĊĠĠĠ ĠShadow s . shadow Of ( Looper . get Main Looper ()). idle () ĊĠĠĠ Ġverify ( exact ly Ġ= Ġ 1 ) Ġ{ Ġuser Configured Animator . start () Ġ} ĊĠĠĠ Ġverify ( exact ly Ġ= Ġ 0 ) Ġ{ Ġbe aring Animator . cancel () Ġ} ĊĠĠĠ Ġverify ( exact ly Ġ= Ġ 0 ) Ġ{ Ġuser Configured Animator . cancel () Ġ} ĊĠĠĠ Ġverify ( exact ly Ġ= Ġ 0 ) Ġ{ Ġbe aring Animator . start () Ġ} ĊĠ Ġ} ĊĊĠ Ġ@ Test ĊĠ Ġfun Ġanimate Interrupt Default With Custom () Ġ{ ĊĠĠĠ ĠShadow s . shadow Of ( Looper . get Main Looper ()). pause () ĊĠĠĠ Ġbe aring Animator . animate ( 0 . 0 , Ġ 5 . 0 ) ĊĠĠĠ Ġbe aring Animator . animate ( ĊĠĠĠĠĠĠ 0 . 0 , Ġ 1 0 . 0 , ĊĠĠĠĠĠ Ġoptions Ġ= Ġ{ Ġduration Ġ= Ġ 5 0 Ġ} ĊĠĠĠ Ġ) ĊĠĠĠ ĠShadow s . shadow Of ( Looper . get Main Looper ()). idle () ĊĠĠĠ Ġverify ( exact ly Ġ= Ġ 1 ) Ġ{ Ġbe aring Animator . cancel () Ġ} ĊĠĠĠ Ġverify ( exact ly Ġ= Ġ 0 ) Ġ{ Ġuser Configured Animator . cancel () Ġ} ĊĠĠĠ Ġverify ( exact ly Ġ= Ġ 1 ) Ġ{ Ġbe aring Animator . start () Ġ} ĊĠĠĠ Ġverify ( exact ly Ġ= Ġ 1 ) Ġ{ Ġuser Configured Animator . start () Ġ} ĊĠ Ġ} ĊĊĠ Ġ@ Test ĊĠ Ġfun Ġcancel Running When Not Running () Ġ{ ĊĠĠĠ ĠShadow s . shadow Of ( Looper . get Main Looper ()). pause () ĊĠĠĠ Ġbe aring Animator . cancel Running () ĊĠĠĠ ĠShadow s . shadow Of ( Looper . get Main Looper ()). idle () ĊĠĠĠ Ġverify ( exact ly Ġ= Ġ 0 ) Ġ{ Ġbe aring Animator . cancel () Ġ} ĊĠĠĠ Ġverify ( exact ly Ġ= Ġ 0 ) Ġ{ Ġuser Configured Animator . cancel () Ġ} ĊĠ Ġ} ĊĊĠ Ġ@ Test ĊĠ Ġfun Ġcancel Running When Running () Ġ{ ĊĠĠĠ ĠShadow s . shadow Of ( Looper . get Main Looper ()). pause () ĊĠĠĠ Ġbe aring Animator . animate ( 0 . 0 , Ġ 1 0 . 0 ) ĊĠĠĠ Ġbe aring Animator . cancel Running () ĊĠĠĠ ĠShadow s . shadow Of ( Looper . get Main Looper ()). idle () ĊĠĠĠ Ġverify ( exact ly Ġ= Ġ 1 ) Ġ{ Ġbe aring Animator . cancel () Ġ} ĊĠĠĠ Ġverify ( exact ly Ġ= Ġ 0 ) Ġ{ Ġuser Configured Animator . cancel () Ġ} ĊĠ Ġ} ĊĊĠ Ġ@ Test ĊĠ Ġfun Ġcancel Running When Running Custom () Ġ{ ĊĠĠĠ ĠShadow s . shadow Of ( Looper . get Main Looper ()). pause () ĊĠĠĠ Ġbe aring Animator . animate ( ĊĠĠĠĠĠĠ 0 . 0 , Ġ 1 0 . 0 , ĊĠĠĠĠĠ Ġoptions Ġ= Ġ{ Ġduration Ġ= Ġ 5 0 Ġ} ĊĠĠĠ Ġ) ĊĠĠĠ Ġbe aring Animator . cancel Running () ĊĠĠĠ ĠShadow s . shadow Of ( Looper . get Main Looper ()). idle () ĊĠĠĠ Ġverify ( exact ly Ġ= Ġ 0 ) Ġ{ Ġbe aring Animator . cancel () Ġ} ĊĠĠĠ Ġverify ( exact ly Ġ= Ġ 1 ) Ġ{ Ġuser Configured Animator . cancel () Ġ} ĊĠ Ġ} ĊĊĠ Ġ@ Test ĊĠ Ġfun Ġupdate Options () Ġ{ ĊĠĠĠ ĠShadow s . shadow Of ( Looper . get Main Looper ()). pause () ĊĠĠĠ Ġbe aring Animator . update Options Ġ{ ĊĠĠĠĠĠ Ġduration Ġ= Ġ 2 0 0 0 ĊĠĠĠ Ġ} ĊĠĠĠ Ġbe aring Animator . animate ( 0 . 0 , Ġ 1 0 . 0 ) ĊĠĠĠ ĠShadow s . shadow Of ( Looper . get Main Looper ()). idle () ĊĠĠĠ Ġverify Ġ{ Ġbe aring Animator . start () Ġ} ĊĠĠĠ ĠAssert . assertEquals ( 2 0 0 0 , Ġbe aring Animator . duration ) ĊĠ Ġ} Ċ }