package Ġnl . j ov mit . kat as . bank ing Ċ Ċ import Ġcom . n ha ar man . mock it ok otlin 2 . given Ċ import Ġcom . n ha ar man . mock it ok otlin 2 . verify Ċ import Ġorg . junit . Before Ċ import Ġorg . junit . Test Ċ import Ġorg . junit . runner . RunWith Ċ import Ġorg . mockito . Mock Ċ import Ġorg . mockito . junit . Mockito JUnit Runner Ċ Ċ @ RunWith ( Mockito JUnit Runner :: class ) Ċ class ĠAccount Should Ġ{ ĊĊĠĠĠ Ġ@ Mock ĊĠĠĠ Ġprivate Ġlateinit Ġvar Ġtransaction Repository : ĠTransaction Repository ĊĠĠĠ Ġ@ Mock ĊĠĠĠ Ġprivate Ġlateinit Ġvar Ġstatement Printer : ĠStatement Printer ĊĊĠĠĠ Ġprivate Ġlateinit Ġvar Ġaccount : ĠAccount ĊĊĠĠĠ Ġ@ Before ĊĠĠĠ Ġfun Ġinitialize () Ġ{ ĊĠĠĠĠĠĠĠ Ġaccount Ġ= ĠAccount ( transaction Repository , Ġstatement Printer ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġstore _ a _ deposit _ transaction () Ġ{ ĊĠĠĠĠĠĠĠ Ġaccount . deposit ( 1 0 0 ) ĊĊĠĠĠĠĠĠĠ Ġverify ( transaction Repository ). add Deposit ( 1 0 0 ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġstore _ a _ withdraw _ transaction () Ġ{ ĊĠĠĠĠĠĠĠ Ġaccount . withdraw ( 1 0 0 ) ĊĊĠĠĠĠĠĠĠ Ġverify ( transaction Repository ). add Withdraw ( 1 0 0 ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġprint _ a _ statement () Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġtransactions : ĠList < Transaction > Ġ= ĠlistOf ( Transaction (" 1 2 / 0 5 / 2 0 1 5 ", Ġ 1 0 0 )) ĊĠĠĠĠĠĠĠ Ġgiven ( transaction Repository . all Transactions ()). willReturn ( transactions ) ĊĊĠĠĠĠĠĠĠ Ġaccount . print Statement () ĊĊĠĠĠĠĠĠĠ Ġverify ( statement Printer ). print ( transactions ) ĊĠĠĠ Ġ} Ċ }