package Ġcom . qual ar oo Ċ Ċ import Ġandroidx . test . espress o . Esp ress o . on View Ċ import Ġandroidx . test . espress o . action . View Actions . click Ċ import Ġandroidx . test . espress o . assertion . View Assertions . matches Ċ import Ġandroidx . test . espress o . matcher . View Matchers .* Ċ import Ġandroidx . test . filters . Medium Test Ċ import Ġandroidx . test . ext . junit . runners . Android JUnit 4 Ċ import Ġcom . qual ar oo . internal . model . Question Ċ import Ġcom . qual ar oo . internal . model . Question Type Ċ import Ġcom . qual ar oo . internal . model . Survey Ċ import Ġcom . qual ar oo . internal . model . Test Models Ċ import Ġcom . qual ar oo . internal . model . Test Models . answer Ċ import Ġcom . qual ar oo . internal . model . Test Models . language Ċ import Ġcom . qual ar oo . internal . model . Test Models . node Ċ import Ġcom . qual ar oo . internal . model . Test Models . spec Ċ import Ġcom . qual ar oo . util . Qual ar oo Activity Test Rule Ċ import Ġcom . qual ar oo . util . Survey TestUtil Ċ import Ġorg . hamcrest . Core Matchers . not Ċ import Ġorg . junit . Test Ċ import Ġorg . junit . runner . RunWith Ċ Ċ @ Suppress (" Member Visibility Can Be Private ") Ċ @ Medium Test Ċ @ RunWith ( Android JUnit 4 :: class ) Ċ class ĠRadio Question Test Ġ{ ĊĊĠĠĠ Ġval Ġradio Question Ġ= ĠTest Models . question ( ĊĠĠĠĠĠĠĠĠĠĠĠ Ġid Ġ= Ġ 1 , ĊĠĠĠĠĠĠĠĠĠĠĠ Ġtype Ġ= ĠQuestion Type . RADIO , ĊĠĠĠĠĠĠĠĠĠĠĠ Ġsend Text Ġ= Ġ" go !", ĊĠĠĠĠĠĠĠĠĠĠĠ Ġanswer List Ġ= ĠlistOf ( ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġanswer ( 1 , Ġ" first "), ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġanswer ( 2 , Ġ" second "), ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġanswer ( 3 , Ġ" third "), ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġanswer ( 4 , Ġ" four th ") ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ) ĊĠĠĠ Ġ) ĊĊĠĠĠ Ġval Ġradio Question Without Confirm Button Ġ= ĠTest Models . question ( ĊĠĠĠĠĠĠĠĠĠĠĠ Ġid Ġ= Ġ 1 , ĊĠĠĠĠĠĠĠĠĠĠĠ Ġtype Ġ= ĠQuestion Type . RADIO , ĊĠĠĠĠĠĠĠĠĠĠĠ Ġsend Text Ġ= Ġ" go !", ĊĠĠĠĠĠĠĠĠĠĠĠ Ġis Required Ġ= Ġtrue , ĊĠĠĠĠĠĠĠĠĠĠĠ Ġanswer List Ġ= ĠlistOf ( ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġanswer ( 1 , Ġ" first "), ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġanswer ( 2 , Ġ" second "), ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġanswer ( 3 , Ġ" third "), ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġanswer ( 4 , Ġ" four th ") ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ), ĊĠĠĠĠĠĠĠĠĠĠĠ Ġalways Show Send Ġ= Ġfalse ĊĠĠĠ Ġ) ĊĊĠĠĠ Ġfun Ġsurvey ( question : ĠQuestion ): ĠSurvey Ġ{ ĊĠĠĠĠĠĠĠ Ġreturn ĠTest Models . survey ( ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġid Ġ= Ġ 1 , ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġspec Ġ= Ġspec ( ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġquestion List Ġ= Ġmap Of ( ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġlanguage (" en ") Ġto ĠlistOf ( ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġquestion ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ) ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ), ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġstart Map Ġ= Ġmap Of ( ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġlanguage (" en ") Ġto Ġnode ( ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġid Ġ= Ġ 1 , ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġnode Type Ġ= Ġ" question " ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ) ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ) ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ) ĊĠĠĠĠĠĠĠ Ġ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġfun Ġrule ( question : ĠQuestion ): ĠQual ar oo Activity Test Rule Ġ{ ĊĠĠĠĠĠĠĠ Ġreturn ĠQual ar oo Activity Test Rule ( survey ( question )) ĊĠĠĠ Ġ} ĊĠĠĠĠĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġrenders With Button () Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġrule Ġ= Ġrule ( radio Question ) ĊĠĠĠĠĠĠĠ Ġrule . launch Activity ( rule . activity Intent ) ĊĊĠĠĠĠĠĠĠ Ġon View ( with Id ( R . id . qual ar oo __ question _ radio _ options )). check ( matches ( has Desc endant ( with Text (" first ")) )) ĊĠĠĠĠĠĠĠ Ġon View ( with Id ( R . id . qual ar oo __ question _ radio _ options )). check ( matches ( has Desc endant ( with Text (" second ")) )) ĊĠĠĠĠĠĠĠ Ġon View ( with Id ( R . id . qual ar oo __ question _ radio _ options )). check ( matches ( has Desc endant ( with Text (" third ")) )) ĊĠĠĠĠĠĠĠ Ġon View ( with Id ( R . id . qual ar oo __ question _ radio _ options )). check ( matches ( has Desc endant ( with Text (" four th ")) )) ĊĊĠĠĠĠĠĠĠ Ġon View ( with Id ( R . id . qual ar oo __ question _ radio _ confirm )). check ( matches ( with Text (" go ! "))) ĊĠĠĠĠĠĠĠ Ġon View ( with Id ( R . id . qual ar oo __ question _ radio _ confirm )). check ( matches ( is Displayed ())) ĊĊĠĠĠĠĠĠĠ Ġrule . finish Activity () ĊĠĠĠ Ġ} ĊĠĠĠĠĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġrenders Without Button () Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġrule Ġ= Ġrule ( radio Question Without Confirm Button ) ĊĠĠĠĠĠĠĠ Ġrule . launch Activity ( rule . activity Intent ) ĊĊĠĠĠĠĠĠĠ Ġon View ( with Id ( R . id . qual ar oo __ question _ radio _ options )). check ( matches ( has Desc endant ( with Text (" first ")) )) ĊĠĠĠĠĠĠĠ Ġon View ( with Id ( R . id . qual ar oo __ question _ radio _ options )). check ( matches ( has Desc endant ( with Text (" second ")) )) ĊĠĠĠĠĠĠĠ Ġon View ( with Id ( R . id . qual ar oo __ question _ radio _ options )). check ( matches ( has Desc endant ( with Text (" third ")) )) ĊĠĠĠĠĠĠĠ Ġon View ( with Id ( R . id . qual ar oo __ question _ radio _ options )). check ( matches ( has Desc endant ( with Text (" four th ")) )) ĊĊĠĠĠĠĠĠĠ Ġon View ( with Id ( R . id . qual ar oo __ question _ radio _ confirm )). check ( matches ( not ( is Displayed ()))) ĊĠĠĠĠĠĠĠĠĊĠĠĠĠĠĠĠ Ġrule . finish Activity () ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġcloses After Confirm () Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġrule Ġ= Ġrule ( radio Question ) ĊĠĠĠĠĠĠĠ Ġrule . launch Activity ( rule . activity Intent ) ĊĊĠĠĠĠĠĠĠ Ġon View ( with Text (" first ")). perform ( click ()) ĊĠĠĠĠĠĠĠ Ġon View ( with Id ( R . id . qual ar oo __ question _ radio _ confirm )). perform ( click ()) ĊĊĠĠĠĠĠĠĠ ĠSurvey TestUtil . assert Activity Finish ing ( rule ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġcloses When Select ing Option And Button Not Available () Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġrule Ġ= Ġrule ( radio Question Without Confirm Button ) ĊĊĠĠĠĠĠĠĠ Ġrule . launch Activity ( rule . activity Intent ) ĊĊĠĠĠĠĠĠĠ Ġon View ( with Text (" first ")). perform ( click ()) ĊĠĠĠĠĠĠĠ ĠThread . sleep ( 3 0 0 ) ĊĠĠĠĠĠĠĠ ĠSurvey TestUtil . assert Activity Finish ing ( rule ) ĊĠĠĠ Ġ} Ċ Ċ } Ċ