package Ġcom . fs ck . k 9 m _ m . aut od is covery . providers xml Ċ Ċ import Ġcom . fs ck . k 9 m _ m . Ro bo lectric Test Ċ import Ġcom . fs ck . k 9 m _ m . backend . Backend Manager Ċ import Ġcom . fs ck . k 9 m _ m . backend . imap . I map Store Uri Decoder Ċ import Ġcom . fs ck . k 9 m _ m . mail . Auth Type Ċ import Ġcom . fs ck . k 9 m _ m . mail . Connection Security Ċ import Ġcom . fs ck . k 9 m _ m . mail . transport . smtp . Sm tp Transport Uri Decoder Ċ import Ġcom . google . common . truth . Truth . assertThat Ċ import Ġcom . n ha ar man . mockito _ kotlin . do Answer Ċ import Ġcom . n ha ar man . mockito _ kotlin . mock Ċ import Ġorg . junit . Test Ċ import Ġorg . mockito . Argument Matchers . any String Ċ import Ġorg . ro bo lectric . Runtime Environment ĊĊ Ċ class ĠPro viders Xml Discovery Test Ġ: ĠRo bo lectric Test () Ġ{ ĊĠĠĠ Ġval Ġbackend Manager Ġ= Ġmock < Backend Manager > Ġ{ ĊĠĠĠĠĠĠĠ Ġon Ġ{ Ġdecode Store Uri ( any String ()) Ġ} Ġdo Answer Ġ{ Ġmock Ġ-> ĠI map Store Uri Decoder . decode ( mock . get Argument ( 0 )) Ġ} ĊĠĠĠĠĠĠĠ Ġon Ġ{ Ġdecode Transport Uri ( any String ()) Ġ} Ġdo Answer Ġ{ Ġmock Ġ-> ĊĠĠĠĠĠĠĠĠĠĠĠ ĠSm tp Transport Uri Decoder . decode Sm tp Uri ( mock . get Argument ( 0 )) ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠ Ġ} ĊĠĠĠ Ġval Ġxml Provider Ġ= ĠPro viders Xml Provider ( Runtime Environment . application ) ĊĠĠĠ Ġval Ġproviders Xml Discovery Ġ= ĠPro viders Xml Discovery ( backend Manager , Ġxml Provider ) ĊĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġdiscover _ with G mail Domain _ should Return Correct Settings () Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġconnection Settings Ġ= Ġproviders Xml Discovery . discover (" user @ gmail . com ") ĊĊĠĠĠĠĠĠĠ ĠassertThat ( connection Settings ). isNotNull () ĊĠĠĠĠĠĠĠ Ġwith ( connection Settings !!. incoming ) Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ ĠassertThat ( host ). isEqualTo (" imap . gmail . com ") ĊĠĠĠĠĠĠĠĠĠĠĠ ĠassertThat ( connection Security ). isEqualTo ( Connection Security . SSL _ TLS _ REQUIRED ) ĊĠĠĠĠĠĠĠĠĠĠĠ ĠassertThat ( authentication Type ). isEqualTo ( Auth Type . PLAIN ) ĊĠĠĠĠĠĠĠĠĠĠĠ ĠassertThat ( username ). isEqualTo (" user @ gmail . com ") ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠĠĠĠĠ Ġwith ( connection Settings . outgoing ) Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ ĠassertThat ( host ). isEqualTo (" smtp . gmail . com ") ĊĠĠĠĠĠĠĠĠĠĠĠ ĠassertThat ( connection Security ). isEqualTo ( Connection Security . SSL _ TLS _ REQUIRED ) ĊĠĠĠĠĠĠĠĠĠĠĠ ĠassertThat ( authentication Type ). isEqualTo ( Auth Type . PLAIN ) ĊĠĠĠĠĠĠĠĠĠĠĠ ĠassertThat ( username ). isEqualTo (" user @ gmail . com ") ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġdiscover _ with Unknown Domain _ should Return Null () Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġconnection Settings Ġ= Ġproviders Xml Discovery . discover (" user @ not . present . in . providers . xml . example ") ĊĊĠĠĠĠĠĠĠ ĠassertThat ( connection Settings ). isNull () ĊĠĠĠ Ġ} Ċ } Ċ