package Ġcom . example Ċ Ċ import Ġio . mic ronaut . test . annotation . Mic ronaut Test Ċ import Ġio . mic ronaut . test . annotation . Mock Bean Ċ import Ġorg . junit . jupiter . api . Assertions . assertEquals Ċ import Ġorg . junit . jupiter . api . Test Ċ import Ġorg . junit . jupiter . api . extension . Extend With Ċ import Ġorg . mockito . Argument Matchers . any String Ċ import Ġorg . mockito . BDD Mockito . given Ċ import Ġorg . mockito . Mock Ċ import Ġorg . mockito . junit . jupiter . Mockito Extension Ċ import Ġjavax . inject . Inject Ċ Ċ @ Mic ronaut Test Ċ @ Extend With ( Mockito Extension :: class ) Ċ internal Ġclass ĠGithub Service Test Ġ{ ĊĊĠĠĠ Ġ@ Inject ĊĠĠĠ Ġlateinit Ġvar Ġgithub Service : ĠGithub Service ĊĊĠĠĠ Ġ@ Mock ĊĠĠĠ Ġlateinit Ġvar Ġgithub Client : ĠGithub Client ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġshould Return Name () Ġ{ ĊĠĠĠĠĠĠĠ Ġgiven ( github Client . get Viewer ( any String (), Ġany String (), Ġany String ())) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. willReturn ( given Viewer Response ()) ĊĊĠĠĠĠĠĠĠ Ġval Ġname Ġ= Ġgithub Service . getName () ĊĊĠĠĠĠĠĠĠ ĠassertEquals (" John ĠDoe ", Ġname ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġprivate Ġfun Ġgiven Viewer Response (): ĠViewer Response Ġ= ĠViewer Response ( Data ( Viewer (" John ĠDoe "))) ĊĊĠĠĠ Ġ@ Mock Bean ( Github Client :: class ) ĊĠĠĠ Ġfun Ġmock Github Client () Ġ= Ġgithub Client Ċ } Ċ