package Ġcom . fg dc . po kes pe ares dk . data . repository Ċ Ċ import Ġcom . fg dc . po kes pe ares dk . data . map pers . to Sh akes pare Translation Ċ import Ġcom . fg dc . po kes pe ares dk . data . source . fun translations . Fun translations Remote Source Ċ import Ġcom . fg dc . po kes pe ares dk . domain . model . Sh akes pe are an Translation Ċ import Ġcom . fg dc . po kes pe ares dk . utils . functional . State Ċ import Ġcom . fg dc . po kes pe ares dk . utils . mock Fun translations Text Ċ import Ġio . kot est . matchers . shouldBe Ċ import Ġio . kot est . matchers . types . shouldBe InstanceOf Ċ import Ġio . mock k . Mock K Annotations Ċ import Ġio . mock k . co Every Ċ import Ġio . mock k . impl . annotations . Mock K Ċ import Ġkotlinx . coroutines . run Blocking Ċ import Ġorg . junit . Before Ċ import Ġorg . junit . Test Ċ Ċ class ĠFun translations Repository Test Ġ{ ĊĊĠĠĠ Ġ@ Mock K ĊĠĠĠ Ġlateinit Ġvar Ġfun translations Remote Source : ĠFun translations Remote Source ĊĊĠĠĠ Ġprivate Ġlateinit Ġvar Ġrepository : ĠFun translations Repository Impl ĊĊĠĠĠ Ġ@ Before ĊĠĠĠ Ġfun ĠsetUp () Ġ{ ĊĠĠĠĠĠĠĠ ĠMock K Annotations . init ( this , Ġrelax Unit Fun Ġ= Ġtrue ) ĊĠĠĠĠĠĠĠ Ġrepository Ġ= ĊĠĠĠĠĠĠĠĠĠĠĠ ĠFun translations Repository Impl ( fun translations Remote Source ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġ` should Ġget Ġtext Ġtranslated Ġfrom Ġservice Ġon Ġsuccess ` (): ĠUnit Ġ= Ġrun Blocking Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġtext Translated Ġ= Ġmock Fun translations Text () ĊĠĠĠĠĠĠĠ Ġval Ġmock Response Ġ= ĊĠĠĠĠĠĠĠĠĠĠĠ ĠState . Success ( text Translated . to Sh akes pare Translation ()) ĊĠĠĠĠĠĠĠ Ġval Ġinitial Text Ġ= ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ" You Ġgave ĠMr . ĠTim Ġa Ġheart y Ġme al , Ġbut Ġunfortunately Ġwhat Ġhe Ġ ate Ġmade Ġhim Ġdie " ĊĊĠĠĠĠĠĠĠ Ġco Every Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġfun translations Remote Source . getText Translated ( initial Text ) ĊĠĠĠĠĠĠĠ Ġ} Ġreturns Ġmock Response ĊĊĠĠĠĠĠĠĠ Ġfun translations Remote Source . getText Translated ( initial Text ) ĠshouldBe Ġmock Response ĊĊĠĠĠĠĠĠĠ Ġval Ġresult : ĠState < Sh akes pe are an Translation > Ġ= Ġrepository . getText Translated ( initial Text ) ĊĠĠĠĠĠĠĠ Ġresult . shouldBe InstanceOf < State . Success < Any >>() ĊĠĠĠĠĠĠĠ Ġwhen Ġ( result ) Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġis ĠState . Success < Sh akes pe are an Translation > Ġ-> Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġresult . data ĠshouldBe Ġtext Translated . to Sh akes pare Translation () ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ} ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠ Ġ} Ċ } Ċ