package Ġcom . team click er . auth service . services Ċ Ċ import Ġcom . team click er . auth service . kafka . Kafka Topic Ċ import Ġcom . team click er . auth service . kafka . dto . Password Reset Email K DTO Ċ import Ġcom . team click er . auth service . test Config . kafka . Kafka Mock Consumer Ċ import Ġmu . K Logging Ċ import Ġorg . junit . jupiter . api . Assertions . assertEquals Ċ import Ġorg . junit . jupiter . api . BeforeEach Ċ import Ġorg . junit . jupiter . api . Nested Ċ import Ġorg . junit . jupiter . api . Test Ċ import Ġorg . junit . jupiter . api . Test Instance Ċ import Ġorg . junit . jupiter . api . extension . Extend With Ċ import Ġorg . springframework . beans . factory . annotation . Autowired Ċ import Ġorg . springframework . boot . test . context . SpringBootTest Ċ import Ġorg . springframework . test . context . junit . jupiter . Spring Extension Ċ import Ġjava . util . concurrent . TimeUnit ĊĊ Ċ @ Extend With ( Spring Extension :: class ) Ċ @ SpringBootTest ( web Environment Ġ= ĠSpring Boot Test . Web Environment . RANDOM _ PORT ) Ċ @ Test Instance ( Test Instance . Lifecycle . PER _ CLASS ) Ċ class ĠEmail ServiceImpl Test Ġ{ ĊĊĠĠĠ Ġ@ Autowired ĊĠĠĠ Ġlateinit Ġvar Ġemail ServiceImpl : ĠEmail ServiceImpl ĊĊĠĠĠ Ġ@ Autowired ĊĠĠĠ Ġlateinit Ġvar Ġkafka Mock Consumer : ĠKafka Mock Consumer ĊĊĠĠĠ Ġ@ BeforeEach ĊĠĠĠ Ġfun ĠsetUp Each () Ġ{ ĊĠĠĠĠĠĠĠ Ġkafka Mock Consumer . clear Records () ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Nested ĊĠĠĠ Ġinner Ġclass ĠSend Password Reset Email Ġ{ ĊĠĠĠĠĠĠĠ Ġ@ Test ĊĠĠĠĠĠĠĠ Ġfun Ġ` should Ġsend ĠKafka Ġmessage `() Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġemail ServiceImpl . send Password Reset Email (" admin @ admin . com ", Ġ" qw erty 1 2 3 ") ĊĊĠĠĠĠĠĠĠĠĠĠĠ Ġval Ġreceived Ġ= Ġkafka Mock Consumer . records . poll ( 1 0 , ĠTimeUnit . SECONDS ) ĊĊĠĠĠĠĠĠĠĠĠĠĠ ĠassertEquals ( Kafka Topic . PASSWORD _ RESET _ EMAIL . value , Ġreceived . topic ()) ĊĠĠĠĠĠĠĠĠĠĠĠ ĠassertEquals ( ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ ĠPassword Reset Email K DTO (" admin @ admin . com ", Ġ" qw erty 1 2 3 "), ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġreceived . value () ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ) ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġcompanion Ġobject Ġ: ĠK Logging () Ċ }