package Ġorg . kot link Ċ Ċ import Ġcom . n ha ar man . mock it ok otlin 2 . any Ċ import Ġcom . n ha ar man . mock it ok otlin 2 . never Ċ import Ġcom . n ha ar man . mock it ok otlin 2 . verify Ċ import Ġcom . n ha ar man . mock it ok otlin 2 . wh enever Ċ import Ġorg . junit . jupiter . api . Test Ċ import Ġorg . junit . jupiter . api . extension . Extend With Ċ import Ġorg . kot link . core . account . User Account Service Ċ import Ġorg . kot link . core . namespace . Namespace Repo Ċ import Ġorg . mockito . Mock Ċ import Ġorg . mockito . junit . jupiter . Mockito Extension Ċ import Ġorg . springframework . context . event . Context Ref reshed Event Ċ Ċ @ Extend With ( Mockito Extension :: class ) Ċ class ĠDefault Namespace Appro pri ator Test ( ĊĠĠĠ Ġ@ Mock Ġprivate Ġval Ġnamespace Repo : ĠNamespace Repo , ĊĠĠĠ Ġ@ Mock Ġprivate Ġval Ġuser Account Service : ĠUser Account Service , ĊĠĠĠ Ġ@ Mock Ġprivate Ġval Ġevent : ĠContext Ref reshed Event Ċ ) Ġ{ ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġ`' on Application Event ' Ġshould Ġchange Ġowner Ġof Ġthe Ġdefault Ġnamespace Ġif Ġit 's Ġnot Ġcurrent Ġadmin `() Ġ{ ĊĠĠĠĠĠĠĠ Ġwhenever ( namespace Repo . findBy Keyword ("")) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. thenReturn ( DEFAULT _ NAMESPACE ) ĊĠĠĠĠĠĠĠ Ġwhenever ( user Account Service . find OrCreate Account For Email (" admin 1 2 3 4 5 @ kot link . com ")) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. thenReturn ( TEST _ ACCOUNT . copy ( email Ġ= Ġ" admin 1 2 3 4 5 @ kot link . com ")) ĊĊĠĠĠĠĠĠĠ Ġappro pri ator With Admin Email (" admin 1 2 3 4 5 @ kot link . com "). on Application Event ( event ) ĊĊĠĠĠĠĠĠĠ Ġverify ( namespace Repo ). update ( any ()) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġ`' on Application Event ' Ġshould Ġnot Ġchange Ġowner Ġof Ġthe Ġdefault Ġnamespace Ġif Ġit 's Ġcurrent Ġadmin `() Ġ{ ĊĠĠĠĠĠĠĠ Ġwhenever ( namespace Repo . findBy Keyword ("")) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. thenReturn ( DEFAULT _ NAMESPACE ) ĊĊĠĠĠĠĠĠĠ Ġappro pri ator With Admin Email ( DEFAULT _ NAMESPACE . owner Account . email ). on Application Event ( event ) ĊĊĠĠĠĠĠĠĠ Ġverify ( namespace Repo , Ġnever ()). update ( any ()) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġprivate Ġfun Ġappro pri ator With Admin Email ( admin Email : ĠString ) Ġ= ĊĠĠĠĠĠĠĠ ĠDefault Namespace Appro pri ator ( admin Email , Ġnamespace Repo , Ġuser Account Service ) Ċ }