package Ġcom . episode 6 . mock sp ress o 2 . reflect Ċ Ċ import Ġassert k . assertThat Ċ import Ġassert k . assertions . is Data Class EqualTo Ċ import Ġorg . junit . jupiter . api . Test Ċ import Ġjava . lang . reflect . Method Ċ Ċ // Ġtests Ġwhether Ġwe Ġcan Ġsuccessfully Ġresolve Ġgener ics Ġfrom Ġjava Ġinto Ġ[ Type Token ] s Ġwith ĠK Types Ċ @ Suppress (" unused ") Ġ// Ġwe 're Ġtesting Ġreflection Ġhere Ċ class ĠJ vm Type Token Ext Test Ġ{ ĊĊĠ Ġ@ Test Ġfun Ġtest First Level () Ġ{ ĊĠĠĠ Ġval Ġtoken Ġ= Ġtype Token < IF ace < String , ĠInt >>() ĊĠĠĠ Ġval Ġgive A Ġ= Ġtoken . as K Class (). java . getMethod (" give A ") ĊĠĠĠ Ġval Ġgive B Ġ= Ġtoken . as K Class (). java . getMethod (" give B ") ĊĠĠĠ Ġval Ġgive List A Ġ= Ġtoken . as K Class (). java . getMethod (" give List A ") ĊĊĠĠĠ Ġval Ġgive A Token Ġ= Ġtoken . resolve ReturnType From Method ( give A ) ĊĠĠĠ Ġval Ġgive B Token Ġ= Ġtoken . resolve ReturnType From Method ( give B ) ĊĠĠĠ Ġval Ġgive List A Token Ġ= Ġtoken . resolve ReturnType From Method ( give List A ) ĊĊĠĠĠ ĠassertThat ( give A Token ). is Data Class EqualTo ( type Token < String >()) ĊĠĠĠ ĠassertThat ( give B Token ). is Data Class EqualTo ( type Token < Int >()) ĊĠĠĠ ĠassertThat ( give List A Token ). is Data Class EqualTo ( type Token < List < String >> ()) ĊĠ Ġ} ĊĊĠ Ġ@ Test Ġfun Ġtest Second Level () Ġ{ ĊĠĠĠ Ġval Ġtoken Ġ= Ġtype Token < IF ace 2 < String , ĠInt >>() ĊĠĠĠ Ġval Ġgive A Ġ= Ġtoken . as K Class (). java . getMethod (" give A ") ĊĠĠĠ Ġval Ġgive B Ġ= Ġtoken . as K Class (). java . getMethod (" give B ") ĊĠĠĠ Ġval Ġgive List A Ġ= Ġtoken . as K Class (). java . getMethod (" give List A ") ĊĠĠĠ Ġval Ġgive Map XY Ġ= Ġtoken . as K Class (). java . getMethod (" give Map XY ") ĊĊĠĠĠ Ġval Ġgive A Token Ġ= Ġtoken . resolve ReturnType From Method ( give A ) ĊĠĠĠ Ġval Ġgive B Token Ġ= Ġtoken . resolve ReturnType From Method ( give B ) ĊĠĠĠ Ġval Ġgive List A Token Ġ= Ġtoken . resolve ReturnType From Method ( give List A ) ĊĠĠĠ Ġval Ġgive Map XY Token Ġ= Ġtoken . resolve ReturnType From Method ( give Map XY ) ĊĊĠĠĠ ĠassertThat ( give A Token ). is Data Class EqualTo ( type Token < Int >()) ĊĠĠĠ ĠassertThat ( give B Token ). is Data Class EqualTo ( type Token < String >()) ĊĠĠĠ ĠassertThat ( give List A Token ). is Data Class EqualTo ( type Token < List < Int >> ()) ĊĠĠĠ ĠassertThat ( give Map XY Token ). is Data Class EqualTo ( type Token < Map < String , ĠInt >> ()) ĊĠ Ġ} ĊĊĠ Ġ@ Test Ġfun Ġtest Third Level () Ġ{ ĊĠĠĠ Ġval Ġtoken Ġ= Ġtype Token < Concrete Def >() ĊĠĠĠ Ġval Ġgive A Ġ= Ġtoken . as K Class (). java . getMethod (" give A ") ĊĠĠĠ Ġval Ġgive B Ġ= Ġtoken . as K Class (). java . getMethod (" give B ") ĊĠĠĠ Ġval Ġgive List A Ġ= Ġtoken . as K Class (). java . getMethod (" give List A ") ĊĠĠĠ Ġval Ġgive Map XY Ġ= Ġtoken . as K Class (). java . getMethod (" give Map XY ") ĊĊĠĠĠ Ġval Ġgive A Token Ġ= Ġtoken . resolve ReturnType From Method ( give A ) ĊĠĠĠ Ġval Ġgive B Token Ġ= Ġtoken . resolve ReturnType From Method ( give B ) ĊĠĠĠ Ġval Ġgive List A Token Ġ= Ġtoken . resolve ReturnType From Method ( give List A ) ĊĠĠĠ Ġval Ġgive Map XY Token Ġ= Ġtoken . resolve ReturnType From Method ( give Map XY ) ĊĊĠĠĠ ĠassertThat ( give A Token ). is Data Class EqualTo ( type Token < Int >()) ĊĠĠĠ ĠassertThat ( give B Token ). is Data Class EqualTo ( type Token < String >()) ĊĠĠĠ ĠassertThat ( give List A Token ). is Data Class EqualTo ( type Token < List < Int >> ()) ĊĠĠĠ ĠassertThat ( give Map XY Token ). is Data Class EqualTo ( type Token < Map < String , ĠInt >> ()) ĊĠ Ġ} ĊĊĠ Ġ@ Test Ġfun Ġtest First Level Re versed () Ġ{ ĊĠĠĠ Ġval Ġtoken Ġ= Ġtype Token < IF ace Reverse < String >>() ĊĠĠĠ Ġval Ġgive A Ġ= Ġtoken . as K Class (). java . getMethod (" give A ") ĊĠĠĠ Ġval Ġgive B Ġ= Ġtoken . as K Class (). java . getMethod (" give B ") ĊĠĠĠ Ġval Ġgive List A Ġ= Ġtoken . as K Class (). java . getMethod (" give List A ") ĊĊĠĠĠ Ġval Ġgive A Token Ġ= Ġtoken . resolve ReturnType From Method ( give A ) ĊĠĠĠ Ġval Ġgive B Token Ġ= Ġtoken . resolve ReturnType From Method ( give B ) ĊĠĠĠ Ġval Ġgive List A Token Ġ= Ġtoken . resolve ReturnType From Method ( give List A ) ĊĊĠĠĠ ĠassertThat ( give A Token ). is Data Class EqualTo ( type Token < Long >()) ĊĠĠĠ ĠassertThat ( give B Token ). is Data Class EqualTo ( type Token < String >()) ĊĠĠĠ ĠassertThat ( give List A Token ). is Data Class EqualTo ( type Token < List < Long >> ()) ĊĠ Ġ} ĊĊĠ Ġprivate Ġinterface ĠIF ace < A , ĠB > Ġ{ ĊĠĠĠ Ġfun Ġgive A (): ĠA ĊĠĠĠ Ġfun Ġgive B (): ĠB ĊĠĠĠ Ġfun Ġgive List A (): ĠList < A > ĊĠ Ġ} ĊĊĠ Ġprivate Ġinterface ĠIF ace 2 < X , ĠY > Ġ: ĠIF ace < Y , ĠX > Ġ{ ĊĠĠĠ Ġfun Ġgive Map XY (): ĠMap < X , ĠY > ĊĠ Ġ} ĊĊĠ Ġprivate Ġinterface ĠIF ace Reverse < A > Ġ: ĠIF ace < Long , ĠA > ĊĊĠ Ġprivate Ġinterface ĠConcrete Def Ġ: ĠIF ace 2 < String , ĠInt > Ċ } Ċ Ċ private Ġfun ĠType Token <* >. resolve ReturnType From Method ( method : ĠMethod ): ĠType Token < *> Ġ= ĊĠ Ġresolve Jvm Type ( method . generic ReturnType , Ġmethod . decl aring Class ) Ċ