package Ġcom . sha . bullet in Ċ Ċ import Ġandroidx . fragment . app . Fragment Activity Ċ import Ġcom . n ha ar man . mock it ok otlin 2 . mock Ċ import Ġorg . junit . Before Ċ import Ġorg . junit . Test Ċ Ċ class ĠBullet in Manager Test Ġ{ ĊĠĠĠ Ġprivate Ġlateinit Ġvar Ġactivity : ĠFragment Activity ĊĊĠĠĠ Ġ@ Before ĊĠĠĠ Ġfun Ġsetup () Ġ{ ĊĠĠĠĠĠĠĠ Ġactivity Ġ= Ġmock () ĊĠĠĠĠĠĠĠ ĠBullet in Config . queue Str ategies . clear () ĊĠĠĠĠĠĠĠ ĠBullet in Manager . display ed Bullet ins . clear () ĊĠĠĠĠĠĠĠ ĠQueue Manager . clear () ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġ` show Ġshould Ġinvoke Ġshow Bullet in Ġin Ġhappy Ġscenario `() Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġbullet in Ġ= ĠFake Bullet in () ĊĠĠĠĠĠĠĠ ĠBullet in Manager . show ( bullet in , Ġactivity ) ĊĠĠĠĠĠĠĠ Ġassert ( bullet in . is Show Inv oked ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġ` show Ġshould Ġadd Ġto Ġdisplayed Ġin Ġhappy Ġscenario `() Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġbullet in Ġ= ĠFake Bullet in () ĊĠĠĠĠĠĠĠ ĠBullet in Manager . show ( bullet in , Ġactivity ) ĊĠĠĠĠĠĠĠ Ġassert ( Bullet in Manager . display ed Bullet ins . first () Ġis ĠFake Bullet in ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġ` show Ġshould Ġset Ġstatus ĠDISPLAY ED Ġin Ġhappy Ġscenario `() Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġbullet in Ġ= ĠFake Bullet in () ĊĠĠĠĠĠĠĠ ĠBullet in Manager . show ( bullet in , Ġactivity ) ĊĠĠĠĠĠĠĠ Ġassert ( bullet in . status Ġ== ĠBullet in Status . DISPLAY ED ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġ` show Ġshouldn 't Ġinvoke Ġshow Bullet in Ġif Ġit 's Ġduplicate `() Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġbullet in Ġ= ĠFake Bullet in () ĊĠĠĠĠĠĠĠ Ġbullet in . duplicate Strategy Ġ= ĠName Duplicate Strategy () ĊĠĠĠĠĠĠĠ ĠBullet in Manager . display ed Bullet ins . add ( Fake Bullet in ()) ĊĊĠĠĠĠĠĠĠ ĠBullet in Manager . show ( bullet in , Ġactivity ) ĊĠĠĠĠĠĠĠ Ġassert (! bullet in . is Show Inv oked ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġ` show Ġshould Ġset Ġstatus ĠIG NO RED Ġif Ġit 's Ġduplicate Ġand ĠIgnore Duplicate Strategy ĠDROP `() Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġbullet in Ġ= ĠFake Bullet in () ĊĠĠĠĠĠĠĠ Ġval Ġduplicate Strategy Ġ= ĠName Duplicate Strategy () ĊĠĠĠĠĠĠĠ Ġduplicate Strategy . on Ignore Strategy Ġ= ĠIgnore Duplicate Strategy . DROP ĊĠĠĠĠĠĠĠ Ġbullet in . duplicate Strategy Ġ= Ġduplicate Strategy ĊĠĠĠĠĠĠĠ ĠBullet in Manager . display ed Bullet ins . add ( Fake Bullet in ()) ĊĊĠĠĠĠĠĠĠ ĠBullet in Manager . show ( bullet in , Ġactivity ) ĊĠĠĠĠĠĠĠ Ġassert ( bullet in . status Ġ== ĠBullet in Status . IG NO RED ) ĊĠĠĠ Ġ} ĊĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġ` show Ġshould Ġset Ġstatus ĠQ UE UE Ġif Ġit 's Ġduplicate Ġand ĠIgnore Duplicate Strategy ĠQ UE UE `() Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġbullet in Ġ= ĠFake Bullet in () ĊĠĠĠĠĠĠĠ Ġval Ġduplicate Strategy Ġ= ĠName Duplicate Strategy () ĊĠĠĠĠĠĠĠ Ġbullet in . duplicate Strategy Ġ= Ġduplicate Strategy ĊĠĠĠĠĠĠĠ ĠBullet in Manager . display ed Bullet ins . add ( Fake Bullet in ()) ĊĠĠĠĠĠĠĠ ĠBullet in Config . queue Str ategies Ġ{ Ġ+ ĠAll Queue Strategy () Ġ} ĊĊĠĠĠĠĠĠĠ ĠBullet in Manager . show ( bullet in , Ġactivity ) ĊĠĠĠĠĠĠĠ Ġassert ( bullet in . status Ġ== ĠBullet in Status . QUE U ED ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġ` show Ġshouldn 't Ġchange Ġsize Ġof Ġdisplayed Ġbullet ins Ġif Ġit 's Ġduplicate `() Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġbullet in Ġ= ĠFake Bullet in () ĊĠĠĠĠĠĠĠ Ġbullet in . duplicate Strategy Ġ= ĠName Duplicate Strategy () ĊĠĠĠĠĠĠĠ ĠBullet in Manager . display ed Bullet ins . add ( Fake Bullet in ()) ĊĊĠĠĠĠĠĠĠ ĠBullet in Manager . show ( bullet in , Ġactivity ) ĊĠĠĠĠĠĠĠ Ġassert ( Bullet in Manager . display ed Bullet ins . size Ġ== Ġ 1 ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġ` show Ġshouldn 't Ġinvoke Ġshow Bullet in Ġif Ġit Ġshould Ġbe Ġqueued `() Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġbullet in Ġ= ĠFake Bullet in () ĊĠĠĠĠĠĠĠ ĠBullet in Config . queue Str ategies Ġ{ Ġ+ ĠAll Queue Strategy () Ġ} ĊĠĠĠĠĠĠĠ ĠBullet in Manager . display ed Bullet ins . add ( Fake Bullet in ()) ĊĊĠĠĠĠĠĠĠ ĠBullet in Manager . show ( bullet in , Ġactivity ) ĊĠĠĠĠĠĠĠ Ġassert (! bullet in . is Show Inv oked ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġ` show Ġshould Ġset Ġstatus ĠQ UE U ED Ġif Ġit Ġshould Ġbe Ġqueued `() Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġbullet in Ġ= ĠFake Bullet in () ĊĠĠĠĠĠĠĠ ĠBullet in Config . queue Str ategies Ġ{ Ġ+ ĠAll Queue Strategy () Ġ} ĊĠĠĠĠĠĠĠ ĠBullet in Manager . display ed Bullet ins . add ( Fake Bullet in ()) ĊĊĠĠĠĠĠĠĠ ĠBullet in Manager . show ( bullet in , Ġactivity ) ĊĠĠĠĠĠĠĠ Ġassert ( bullet in . status Ġ== ĠBullet in Status . QUE U ED ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġ` show Ġshouldn 't Ġadd Ġto Ġdisplayed Ġif Ġit Ġshould Ġbe Ġqueued `() Ġ{ ĊĠĠĠĠĠĠĠ ĠBullet in Manager . display ed Bullet ins . clear () ĊĠĠĠĠĠĠĠ Ġval Ġbullet in Ġ= ĠFake Bullet in () ĊĠĠĠĠĠĠĠ ĠBullet in Config . queue Str ategies Ġ{ Ġ+ ĠAll Queue Strategy () Ġ} ĊĠĠĠĠĠĠĠ ĠBullet in Manager . display ed Bullet ins . add ( Fake Bullet in ()) ĊĊĠĠĠĠĠĠĠ ĠBullet in Manager . show ( bullet in , Ġactivity ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġ` show Ġshouldn 't Ġadd Ġto Ġdisplayed Ġin Ġcase Ġstatus ĠDISPLAY ED `() Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġbullet in Ġ= ĠFake Bullet in () ĊĠĠĠĠĠĠĠ Ġbullet in . status Ġ= ĠBullet in Status . DISPLAY ED ĊĠĠĠĠĠĠĠ ĠBullet in Manager . show ( bullet in , Ġactivity ) ĊĊĠĠĠĠĠĠĠ Ġassert ( Bullet in Manager . display ed Bullet ins . isEmpty ()) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġ` show Ġshouldn 't Ġinvoke Ġshow Bullet in Ġin Ġcase Ġstatus ĠDISPLAY ED `() Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġbullet in Ġ= ĠFake Bullet in () ĊĠĠĠĠĠĠĠ Ġbullet in . status Ġ= ĠBullet in Status . DISPLAY ED ĊĠĠĠĠĠĠĠ ĠBullet in Manager . show ( bullet in , Ġactivity ) ĊĊĠĠĠĠĠĠĠ Ġassert (! bullet in . is Show Inv oked ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġ` on Dismiss Ġshould Ġshow Ġnext Ġbullet in Ġin Ġqueue `() Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġbullet in Ġ= ĠFake Bullet in () ĊĠĠĠĠĠĠĠ ĠBullet in Manager . display ed Bullet ins . add ( bullet in ) ĊĠĠĠĠĠĠĠ Ġval Ġnext Ġ= ĠFake Bullet in () ĊĠĠĠĠĠĠĠ ĠQueue Manager . add ( next ) ĊĊĠĠĠĠĠĠĠ ĠBullet in Manager . on Dismiss ( bullet in , Ġactivity ) ĊĠĠĠĠĠĠĠ Ġassert ( next . is Show Inv oked ) ĊĠĠĠ Ġ} ĊĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġ` on Dismiss Ġshould Ġreturn Ġif Ġstatus ĠDIS MIS SED `() Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġbullet in Ġ= ĠFake Bullet in () ĊĠĠĠĠĠĠĠ Ġbullet in . status Ġ= ĠBullet in Status . DIS MIS SED ĊĊĠĠĠĠĠĠĠ ĠBullet in Manager . display ed Bullet ins . add ( bullet in ) ĊĊĠĠĠĠĠĠĠ ĠBullet in Manager . on Dismiss ( bullet in , Ġactivity ) ĊĊĠĠĠĠĠĠĠ Ġassert ( Bullet in Manager . display ed Bullet ins . size Ġ== Ġ 1 ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġ` is Any Displayed Ġshould Ġreturn Ġtrue `() Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġbullet in Ġ= ĠFake Bullet in () ĊĠĠĠĠĠĠĠ ĠBullet in Manager . display ed Bullet ins . add ( bullet in ) ĊĠĠĠĠĠĠĠ ĠBullet in Manager . is Any Displayed () ĊĠĠĠĠĠĠĠ Ġassert ( Bullet in Manager . is Any Displayed ()) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġ` is Any Displayed Ġshould Ġreturn Ġfalse `() Ġ{ ĊĠĠĠĠĠĠĠ Ġassert (! Bullet in Manager . is Any Displayed ()) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġ` is Displayed Ġwith Ġinstance Ġshould Ġreturn Ġtrue `() Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġbullet in Ġ= ĠFake Bullet in () ĊĠĠĠĠĠĠĠ ĠBullet in Manager . display ed Bullet ins . add ( bullet in ) ĊĠĠĠĠĠĠĠ Ġassert ( Bullet in Manager . is Displayed ( bullet in )) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġ` is Displayed Ġwith Ġinstance Ġshould Ġreturn Ġfalse `() Ġ{ ĊĠĠĠĠĠĠĠ Ġassert (! Bullet in Manager . is Any Displayed ()) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġ` is Displayed Ġwith Ġname Ġshould Ġreturn Ġtrue `() Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġbullet in Ġ= ĠFake Bullet in () ĊĠĠĠĠĠĠĠ ĠBullet in Manager . display ed Bullet ins . add ( bullet in ) ĊĠĠĠĠĠĠĠ Ġassert ( Bullet in Manager . is Any Displayed ( bullet in . name )) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġ` is Displayed Ġwith Ġname Ġshould Ġreturn Ġfalse `() Ġ{ ĊĠĠĠĠĠĠĠ Ġassert (! Bullet in Manager . is Any Displayed ( Fake Bullet in (). name )) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġ` is Any Displayed With Content Ġshould Ġreturn Ġtrue `() Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġbullet in Ġ= ĠFake Bullet in () ĊĠĠĠĠĠĠĠ ĠBullet in Manager . display ed Bullet ins . add ( bullet in ) ĊĠĠĠĠĠĠĠ Ġassert ( Bullet in Manager . is Any Displayed With Content ( bullet in . content )) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġ` is Any Displayed With Content Ġshould Ġreturn Ġfalse `() Ġ{ ĊĠĠĠĠĠĠĠ Ġassert (! Bullet in Manager . is Any Displayed With Content ( Fake Bullet in (). content )) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġ` is Any Displayed Ġname Ġand Ġcontent Ġshould Ġreturn Ġtrue `() Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġbullet in Ġ= ĠFake Bullet in () ĊĠĠĠĠĠĠĠ ĠBullet in Manager . display ed Bullet ins . add ( bullet in ) ĊĠĠĠĠĠĠĠ Ġassert ( Bullet in Manager . is Any Displayed ( bullet in . name , Ġbullet in . content )) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġ` is Any Displayed Ġwith Ġname Ġand Ġcontent Ġshould Ġreturn Ġfalse `() Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġbullet in Ġ= ĠFake Bullet in () ĊĠĠĠĠĠĠĠ Ġassert (! Bullet in Manager . is Any Displayed ( bullet in . name , Ġbullet in . content )) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġ` dismiss All Ġshould Ġwork Ġcorrectly `() Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġbullet ins Ġ= Ġset Of ( Fake Bullet in (), ĠFake Bullet in (), ĠFake Bullet in (), ĠFake Bullet in ()) ĊĠĠĠĠĠĠĠ ĠBullet in Manager . display ed Bullet ins . addAll ( bullet ins ) ĊĊĠĠĠĠĠĠĠ ĠBullet in Manager . dismiss All () ĊĊĠĠĠĠĠĠĠ ĠBullet in Manager . display ed Bullet ins . forEach Ġ{ Ġassert (( it Ġas ĠFake Bullet in ). is Dis missed ) Ġ} ĊĠĠĠ Ġ} Ċ Ċ }