package Ġcom . alex . map notes . login Ċ Ċ import Ġandroid . support . test . espress o . Esp ress o . on View Ċ import Ġandroid . support . test . espress o . action . View Actions . click Ċ import Ġandroid . support . test . espress o . action . View Actions . replace Text Ċ import Ġandroid . support . test . espress o . assertion . View Assertions . matches Ċ import Ġandroid . support . test . espress o . intent . Intent s Ċ import Ġandroid . support . test . espress o . intent . matcher . Intent Matchers . has Component Ċ import Ġandroid . support . test . espress o . matcher . View Matchers . with Id Ċ import Ġandroid . support . test . espress o . matcher . View Matchers . with Text Ċ import Ġandroid . support . test . espress o . matcher . View Matchers . is Displayed Ċ import Ġandroid . support . test . rule . Activity Test Rule Ċ import Ġandroid . support . test . rule . Grant Permission Rule Ċ import Ġandroid . support . test . runner . Android JUnit 4 Ċ import Ġcom . alex . map notes . Mock Map Notes App Ċ import Ġcom . alex . map notes . R Ċ import Ġcom . alex . map notes . data . Result Ċ import Ġcom . alex . map notes . home . Home Activity Ċ import Ġcom . alex . map notes . login . signup . SignUp Activity Ċ import Ġcom . alex . map notes . model . Auth User Ċ import Ġio . mock k . co Every Ċ import Ġorg . junit . Rule Ċ import Ġorg . junit . Test Ċ import Ġorg . junit . runner . RunWith Ċ Ċ @ RunWith ( Android JUnit 4 :: class ) Ċ class ĠSign Up Activity Test Ġ{ ĊĠĠĠ Ġprivate Ġval Ġusername Ġ= Ġ" test UserName " ĊĠĠĠ Ġprivate Ġval Ġincorrect Email Ġ= Ġ" test " ĊĠĠĠ Ġprivate Ġval Ġcorrect Email Ġ= Ġ" test @ test . com " ĊĠĠĠ Ġprivate Ġval Ġpassword Ġ= Ġ" password " ĊĊĠĠĠ Ġ@ Rule Ġ@ Jvm Field ĊĠĠĠ Ġval Ġpermission Rule : ĠGrant Permission Rule Ġ= ĠGrant Permission Rule . grant ( android . Manifest . permission . ACCESS _ F INE _ LOCATION ) ĊĊĠĠĠ Ġ@ Rule Ġ@ Jvm Field ĊĠĠĠ Ġval Ġactivity Rule Ġ= ĠActivity Test Rule < SignUp Activity >( SignUp Activity :: class . java ) ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġshould Display Email Error When Email IsEmpty () Ġ{ ĊĠĠĠĠĠĠĠ Ġon View ( with Id ( R . id . sign Up )) ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ. perform ( click ()) ĊĊĠĠĠĠĠĠĠ Ġon View ( with Text ( R . string . error _ email _ should _ be _ valid )) ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ. check ( matches ( is Displayed ())) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġshould Display Email Error When Email IsNot Correct () Ġ{ ĊĠĠĠĠĠĠĠ Ġon View ( with Id ( R . id . email )) ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ. perform ( replace Text ( incorrect Email )) ĊĊĠĠĠĠĠĠĠ Ġon View ( with Id ( R . id . sign Up )) ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ. perform ( click ()) ĊĊĠĠĠĠĠĠĠ Ġon View ( with Text ( R . string . error _ email _ should _ be _ valid )) ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ. check ( matches ( is Displayed ())) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġshould Display Password Error When Password IsEmpty () Ġ{ ĊĠĠĠĠĠĠĠ Ġon View ( with Id ( R . id . email )) ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ. perform ( replace Text ( correct Email )) ĊĊĠĠĠĠĠĠĠ Ġon View ( with Id ( R . id . sign Up )) ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ. perform ( click ()) ĊĊĠĠĠĠĠĠĠ Ġon View ( with Text ( R . string . error _ password _ should _ not _ be _ empty )) ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ. check ( matches ( is Displayed ())) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġshould DisplayName Error When Name IsEmpty () Ġ{ ĊĠĠĠĠĠĠĠ Ġon View ( with Id ( R . id . email )) ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ. perform ( replace Text ( correct Email )) ĊĊĠĠĠĠĠĠĠ Ġon View ( with Id ( R . id . password )) ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ. perform ( replace Text ( password )) ĊĊĠĠĠĠĠĠĠ Ġon View ( with Id ( R . id . sign Up )) ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ. perform ( click ()) ĊĊĠĠĠĠĠĠĠ Ġon View ( with Text ( R . string . error _ name _ should _ not _ be _ empty )) ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ. check ( matches ( is Displayed ())) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġshould Display SignUp Error After SignUp Error () Ġ{ ĊĠĠĠĠĠĠĠ Ġco Every Ġ{ ĠMock Map Notes App . mocked UserRepository . sign Up ( any (), Ġany ()) Ġ} Ġreturns ĠResult . Error ( Exception (" SignUp Ġerror ")) ĊĊĠĠĠĠĠĠĠ Ġon View ( with Id ( R . id . name )) ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ. perform ( replace Text ( username )) ĊĊĠĠĠĠĠĠĠ Ġon View ( with Id ( R . id . email )) ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ. perform ( replace Text ( correct Email )) ĊĊĠĠĠĠĠĠĠ Ġon View ( with Id ( R . id . password )) ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ. perform ( replace Text ( password )) ĊĊĠĠĠĠĠĠĠ Ġon View ( with Id ( R . id . sign Up )) ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ. perform ( click ()) ĊĊĠĠĠĠĠĠĠ Ġon View ( with Text (" SignUp Ġerror ")) ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ. check ( matches ( is Displayed ())) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġshould Open Map Screen After Successful SignUp () Ġ{ ĊĠĠĠĠĠĠĠ ĠInt ents . init () ĊĠĠĠĠĠĠĠ Ġval Ġauth User Ġ= ĠAuth User (" 1 1 1 1 1 1 ") ĊĠĠĠĠĠĠĠ Ġco Every Ġ{ ĠMock Map Notes App . mocked UserRepository . change UserName ( auth User , Ġusername ) Ġ} Ġanswers Ġ{ Ġnothing Ġ} ĊĠĠĠĠĠĠĠ Ġco Every Ġ{ ĠMock Map Notes App . mocked UserRepository . sign Up ( correct Email , Ġpassword ) Ġ} Ġreturns ĠResult . Success ( auth User ) ĊĊĠĠĠĠĠĠĠ Ġon View ( with Id ( R . id . name )) ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ. perform ( replace Text ( username )) ĊĊĠĠĠĠĠĠĠ Ġon View ( with Id ( R . id . email )) ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ. perform ( replace Text ( correct Email )) ĊĊĠĠĠĠĠĠĠ Ġon View ( with Id ( R . id . password )) ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ. perform ( replace Text ( password )) ĊĊĠĠĠĠĠĠĠ Ġon View ( with Id ( R . id . sign Up )) ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ. perform ( click ()) ĊĊĠĠĠĠĠĠĠ ĠInt ents . int ended ( has Component ( Home Activity :: class . java . name )) ĊĊĠĠĠĠĠĠĠ ĠInt ents . release () ĊĠĠĠ Ġ} Ċ }