package Ġdv ach movie . storage Ċ Ċ import Ġdv ach movie . Test Exception Ċ import Ġdv ach movie . api . Cookie Ċ import Ġkotlinx . coroutines . run Blocking Ċ import Ġorg . junit . Assert Ċ import Ġorg . junit . Test Ċ import Ġorg . junit . runner . RunWith Ċ import Ġorg . mockito . BDD Mockito . given Ċ import Ġorg . mockito . Inject Mocks Ċ import Ġorg . mockito . Mock Ċ import Ġorg . mockito . junit . Mockito JUnit Runner Ċ Ċ @ RunWith ( Mockito JUnit Runner :: class ) Ċ class ĠLocal Cookie Storage Test Ġ{ ĊĊĠĠĠ Ġ@ Inject Mocks ĊĠĠĠ Ġlateinit Ġvar Ġlocal Cookie Storage : ĠLocal Cookie Storage ĊĊĠĠĠ Ġ@ Mock ĊĠĠĠ Ġlateinit Ġvar Ġsettings Storage : ĠSettings Storage ĊĊĠĠĠ Ġprivate Ġval Ġheader Ġ= Ġ" user code _ auth " ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġ` Happy Ġpass `() Ġ{ ĊĠĠĠĠĠĠĠ Ġrun Blocking Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġval Ġtest Cookie Ġ= ĠCookie ( header , Ġ" test ") ĊĠĠĠĠĠĠĠĠĠĠĠ Ġgiven ( settings Storage . get Cookie ()). willReturn (" test ") ĊĊĠĠĠĠĠĠĠĠĠĠĠ ĠAssert . assertEquals ( test Cookie , Ġlocal Cookie Storage . cookie ) ĊĠĠĠĠĠĠĠĠĠĠĠ ĠAssert . assertEquals ( test Cookie . toString (), Ġlocal Cookie Storage . cookie . toString ()) ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test Ġ( expected Ġ= ĠTest Exception :: class ) ĊĠĠĠ Ġfun Ġ` Something Ġwas Ġwrong `() Ġ{ ĊĠĠĠĠĠĠĠ Ġrun Blocking Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġgiven ( settings Storage . get Cookie ()). will Throw ( Test Exception ()) ĊĊĠĠĠĠĠĠĠĠĠĠĠ Ġlocal Cookie Storage . cookie ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠ Ġ} Ċ } Ċ