package Ġbr . com . web budget . validators Ċ Ċ import Ġbr . com . web budget . TestRunner Ċ import Ġbr . com . web budget . domain . entities . configuration . User Ċ import Ġbr . com . web budget . domain . exceptions . Business Exception Ċ import Ġbr . com . web budget . domain . validators . user . D uplicated Email Validator Ċ import Ġbr . com . web budget . infrastructure . repository . configuration . UserRepository Ċ import Ġorg . junit . jupiter . api . Test Ċ import Ġorg . junit . jupiter . api . assert DoesNot Throw Ċ import Ġorg . junit . jupiter . api . assert Throws Ċ import Ġorg . springframework . beans . factory . annotation . Autowired Ċ Ċ class ĠUser Validators Test Ġ: ĠTest Runner () Ġ{ ĊĊĠĠĠ Ġ@ Autowired ĊĠĠĠ Ġlateinit Ġvar Ġuser Repository : ĠUser Repository ĊĊĠĠĠ Ġ@ Autowired ĊĠĠĠ Ġlateinit Ġvar Ġduplicated Email Validator : ĠD uplicated Email Validator ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġ` should Ġfail Ġwhen Ġduplicated Ġemail `() Ġ{ ĊĊĠĠĠĠĠĠĠ Ġval Ġuser Ġ= ĠUser (" Checking ", Ġ" checking @ test e . com ", Ġ" 1 2 3 ", Ġfalse , ĠlistOf ()) ĊĠĠĠĠĠĠĠ Ġuser Repository . save ( user ) ĊĊĠĠĠĠĠĠĠ Ġval Ġother Ġ= ĠUser (" Checking ", Ġ" checking @ test e . com ", Ġ" 1 2 3 ", Ġfalse , ĠlistOf ()) ĊĠĠĠĠĠĠĠ ĠassertThrows < Business Exception >(" users . error . d uplicated - email ") Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġduplicated Email Validator . validate ( other ) ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġ` should Ġpass Ġwhen Ġsame Ġentity Ġis Ġchecked Ġfor Ġduplicated Ġemail `() Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġsaved Ġ= Ġuser Repository . save ( User (" D uplicated ", Ġ" d uplicated @ test e . com ", Ġ" 1 2 3 ", Ġfalse , ĠlistOf ())) ĊĠĠĠĠĠĠĠ Ġassert DoesNot Throw Ġ{ Ġduplicated Email Validator . validate ( saved ) Ġ} ĊĠĠĠ Ġ} Ċ } Ċ