package Ġde . br ing me ister . spring . aws . k inesis Ċ Ċ import Ġorg . assertj . core . api . Assertions . assertThat Ċ import Ġorg . junit . Test Ċ import Ġorg . junit . runner . RunWith Ċ import Ġorg . springframework . aop . support . A op Utils . is A op Proxy Ċ import Ġorg . springframework . beans . factory . annotation . Autowired Ċ import Ġorg . springframework . boot . test . context . SpringBootTest Ċ import Ġorg . springframework . context . annotation . Scope Ċ import Ġorg . springframework . context . annotation . Scoped Proxy Mode Ċ import Ġorg . springframework . stereotype . Service Ċ import Ġorg . springframework . test . context . Context Configuration Ċ import Ġorg . springframework . test . context . junit 4 . Spring Runner Ċ Ċ @ SpringBootTest Ċ @ RunWith ( Spring Runner :: class ) Ċ @ Context Configuration ( classes Ġ= Ġ[ A op Proxy UtilsTest . Test Service :: class ]) Ċ class ĠA op Proxy UtilsTest Ġ{ ĊĊĠĠĠ Ġ@ Autowired ĊĠĠĠ Ġlateinit Ġvar Ġtest Service : ĠTest Service ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġ` should Ġreturn Ġprox ied Ġobject `() Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġun wrapped Ġ= ĠA op Proxy Utils (). unwrap ( test Service ) ĊĊĠĠĠĠĠĠĠ ĠassertThat ( is A op Proxy ( test Service )). isTrue () ĊĠĠĠĠĠĠĠ ĠassertThat ( is A op Proxy ( un wrapped )). isFalse () ĊĠĠĠĠĠĠĠ ĠassertThat ( test Service ). isNot EqualTo ( un wrapped ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġ` should Ġreturn Ġoriginal Ġobject Ġif Ġit 's Ġnot Ġprox ied `() Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġstring Ġ= Ġ" I 'm Ġnot Ġa Ġproxy " ĊĠĠĠĠĠĠĠ Ġval Ġun wrapped Ġ= ĠA op Proxy Utils (). unwrap ( string ) ĊĊĠĠĠĠĠĠĠ ĠassertThat ( is A op Proxy ( string )). isFalse () ĊĠĠĠĠĠĠĠ ĠassertThat ( is A op Proxy ( un wrapped )). isFalse () ĊĠĠĠĠĠĠĠ ĠassertThat ( string ). isEqualTo ( un wrapped ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ// ĠThis Ġclass Ġwill Ġbe Ġwrapped Ġin Ġa Ġproxy Ġby ĠSpring . ĊĠĠĠ Ġ@ Service ĊĠĠĠ Ġ@ Scope (" singleton ", Ġproxy Mode Ġ= ĠScoped Proxy Mode . TARGET _ CLASS ) ĊĠĠĠ Ġclass ĠTest Service Ċ } Ċ