package Ġcom . one gin i . mobile . sdk Ċ Ċ import Ġcom . google . gson . Gson Ċ import Ġcom . one gin i . mobile . sdk . android . client . One gin i Client Ċ import Ġcom . one gin i . mobile . sdk . android . client . User Client Ċ import Ġcom . one gin i . mobile . sdk . android . model . One gin i Authenticator Ċ import Ġcom . one gin i . mobile . sdk . android . model . entity . UserProfile Ċ import Ġcom . one gin i . mobile . sdk . flutter . One gin i Wrapper Errors Ċ import Ġcom . one gin i . mobile . sdk . flutter . use Cases . Get Registered Auth entic ators UseCase Ċ import Ġio . flutter . plugin . common . Method Channel Ċ import Ġorg . junit . Before Ċ import Ġorg . junit . Test Ċ import Ġorg . junit . runner . RunWith Ċ import Ġorg . mockito . Mock Ċ import Ġorg . mockito . Spy Ċ import Ġorg . mockito . junit . Mockito JUnit Runner Ċ import Ġorg . mockito . kotlin . eq Ċ import Ġorg . mockito . kotlin . verify Ċ import Ġorg . mockito . kotlin . wh enever Ċ Ċ @ RunWith ( Mockito JUnit Runner :: class ) Ċ class ĠGet Registered Auth entic ators UseCase Tests Ġ{ ĊĊĠĠĠ Ġ@ Mock ĊĠĠĠ Ġlateinit Ġvar Ġclient Mock : ĠOne gin i Client ĊĊĠĠĠ Ġ@ Mock ĊĠĠĠ Ġlateinit Ġvar Ġuser Client Mock : ĠUser Client ĊĊĠĠĠ Ġ@ Mock ĊĠĠĠ Ġlateinit Ġvar Ġone gin i Authenticator First Mock : ĠOne gin i Authenticator ĊĊĠĠĠ Ġ@ Mock ĊĠĠĠ Ġlateinit Ġvar Ġone gin i Authenticator Second Mock : ĠOne gin i Authenticator ĊĊĠĠĠ Ġ@ Spy ĊĠĠĠ Ġlateinit Ġvar Ġresult Spy : ĠMethod Channel . Result ĊĊĠĠĠ Ġ@ Before ĊĠĠĠ Ġfun Ġattach () Ġ{ ĊĠĠĠĠĠĠĠ Ġwhenever ( client Mock . user Client ). thenReturn ( user Client Mock ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġ` should Ġreturn Ġempty Ġlist Ġwhen Ġsdk Ġreturn Ġempty Ġset `() Ġ{ ĊĠĠĠĠĠĠĠ Ġwhenever ( user Client Mock . user Profiles ). thenReturn ( set Of ( UserProfile (" Q WER TY "))) ĊĠĠĠĠĠĠĠ Ġwhenever ( user Client Mock . get Registered Auth entic ators ( eq ( UserProfile (" Q WER TY ")) )). thenReturn ( empty Set ()) ĊĊĠĠĠĠĠĠĠ ĠGet Registered Auth entic ators UseCase ( client Mock )( result Spy ) ĊĊĠĠĠĠĠĠĠ Ġval Ġexpected Result Ġ= ĠGson (). toJson ( empty Array < Map < String , ĠString >> ()) ĊĠĠĠĠĠĠĠ Ġverify ( result Spy ). success ( expected Result ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġ` should Ġreturn Ġerror Ġwhen ĠUser Profile Ġis Ġnull `() Ġ{ ĊĠĠĠĠĠĠĠ Ġwhenever ( user Client Mock . user Profiles ). thenReturn ( empty Set ()) ĊĊĠĠĠĠĠĠĠ ĠGet Registered Auth entic ators UseCase ( client Mock )( result Spy ) ĊĊĠĠĠĠĠĠĠ Ġverify ( result Spy ). error ( One gin i Wrapper Errors . USER _ PROFILE _ IS _ NULL . code , ĠOne gin i Wrapper Errors . USER _ PROFILE _ IS _ NULL . message , Ġnull ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġ` should Ġreturn Ġlist Ġof Ġregistered Ġauthentic ators Ġwhen Ġget Registered Auth entic ators Ġmethod Ġreturns Ġnot Ġempty Ġset `() Ġ{ ĊĠĠĠĠĠĠĠ Ġwhenever ( user Client Mock . user Profiles ). thenReturn ( set Of ( UserProfile (" Q WER TY "))) ĊĠĠĠĠĠĠĠ Ġwhenever ( user Client Mock . get Registered Auth entic ators ( eq ( UserProfile (" Q WER TY ")) )). thenReturn ( set Of ( one gin i Authenticator First Mock , Ġone gin i Authenticator Second Mock )) ĊĠĠĠĠĠĠĠ Ġwhenever ( one gin i Authenticator First Mock . id ). thenReturn (" first Id ") ĊĠĠĠĠĠĠĠ Ġwhenever ( one gin i Authenticator First Mock . name ). thenReturn (" firstName ") ĊĠĠĠĠĠĠĠ Ġwhenever ( one gin i Authenticator Second Mock . id ). thenReturn (" second Id ") ĊĠĠĠĠĠĠĠ Ġwhenever ( one gin i Authenticator Second Mock . name ). thenReturn (" second Name ") ĊĊĠĠĠĠĠĠĠ ĠGet Registered Auth entic ators UseCase ( client Mock )( result Spy ) ĊĊĠĠĠĠĠĠĠ Ġval Ġexpected Array Ġ= ĠarrayOf ( map Of (" id " Ġto Ġ" first Id ", Ġ" name " Ġto Ġ" firstName "), Ġmap Of (" id " Ġto Ġ" second Id ", Ġ" name " Ġto Ġ" second Name ")) ĊĠĠĠĠĠĠĠ Ġval Ġexpected Result Ġ= ĠGson (). toJson ( expected Array ) ĊĠĠĠĠĠĠĠ Ġverify ( result Spy ). success ( expected Result ) ĊĠĠĠ Ġ} Ċ }