/* Ċ Ġ* ĠĠĠ ĠCopyright Ġ 2 0 2 0 ĠC rite o Ċ Ġ* Ċ Ġ* ĠĠĠ Ġ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 . c rite o . publisher . bid Ċ Ċ import Ġcom . c rite o . publisher . model . Ad Size Ċ import Ġcom . c rite o . publisher . model . Cache Ad Unit Ċ import Ġcom . c rite o . publisher . model . C db Request Ċ import Ġcom . c rite o . publisher . model . C db Response Ċ import Ġcom . c rite o . publisher . model . C db Response Slot Ċ import Ġcom . c rite o . publisher . util . Ad Unit Type . CR ITE O _ BAN NER Ċ import Ġorg . junit . Before Ċ import Ġorg . junit . Rule Ċ import Ġorg . junit . Test Ċ import Ġorg . mockito . Mock Ċ import Ġorg . mockito . junit . Mockito JUnit Ċ import Ġorg . mockito . junit . Mockito Rule Ċ import Ġorg . mockito . kotlin . mock Ċ import Ġorg . mockito . kotlin . verify Ċ Ċ class ĠComposite Bid Lifecycle Listener Test Ġ{ ĊĊĠ Ġ@ Rule ĊĠ Ġ@ Jvm Field ĊĠ Ġval Ġmock ito Rule : ĠMockito Rule Ġ= ĠMockito JUnit . rule () ĊĊĠ Ġ@ Mock ĊĠ Ġprivate Ġlateinit Ġvar Ġlistener 1 : ĠBid Lifecycle Listener ĊĊĠ Ġ@ Mock ĊĠ Ġprivate Ġlateinit Ġvar Ġlistener 2 : ĠBid Lifecycle Listener ĊĊĠ Ġprivate Ġlateinit Ġvar Ġlistener : ĠComposite Bid Lifecycle Listener ĊĊĠ Ġ@ Before ĊĠ Ġfun ĠsetUp () Ġ{ ĊĠĠĠ Ġlistener Ġ= ĠComposite Bid Lifecycle Listener (). apply Ġ{ ĊĠĠĠĠĠ Ġadd ( listener 1 ) ĊĠĠĠĠĠ Ġadd ( listener 2 ) ĊĠĠĠ Ġ} ĊĠ Ġ} ĊĊĠ Ġ@ Test ĊĠ Ġfun Ġon Sdk Initialized _ Given Deleg ates _ Delegate To The m () Ġ{ ĊĠĠĠ Ġlistener . on Sdk Initialized () ĊĊĠĠĠ Ġverify ( listener 1 ). on Sdk Initialized () ĊĠĠĠ Ġverify ( listener 2 ). on Sdk Initialized () ĊĠ Ġ} ĊĊĠ Ġ@ Test ĊĠ Ġfun Ġon C db Call Started _ Given Deleg ates _ Delegate To The m () Ġ{ ĊĠĠĠ Ġval Ġrequest Ġ= Ġmock < C db Request >() ĊĊĠĠĠ Ġlistener . on C db Call Started ( request ) ĊĊĠĠĠ Ġverify ( listener 1 ). on C db Call Started ( request ) ĊĠĠĠ Ġverify ( listener 2 ). on C db Call Started ( request ) ĊĠ Ġ} ĊĊĠ Ġ@ Test ĊĠ Ġfun Ġon C db Call Finished _ Given Deleg ates _ Delegate To The m () Ġ{ ĊĠĠĠ Ġval Ġrequest Ġ= Ġmock < C db Request >() ĊĠĠĠ Ġval Ġresponse Ġ= Ġmock < C db Response >() ĊĊĠĠĠ Ġlistener . on C db Call Finished ( request , Ġresponse ) ĊĊĠĠĠ Ġverify ( listener 1 ). on C db Call Finished ( request , Ġresponse ) ĊĠĠĠ Ġverify ( listener 2 ). on C db Call Finished ( request , Ġresponse ) ĊĠ Ġ} ĊĊĠ Ġ@ Test ĊĠ Ġfun Ġon C db Call Failed _ Given Deleg ates _ Delegate To The m () Ġ{ ĊĠĠĠ Ġval Ġrequest Ġ= Ġmock < C db Request >() ĊĠĠĠ Ġval Ġexception Ġ= Ġmock < Exception >() ĊĊĠĠĠ Ġlistener . on C db Call Failed ( request , Ġexception ) ĊĊĠĠĠ Ġverify ( listener 1 ). on C db Call Failed ( request , Ġexception ) ĊĠĠĠ Ġverify ( listener 2 ). on C db Call Failed ( request , Ġexception ) ĊĠ Ġ} ĊĊĠ Ġ@ Test ĊĠ Ġfun Ġon Bid Cons umed _ Given Deleg ates _ Delegate To The m () Ġ{ ĊĠĠĠ Ġval Ġad Unit Ġ= ĠCache Ad Unit ( Ad Size ( 1 , Ġ 2 ), Ġ" my Ad Unit ", ĠCR ITE O _ BAN NER ) ĊĠĠĠ Ġval Ġslot Ġ= Ġmock < C db Response Slot >() ĊĊĠĠĠ Ġlistener . on Bid Cons umed ( ad Unit , Ġslot ) ĊĊĠĠĠ Ġverify ( listener 1 ). on Bid Cons umed ( ad Unit , Ġslot ) ĊĠĠĠ Ġverify ( listener 2 ). on Bid Cons umed ( ad Unit , Ġslot ) ĊĠ Ġ} Ċ }