package Ġro cks . f ri eler . android . beans Ċ Ċ import Ġassert k . assertThat Ċ import Ġassert k . assertions . is Same As Ċ import Ġcom . n ha ar man . mock it ok otlin 2 . mock Ċ import Ġcom . n ha ar man . mock it ok otlin 2 . verify Ċ import Ġcom . n ha ar man . mock it ok otlin 2 . verify Zero Interactions Ċ import Ġjava . util . function . Consumer Ċ import Ġorg . junit . Test Ċ import Ġorg . junit . runner . RunWith Ċ import Ġorg . mockito . junit . Mockito JUnit Runner Ċ Ċ @ RunWith ( Mockito JUnit Runner :: class ) Ċ class ĠBe ans OfType Consumer Test Ġ{ ĊĠĠĠ Ġprivate Ġval Ġconsumer : Ġ( Beans OfType Consumer Test ) Ġ-> ĠUnit Ġ= Ġmock () ĊĠĠĠ Ġprivate Ġval Ġbe ans OfType Consumer Ġ= ĠBe ans OfType Consumer ( Beans OfType Consumer Test :: class , Ġconsumer ) ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġ` post Process Bean () Ġignores Ġbean Ġthat Ġis Ġnot Ġof Ġspecified Ġtype `() Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġoriginal Bean Ġ= ĠAny () ĊĊĠĠĠĠĠĠĠ Ġval Ġprocessed Bean Ġ= Ġbe ans OfType Consumer . post Process Bean (" bean ", Ġoriginal Bean ) ĊĊĠĠĠĠĠĠĠ Ġverify Zero Interactions ( consumer ) ĊĠĠĠĠĠĠĠ ĠassertThat ( processed Bean ). is Same As ( original Bean ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġ` post Process Bean () Ġconsume s Ġbean Ġof Ġspecified Ġtype Ġand Ġreturns Ġit `() Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġprocessed Bean Ġ= Ġbe ans OfType Consumer . post Process Bean (" bean ", Ġthis ) ĊĊĠĠĠĠĠĠĠ Ġverify ( consumer )( this ) ĊĠĠĠĠĠĠĠ ĠassertThat ( processed Bean ). is Same As ( this ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġ` Beans OfType Consumer Ġcan Ġbe Ġused Ġwith Ġjava - type Ġand Ġ- Consumer `() Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġconsumer : ĠConsumer < Beans OfType Consumer Test > Ġ= Ġmock () ĊĊĠĠĠĠĠĠĠ Ġval Ġbe ans OfType Consumer Ġ= ĠBe ans OfType Consumer ( Beans OfType Consumer Test :: class . java , Ġconsumer ) ĊĠĠĠĠĠĠĠ Ġval Ġprocessed Bean Ġ= Ġbe ans OfType Consumer . post Process Bean (" bean ", Ġthis ) ĊĊĠĠĠĠĠĠĠ Ġverify ( consumer ). accept ( this ) ĊĠĠĠĠĠĠĠ ĠassertThat ( processed Bean ). is Same As ( this ) ĊĠĠĠ Ġ} Ċ } Ċ