package Ġorg . opp ia . android . domain . ex ploration Ċ Ċ import Ġandroid . app . Application Ċ import Ġandroid . content . Context Ċ import Ġandroidx . lifecycle . Observer Ċ import Ġandroidx . test . core . app . Application Provider Ċ import Ġandroidx . test . ext . junit . runners . Android JUnit 4 Ċ import Ġcom . google . common . truth . Truth . assertThat Ċ import Ġdagger . Bind s Instance Ċ import Ġdagger . Component Ċ import Ġdagger . Module Ċ import Ġdagger . Provides Ċ import Ġorg . junit . Before Ċ import Ġorg . junit . Rule Ċ import Ġorg . junit . Test Ċ import Ġorg . junit . runner . RunWith Ċ import Ġorg . mockito . Argument Captor Ċ import Ġorg . mockito . Captor Ċ import Ġorg . mockito . Mock Ċ import Ġorg . mockito . Mockito . at Least Ċ import Ġorg . mockito . Mockito . at Least Once Ċ import Ġorg . mockito . Mockito . verify Ċ import Ġorg . mockito . junit . Mockito JUnit Ċ import Ġorg . mockito . junit . Mockito Rule Ċ import Ġorg . opp ia . android . app . model . Answer Outcome Ċ import Ġorg . opp ia . android . app . model . Ep hemeral State Ċ import Ġorg . opp ia . android . app . model . Ep hemeral State . State Type Case . COMPLETED _ STATE Ċ import Ġorg . opp ia . android . app . model . Ep hemeral State . State Type Case . PENDING _ STATE Ċ import Ġorg . opp ia . android . app . model . Ep hemeral State . State Type Case . TERMIN AL _ STATE Ċ import Ġorg . opp ia . android . app . model . Ex ploration Ċ import Ġorg . opp ia . android . app . model . Hint Ċ import Ġorg . opp ia . android . app . model . Interaction Object Ċ import Ġorg . opp ia . android . app . model . Solution Ċ import Ġorg . opp ia . android . app . model . User Answer Ċ import Ġorg . opp ia . android . domain . classify . Interactions Module Ċ import Ġorg . opp ia . android . domain . classify . rules . continue interaction . Continue Module Ċ import Ġorg . opp ia . android . domain . classify . rules . drag And Drop Sort Input . Drag Drop Sort Input Module Ċ import Ġorg . opp ia . android . domain . classify . rules . fraction input . Fraction Input Module Ċ import Ġorg . opp ia . android . domain . classify . rules . image Click Input . Image Click Input Module Ċ import Ġorg . opp ia . android . domain . classify . rules . item selection input . Item Selection Input Module Ċ import Ġorg . opp ia . android . domain . classify . rules . multiple choice input . Multiple Choice Input Module Ċ import Ġorg . opp ia . android . domain . classify . rules . number with units . Number With Units Rule Module Ċ import Ġorg . opp ia . android . domain . classify . rules . numeric input . Numeric Input Rule Module Ċ import Ġorg . opp ia . android . domain . classify . rules . ratio input . Ratio Input Module Ċ import Ġorg . opp ia . android . domain . classify . rules . text input . TextInput Rule Module Ċ import Ġorg . opp ia . android . domain . opp ialog ger . Log Storage Module Ċ import Ġorg . opp ia . android . domain . topic . TEST _ EX PL OR ATION _ ID _ 0 Ċ import Ġorg . opp ia . android . domain . topic . TEST _ EX PL OR ATION _ ID _ 1 Ċ import Ġorg . opp ia . android . domain . util . to Answer String Ċ import Ġorg . opp ia . android . testing . Fake Exception Logger Ċ import Ġorg . opp ia . android . testing . Test Log Reporting Module Ċ import Ġorg . opp ia . android . testing . ro bo lectric . Ro bo lectric Module Ċ import Ġorg . opp ia . android . testing . threading . Test Coroutine Dispatch ers Ċ import Ġorg . opp ia . android . testing . threading . Test Dispatcher Module Ċ import Ġorg . opp ia . android . testing . time . Fake Opp ia Clock Module Ċ import Ġorg . opp ia . android . util . caching . Cache Assets Loc ally Ċ import Ġorg . opp ia . android . util . caching . Load Lesson Protos From Assets Ċ import Ġorg . opp ia . android . util . caching . Topic List To Cache Ċ import Ġorg . opp ia . android . util . data . AsyncResult Ċ import Ġorg . opp ia . android . util . data . Data Providers . Companion . to LiveData Ċ import Ġorg . opp ia . android . util . data . Data Providers Injector Ċ import Ġorg . opp ia . android . util . data . Data Providers Injector Provider Ċ import Ġorg . opp ia . android . util . logging . Enable Console Log Ċ import Ġorg . opp ia . android . util . logging . Enable File Log Ċ import Ġorg . opp ia . android . util . logging . Global LogLevel Ċ import Ġorg . opp ia . android . util . logging . LogLevel Ċ import Ġorg . ro bo lectric . annotation . Config Ċ import Ġorg . ro bo lectric . annotation . Looper Mode Ċ import Ġjava . io . FileNotFoundException Ċ import Ġjavax . inject . Inject Ċ import Ġjavax . inject . Singleton Ċ Ċ // ĠFor Ġcontext : Ċ // Ġhttps :// github . com / opp ia / opp ia / blob / 3 7 2 8 5 a / extensions / inter actions / Continue / directives / opp ia - interactive - continue . directive . ts . Ċ private Ġconst Ġval ĠDEFAULT _ CONTINUE _ INTER ACTION _ TEXT _ AN SW ER Ġ= Ġ" Please Ġcontinue ." Ċ Ċ /** ĠTests Ġfor Ġ[ Ex ploration Progress Controller ]. Ġ*/ Ċ @ RunWith ( Android JUnit 4 :: class ) Ċ @ Looper Mode ( Looper Mode . Mode . PA USED ) Ċ @ Config ( application Ġ= ĠEx ploration Progress Controller Test . Test Application :: class ) Ċ class ĠEx ploration Progress Controller Test Ġ{ ĊĠ Ġ// ĠTODO (# 1 1 4 ): ĠAdd Ġmuch Ġmore Ġthorough Ġtests Ġfor Ġthe Ġintegration Ġpath way . ĊĊĠ Ġ// ĠTODO (# 5 9 ): ĠOnce ĠAsync Data Subscription Manager Ġcan Ġbe Ġreplaced Ġwith Ġa Ġfake , Ġadd Ġthe Ġfollowing Ġtests Ġonce Ġcareful ĊĠ Ġ// Ġ Ġtesting Ġtiming Ġcan Ġbe Ġcontrolled : ĊĠ Ġ// Ġ Ġ- Ġtest MoveTo Next _ while Submit ting Answer _ fails WithError ĊĠ Ġ// Ġ Ġ- Ġtest GetCurrent State _ while Submit ting Correct Multi Choice Answer _ updates To Pending ĊĠ Ġ// Ġ Ġ- Ġtest Submit Answer _ while Submit ting Another Answer _ fails WithError ĊĠ Ġ// Ġ Ġ- Ġtest MoveTo Previous _ while Submit ting Answer _ fails WithError ĊĊĠ Ġ// ĠTODO (# 3 0 0 7 ): ĠMigrate Ġthis Ġover Ġto Ġa Ġnew Ġexploration Ġso Ġthat Ġthe Ġtest Ġcan Ġverify Ġproto Ġloading . ĊĊĠ Ġ@ Rule ĊĠ Ġ@ Jvm Field ĊĠ Ġval Ġmock ito Rule : ĠMockito Rule Ġ= ĠMockito JUnit . rule () ĊĊĠ Ġ@ Inject ĊĠ Ġlateinit Ġvar Ġexploration Data Controller : ĠEx ploration Data Controller ĊĊĠ Ġ@ Inject ĊĠ Ġlateinit Ġvar Ġexploration Progress Controller : ĠEx ploration Progress Controller ĊĊĠ Ġ@ Inject ĊĠ Ġlateinit Ġvar Ġexploration Retriever : ĠEx ploration Retriever ĊĊĠ Ġ@ Inject ĊĠ Ġlateinit Ġvar Ġfake Exception Logger : ĠFake Exception Logger ĊĊĠ Ġ@ Inject ĊĠ Ġlateinit Ġvar Ġtest Coroutine Dispatch ers : ĠTest Coroutine Dispatch ers ĊĊĠ Ġ@ Mock ĊĠ Ġlateinit Ġvar Ġmock Current State LiveData Observer : ĠObserver < AsyncResult < Ep hemeral State >> ĊĊĠ Ġ@ Mock ĊĠ Ġlateinit Ġvar Ġmock Current State LiveData Observer 2 : ĠObserver < AsyncResult < Ep hemeral State >> ĊĊĠ Ġ@ Mock ĊĠ Ġlateinit Ġvar Ġmock AsyncResult LiveData Observer : ĠObserver < AsyncResult < Any ? >> ĊĊĠ Ġ@ Mock ĊĠ Ġlateinit Ġvar Ġmock Async Answer Outcome Observer : ĠObserver < AsyncResult < Answer Outcome >> ĊĊĠ Ġ@ Mock ĊĠ Ġlateinit Ġvar Ġmock Async Hint Observer : ĠObserver < AsyncResult < Hint >> ĊĊĠ Ġ@ Mock ĊĠ Ġlateinit Ġvar Ġmock Async Solution Observer : ĠObserver < AsyncResult < Solution >> ĊĊĠ Ġ@ Captor ĊĠ Ġlateinit Ġvar Ġcurrent State Result Captor : ĠArgument Captor < AsyncResult < Ep hemeral State >> ĊĊĠ Ġ@ Captor ĊĠ Ġlateinit Ġvar Ġasync Result Captor : ĠArgument Captor < AsyncResult < Any ? >> ĊĊĠ Ġ@ Captor ĊĠ Ġlateinit Ġvar Ġasync Answer Outcome Captor : ĠArgument Captor < AsyncResult < Answer Outcome >> ĊĊĠ Ġ@ Before ĊĠ Ġfun ĠsetUp () Ġ{ ĊĠĠĠ ĠsetUp Test Application Component () ĊĠ Ġ} ĊĊĠ Ġ@ Test ĊĠ Ġfun Ġtest GetCurrent State _ no Ex ploration _ is Pending () Ġ{ ĊĠĠĠ Ġval Ġcurrent State LiveData Ġ= ĊĠĠĠĠĠ Ġexploration Progress Controller . getCurrent State (). to LiveData () ĊĊĠĠĠ Ġcurrent State LiveData . observe Fore ver ( mock Current State LiveData Observer ) ĊĠĠĠ Ġtest Coroutine Dispatch ers . run Current () ĊĊĠĠĠ Ġverify ( ĊĠĠĠĠĠ Ġmock Current State LiveData Observer , ĊĠĠĠĠĠ Ġat Least Once () ĊĠĠĠ Ġ). on Changed ( currentState Result Captor . capture ()) ĊĠĠĠ ĠassertThat ( currentState Result Captor . value . is Pending ()). isTrue () ĊĠ Ġ} ĊĊĠ Ġ@ Test ĊĠ Ġfun Ġtest Play Ex ploration _ invalid _ returns Success () Ġ{ ĊĠĠĠ Ġval Ġresult LiveData Ġ= ĊĠĠĠĠĠ Ġexploration Data Controller . start Playing Ex ploration (" invalid _ exp _ id ") ĊĠĠĠ Ġresult LiveData . observe Fore ver ( mock AsyncResult LiveData Observer ) ĊĠĠĠ Ġtest Coroutine Dispatch ers . run Current () ĊĊĠĠĠ Ġ// ĠAn Ġinvalid Ġexploration Ġis Ġnot Ġknown Ġuntil Ġit 's Ġfully Ġloaded , Ġand Ġthat 's Ġobserved Ġvia ĠgetCurrent State . ĊĠĠĠ Ġverify ( mock AsyncResult LiveData Observer ). on Changed ( async Result Captor . capture ()) ĊĠĠĠ ĠassertThat ( async Result Captor . value . is Success ()). isTrue () ĊĠ Ġ} ĊĊĠ Ġ@ Test ĊĠ Ġfun Ġtest GetCurrent State _ play Invalid Ex ploration _ returns Failure () Ġ{ ĊĠĠĠ Ġval Ġcurrent State LiveData Ġ= ĊĠĠĠĠĠ Ġexploration Progress Controller . getCurrent State (). to LiveData () ĊĠĠĠ Ġcurrent State LiveData . observe Fore ver ( mock Current State LiveData Observer ) ĊĊĠĠĠ Ġplay Ex ploration (" invalid _ exp _ id ") ĊĊĠĠĠ Ġverify ( ĊĠĠĠĠĠ Ġmock Current State LiveData Observer , ĊĠĠĠĠĠ Ġat Least Once () ĊĠĠĠ Ġ). on Changed ( currentState Result Captor . capture ()) ĊĠĠĠ ĠassertThat ( currentState Result Captor . value . is Failure ()). isTrue () ĊĠĠĠ ĠassertThat ( currentState Result Captor . value . getError OrNull ()) ĊĠĠĠĠĠ Ġ. has Message That () ĊĠĠĠĠĠ Ġ. contains (" invalid _ exp _ id . json ") ĊĠ Ġ} ĊĊĠ Ġ@ Test ĊĠ Ġfun Ġtest Play Ex ploration _ valid _ returns Success () Ġ{ ĊĠĠĠ Ġval Ġresult LiveData Ġ= ĊĠĠĠĠĠ Ġexploration Data Controller . start Playing Ex ploration ( TEST _ EX PL OR ATION _ ID _ 0 ) ĊĠĠĠ Ġresult LiveData . observe Fore ver ( mock AsyncResult LiveData Observer ) ĊĠĠĠ Ġtest Coroutine Dispatch ers . run Current () ĊĊĠĠĠ Ġverify ( mock AsyncResult LiveData Observer ). on Changed ( async Result Captor . capture ()) ĊĠĠĠ ĠassertThat ( async Result Captor . value . is Success ()). isTrue () ĊĠ Ġ} ĊĊĠ Ġ@ Test ĊĠ Ġfun Ġtest GetCurrent State _ play Ex ploration _ returns Pending Result From Loading Ex ploration () Ġ{ ĊĠĠĠ Ġval Ġcurrent State LiveData Ġ= ĊĠĠĠĠĠ Ġexploration Progress Controller . getCurrent State (). to LiveData () ĊĠĠĠ Ġcurrent State LiveData . observe Fore ver ( mock Current State LiveData Observer ) ĊĠĠĠ Ġtest Coroutine Dispatch ers . run Current () ĊĊĠĠĠ Ġplay Ex ploration ( TEST _ EX PL OR ATION _ ID _ 0 ) ĊĊĠĠĠ Ġ// ĠThe Ġsecond - to - latest Ġresult Ġstays Ġpending Ġsince Ġthe Ġexploration Ġwas Ġloading Ġ( the Ġactual Ġresult Ġis Ġthe Ġfully ĊĠĠĠ Ġ// Ġloaded Ġexploration ). ĠThis Ġis Ġonly Ġtrue Ġif Ġthe Ġobserver Ġbegins Ġbefore Ġstarting Ġto Ġload Ġthe Ġexploration . ĊĠĠĠ Ġverify ( ĊĠĠĠĠĠ Ġmock Current State LiveData Observer , ĊĠĠĠĠĠ Ġat Least ( 2 ) ĊĠĠĠ Ġ). on Changed ( currentState Result Captor . capture ()) ĊĠĠĠ Ġval Ġresults Ġ= Ġcurrent State Result Captor . all Values ĊĠĠĠ ĠassertThat ( results [ results . size Ġ- Ġ 2 ]. is Pending ()). isTrue () ĊĠ Ġ} ĊĊĠ Ġ@ Test ĊĠ Ġfun Ġtest GetCurrent State _ play Ex ploration _ loaded _ returns InitialState Pending () Ġ{ ĊĠĠĠ Ġval Ġexploration Ġ= Ġget Test Ex ploration 5 () ĊĠĠĠ Ġplay Ex ploration ( TEST _ EX PL OR ATION _ ID _ 0 ) ĊĊĠĠĠ Ġval Ġcurrent State LiveData Ġ= ĊĠĠĠĠĠ Ġexploration Progress Controller . getCurrent State (). to LiveData () ĊĠĠĠ Ġcurrent State LiveData . observe Fore ver ( mock Current State LiveData Observer ) ĊĠĠĠ Ġtest Coroutine Dispatch ers . run Current () ĊĊĠĠĠ Ġverify ( ĊĠĠĠĠĠ Ġmock Current State LiveData Observer , ĊĠĠĠĠĠ Ġat Least Once () ĊĠĠĠ Ġ). on Changed ( currentState Result Captor . capture ()) ĊĠĠĠ ĠassertThat ( currentState Result Captor . value . is Success ()) ĊĠĠĠĠĠ Ġ. isTrue () ĊĠĠĠ ĠassertThat ( currentState Result Captor . value . get OrThrow (). state Type Case ) ĊĠĠĠĠĠ Ġ. isEqualTo ( PENDING _ STATE ) ĊĠĠĠ ĠassertThat ( currentState Result Captor . value . get OrThrow (). has Previous State ) ĊĠĠĠĠĠ Ġ. isFalse () ĊĠĠĠ ĠassertThat ( currentState Result Captor . value . get OrThrow (). state . name ) ĊĠĠĠĠĠ Ġ. isEqualTo ( ex ploration . init State Name ) ĊĠ Ġ} ĊĊĠ Ġ@ Test ĊĠ Ġfun Ġtest GetCurrent State _ play Invalid Ex ploration _ then Play Valid Exp _ returns Initial Pending State () Ġ{ ĊĠĠĠ Ġval Ġexploration Ġ= Ġget Test Ex ploration 5 () ĊĠĠĠ Ġ// ĠStart Ġwith Ġplaying Ġan Ġinvalid Ġexploration . ĊĠĠĠ Ġplay Ex ploration (" invalid _ exp _ id ") ĊĠĠĠ Ġend Ex ploration () ĊĊĠĠĠ Ġ// ĠThen Ġa Ġvalid Ġone . ĊĠĠĠ Ġplay Ex ploration ( TEST _ EX PL OR ATION _ ID _ 0 ) ĊĠĠĠ Ġval Ġcurrent State LiveData Ġ= ĊĠĠĠĠĠ Ġexploration Progress Controller . getCurrent State (). to LiveData () ĊĠĠĠ Ġcurrent State LiveData . observe Fore ver ( mock Current State LiveData Observer ) ĊĠĠĠ Ġtest Coroutine Dispatch ers . run Current () ĊĊĠĠĠ Ġ// ĠThe Ġlatest Ġresult Ġshould Ġcorrespond Ġto Ġthe Ġvalid ĠID , Ġand Ġthe Ġprogress Ġcontroller Ġshould Ġgrace fully Ġrecover . ĊĠĠĠ Ġverify ( ĊĠĠĠĠĠ Ġmock Current State LiveData Observer , ĊĠĠĠĠĠ Ġat Least Once () ĊĠĠĠ Ġ). on Changed ( currentState Result Captor . capture ()) ĊĠĠĠ ĠassertThat ( currentState Result Captor . value . is Success ()) ĊĠĠĠĠĠ Ġ. isTrue () ĊĠĠĠ ĠassertThat ( currentState Result Captor . value . get OrThrow (). state Type Case ) ĊĠĠĠĠĠ Ġ. isEqualTo ( PENDING _ STATE ) ĊĠĠĠ ĠassertThat ( currentState Result Captor . value . get OrThrow (). has Previous State ) ĊĠĠĠĠĠ Ġ. isFalse () ĊĠĠĠ ĠassertThat ( currentState Result Captor . value . get OrThrow (). state . name ) ĊĠĠĠĠĠ Ġ. isEqualTo ( ex ploration . init State Name ) ĊĠ Ġ} ĊĊĠ Ġ@ Test ĊĠ Ġfun Ġtest Finish Ex ploration _ before Playing _ fail WithError () Ġ{ ĊĠĠĠ Ġval Ġresult LiveData Ġ= Ġexploration Data Controller . stop Playing Ex ploration () ĊĠĠĠ Ġresult LiveData . observe Fore ver ( mock AsyncResult LiveData Observer ) ĊĠĠĠ Ġtest Coroutine Dispatch ers . run Current () ĊĊĠĠĠ Ġverify ( mock AsyncResult LiveData Observer ). on Changed ( async Result Captor . capture ()) ĊĠĠĠ ĠassertThat ( async Result Captor . value . is Failure ()). isTrue () ĊĠĠĠ ĠassertThat ( async Result Captor . value . getError OrNull ()) ĊĠĠĠĠĠ Ġ. has Message That () ĊĠĠĠĠĠ Ġ. contains (" Cannot Ġfinish Ġplaying Ġan Ġexploration Ġthat Ġhasn 't Ġyet Ġbeen Ġstarted ") ĊĠ Ġ} ĊĊĠ Ġ@ Test ĊĠ Ġfun Ġtest Play Ex ploration _ without Finish ing Previous _ fails WithError () Ġ{ ĊĠĠĠ Ġsubscribe To Current State To Allow Ex ploration To Load () ĊĠĠĠ Ġplay Ex ploration ( TEST _ EX PL OR ATION _ ID _ 0 ) ĊĊĠĠĠ Ġ// ĠTry Ġplaying Ġanother Ġexploration Ġwithout Ġfinish ing Ġthe Ġprevious Ġone . ĊĠĠĠ Ġval Ġresult LiveData Ġ= ĊĠĠĠĠĠ Ġexploration Data Controller . start Playing Ex ploration ( TEST _ EX PL OR ATION _ ID _ 0 ) ĊĠĠĠ Ġresult LiveData . observe Fore ver ( mock AsyncResult LiveData Observer ) ĊĠĠĠ Ġtest Coroutine Dispatch ers . run Current () ĊĊĠĠĠ Ġverify ( mock AsyncResult LiveData Observer ). on Changed ( async Result Captor . capture ()) ĊĠĠĠ ĠassertThat ( async Result Captor . value . is Failure ()). isTrue () ĊĠĠĠ ĠassertThat ( async Result Captor . value . getError OrNull ()) ĊĠĠĠĠĠ Ġ. has Message That () ĊĠĠĠĠĠ Ġ. contains (" Expected Ġto Ġfinish Ġprevious Ġexploration Ġbefore Ġstarting Ġa Ġnew Ġone .") ĊĠ Ġ} ĊĊĠ Ġ@ Test ĊĠ Ġfun Ġtest GetCurrent State _ play Second Ex ploration _ after Finish ing Prev _ loaded _ returns InitialState () Ġ{ ĊĠĠĠ Ġval Ġcurrent State LiveData Ġ= ĊĠĠĠĠĠ Ġexploration Progress Controller . getCurrent State (). to LiveData () ĊĠĠĠ Ġcurrent State LiveData . observe Fore ver ( mock Current State LiveData Observer ) ĊĠĠĠ Ġ// ĠStart Ġwith Ġplaying Ġa Ġvalid Ġexploration , Ġthen Ġstop . ĊĠĠĠ Ġplay Ex ploration ( TEST _ EX PL OR ATION _ ID _ 0 ) ĊĠĠĠ Ġend Ex ploration () ĊĊĠĠĠ Ġ// ĠThen Ġanother Ġvalid Ġone . ĊĠĠĠ Ġplay Ex ploration ( TEST _ EX PL OR ATION _ ID _ 1 ) ĊĊĠĠĠ Ġ// ĠThe Ġlatest Ġresult Ġshould Ġcorrespond Ġto Ġthe Ġvalid ĠID , Ġand Ġthe Ġprogress Ġcontroller Ġshould Ġgrace fully Ġrecover . ĊĠĠĠ Ġverify ( ĊĠĠĠĠĠ Ġmock Current State LiveData Observer , ĊĠĠĠĠĠ Ġat Least Once () ĊĠĠĠ Ġ). on Changed ( currentState Result Captor . capture ()) ĊĠĠĠ ĠassertThat ( currentState Result Captor . value . is Success ()) ĊĠĠĠĠĠ Ġ. isTrue () ĊĠĠĠ ĠassertThat ( currentState Result Captor . value . get OrThrow (). state Type Case ) ĊĠĠĠĠĠ Ġ. isEqualTo ( PENDING _ STATE ) ĊĠĠĠ ĠassertThat ( currentState Result Captor . value . get OrThrow (). has Previous State ) ĊĠĠĠĠĠ Ġ. isFalse () ĊĠĠĠ ĠassertThat ( currentState Result Captor . value . get OrThrow (). state . name ) ĊĠĠĠĠĠ Ġ. isEqualTo ( getTest Ex ploration 6 (). init State Name ) ĊĠ Ġ} ĊĊĠ Ġ@ Test ĊĠ Ġfun Ġtest Submit Answer _ before Playing _ fails WithError () Ġ{ ĊĠĠĠ Ġval Ġresult Ġ= ĊĠĠĠĠĠ Ġexploration Progress Controller . submit Answer ( create Multiple Choice Answer ( 0 )) ĊĠĠĠ Ġresult . observe Fore ver ( mock Async Answer Outcome Observer ) ĊĠĠĠ Ġtest Coroutine Dispatch ers . run Current () ĊĊĠĠĠ Ġ// ĠVerify Ġthat Ġthe Ġanswer Ġsubmission Ġfailed . ĊĠĠĠ Ġverify ( ĊĠĠĠĠĠ Ġmock Async Answer Outcome Observer , ĊĠĠĠĠĠ Ġat Least Once () ĊĠĠĠ Ġ). on Changed ( async Answer Outcome Captor . capture ()) ĊĠĠĠ ĠassertThat ( async Answer Outcome Captor . value . is Failure ()). isTrue () ĊĠĠĠ ĠassertThat ( async Answer Outcome Captor . value . getError OrNull ()) ĊĠĠĠĠĠ Ġ. has Message That () ĊĠĠĠĠĠ Ġ. contains (" Cannot Ġsubmit Ġan Ġanswer Ġif Ġan Ġexploration Ġis Ġnot Ġbeing Ġplayed .") ĊĠ Ġ} ĊĊĠ Ġ@ Test ĊĠ Ġfun Ġtest Submit Answer _ while Loading _ fails WithError () Ġ{ ĊĠĠĠ Ġ// ĠStart Ġplaying Ġan Ġexploration , Ġbut Ġdon 't Ġwait Ġfor Ġit Ġto Ġcomplete . ĊĠĠĠ Ġsubscribe To Current State To Allow Ex ploration To Load () ĊĠĠĠ Ġexploration Data Controller . start Playing Ex ploration ( TEST _ EX PL OR ATION _ ID _ 0 ) ĊĊĠĠĠ Ġval Ġresult Ġ= ĊĠĠĠĠĠ Ġexploration Progress Controller . submit Answer ( create Multiple Choice Answer ( 0 )) ĊĠĠĠ Ġresult . observe Fore ver ( mock Async Answer Outcome Observer ) ĊĠĠĠ Ġtest Coroutine Dispatch ers . run Current () ĊĊĠĠĠ Ġ// ĠVerify Ġthat Ġthe Ġanswer Ġsubmission Ġfailed . ĊĠĠĠ Ġverify ( ĊĠĠĠĠĠ Ġmock Async Answer Outcome Observer , ĊĠĠĠĠĠ Ġat Least Once () ĊĠĠĠ Ġ). on Changed ( async Answer Outcome Captor . capture ()) ĊĠĠĠ ĠassertThat ( async Answer Outcome Captor . value . is Failure ()). isTrue () ĊĠĠĠ ĠassertThat ( async Answer Outcome Captor . value . getError OrNull ()) ĊĠĠĠĠĠ Ġ. has Message That () ĊĠĠĠĠĠ Ġ. contains (" Cannot Ġsubmit Ġan Ġanswer Ġwhile Ġthe Ġexploration Ġis Ġbeing Ġloaded .") ĊĠ Ġ} ĊĊĠ Ġ@ Test ĊĠ Ġfun Ġtest Submit Answer _ for Multiple Choice _ correct Answer _ suc ceeds () Ġ{ ĊĠĠĠ Ġsubscribe To Current State To Allow Ex ploration To Load () ĊĠĠĠ Ġplay Ex ploration ( TEST _ EX PL OR ATION _ ID _ 0 ) ĊĊĠĠĠ Ġval Ġresult Ġ= ĊĠĠĠĠĠ Ġexploration Progress Controller . submit Answer ( create Multiple Choice Answer ( 0 )) ĊĠĠĠ Ġresult . observe Fore ver ( mock Async Answer Outcome Observer ) ĊĠĠĠ Ġtest Coroutine Dispatch ers . run Current () ĊĊĠĠĠ Ġ// ĠVerify Ġthat Ġthe Ġanswer Ġsubmission Ġwas Ġsuccessful . ĊĠĠĠ Ġverify ( ĊĠĠĠĠĠ Ġmock Async Answer Outcome Observer , ĊĠĠĠĠĠ Ġat Least Once () ĊĠĠĠ Ġ). on Changed ( async Answer Outcome Captor . capture ()) ĊĠĠĠ ĠassertThat ( async Answer Outcome Captor . value . is Success ()). isTrue () ĊĠ Ġ} ĊĊĠ Ġ@ Test ĊĠ Ġfun Ġtest Submit Answer _ for Multiple Choice _ correct Answer _ returns Outcome With Transition () Ġ{ ĊĠĠĠ Ġsubscribe To Current State To Allow Ex ploration To Load () ĊĠĠĠ Ġplay Ex ploration ( TEST _ EX PL OR ATION _ ID _ 0 ) ĊĊĠĠĠ Ġval Ġresult Ġ= ĊĠĠĠĠĠ Ġexploration Progress Controller . submit Answer ( create Multiple Choice Answer ( 0 )) ĊĠĠĠ Ġresult . observe Fore ver ( mock Async Answer Outcome Observer ) ĊĠĠĠ Ġtest Coroutine Dispatch ers . run Current () ĊĊĠĠĠ Ġ// ĠVerify Ġthat Ġthe Ġanswer Ġsubmission Ġwas Ġsuccessful . ĊĠĠĠ Ġverify ( ĊĠĠĠĠĠ Ġmock Async Answer Outcome Observer , ĊĠĠĠĠĠ Ġat Least Once () ĊĠĠĠ Ġ). on Changed ( async Answer Outcome Captor . capture ()) ĊĠĠĠ Ġval Ġanswer Outcome Ġ= Ġasync Answer Outcome Captor . value . get OrThrow () ĊĠĠĠ ĠassertThat ( answer Outcome . destination Case ). isEqualTo ( Answer Outcome . Destination Case . STATE _ NAME ) ĊĠĠĠ ĠassertThat ( answer Outcome . feedback . html ). isEqualTo (" Yes !") ĊĠ Ġ} ĊĊĠ Ġ@ Test ĊĠ Ġfun Ġtest Submit Answer _ for Multiple Choice _ wrong Answer _ suc ceeds () Ġ{ ĊĠĠĠ Ġsubscribe To Current State To Allow Ex ploration To Load () ĊĠĠĠ Ġplay Ex ploration ( TEST _ EX PL OR ATION _ ID _ 0 ) ĊĊĠĠĠ Ġval Ġresult Ġ= ĊĠĠĠĠĠ Ġexploration Progress Controller . submit Answer ( create Multiple Choice Answer ( 0 )) ĊĠĠĠ Ġresult . observe Fore ver ( mock Async Answer Outcome Observer ) ĊĠĠĠ Ġtest Coroutine Dispatch ers . run Current () ĊĊĠĠĠ Ġ// ĠVerify Ġthat Ġthe Ġanswer Ġsubmission Ġwas Ġsuccessful . ĊĠĠĠ Ġverify ( ĊĠĠĠĠĠ Ġmock Async Answer Outcome Observer , ĊĠĠĠĠĠ Ġat Least Once () ĊĠĠĠ Ġ). on Changed ( async Answer Outcome Captor . capture ()) ĊĠĠĠ ĠassertThat ( async Answer Outcome Captor . value . is Success ()). isTrue () ĊĠ Ġ} ĊĊĠ Ġ@ Test ĊĠ Ġfun Ġtest Submit Answer _ for Multiple Choice _ wrong Answer _ provides Def Feedback And New State Transition () Ġ{ ĊĠĠĠ Ġsubscribe To Current State To Allow Ex ploration To Load () ĊĠĠĠ Ġplay Ex ploration ( TEST _ EX PL OR ATION _ ID _ 0 ) ĊĊĠĠĠ Ġval Ġresult Ġ= ĊĠĠĠĠĠ Ġexploration Progress Controller . submit Answer ( create Multiple Choice Answer ( 1 )) ĊĠĠĠ Ġresult . observe Fore ver ( mock Async Answer Outcome Observer ) ĊĠĠĠ Ġtest Coroutine Dispatch ers . run Current () ĊĊĠĠĠ Ġ// ĠVerify Ġthat Ġthe Ġanswer Ġsubmission Ġwas Ġsuccessful . ĊĠĠĠ Ġverify ( ĊĠĠĠĠĠ Ġmock Async Answer Outcome Observer , ĊĠĠĠĠĠ Ġat Least Once () ĊĠĠĠ Ġ). on Changed ( async Answer Outcome Captor . capture ()) ĊĠĠĠ Ġval Ġanswer Outcome Ġ= Ġasync Answer Outcome Captor . value . get OrThrow () ĊĠĠĠ ĠassertThat ( answer Outcome . destination Case ). isEqualTo ( Answer Outcome . Destination Case . STATE _ NAME ) ĊĠĠĠ ĠassertThat ( answer Outcome . feedback . html ). contains (" Hm , Ġit Ġcertainly Ġlooks Ġlike Ġit ") ĊĠ Ġ} ĊĊĠ Ġ@ Test ĊĠ Ġfun Ġtest GetCurrent State _ after Submit ting Correct Multi Choice Answer _ be come s Completed State () Ġ{ ĊĠĠĠ Ġval Ġcurrent State LiveData Ġ= ĊĠĠĠĠĠ Ġexploration Progress Controller . getCurrent State (). to LiveData () ĊĠĠĠ Ġcurrent State LiveData . observe Fore ver ( mock Current State LiveData Observer ) ĊĠĠĠ Ġplay Ex ploration ( TEST _ EX PL OR ATION _ ID _ 0 ) ĊĊĠĠĠ Ġsubmit Multiple Choice Answer ( 0 ) ĊĊĠĠĠ Ġ// ĠVerify Ġthat Ġthe Ġcurrent Ġstate Ġupdates . ĠIt Ġshould Ġstay Ġpending , Ġand Ġthe Ġwrong Ġanswer Ġshould Ġbe Ġappended . ĊĠĠĠ Ġverify ( ĊĠĠĠĠĠ Ġmock Current State LiveData Observer , ĊĠĠĠĠĠ Ġat Least Once () ĊĠĠĠ Ġ). on Changed ( currentState Result Captor . capture ()) ĊĠĠĠ ĠassertThat ( currentState Result Captor . value . is Success ()). isTrue () ĊĠĠĠ Ġval Ġcurrent State Ġ= Ġcurrent State Result Captor . value . get OrThrow () ĊĠĠĠ ĠassertThat ( currentState . state Type Case ) ĊĠĠĠĠĠ Ġ. isEqualTo ( COMPLETED _ STATE ) ĊĠĠĠ ĠassertThat ( currentState . completed State . answer Count ) ĊĠĠĠĠĠ Ġ. isEqualTo ( 1 ) ĊĠĠĠ ĠassertThat ( currentState . completed State . get Answer ( 0 ). user Answer . answer . non Negative Int ) ĊĠĠĠĠĠ Ġ. isEqualTo ( 0 ) ĊĠĠĠ ĠassertThat ( currentState . completed State . get Answer ( 0 ). feedback . html ) ĊĠĠĠĠĠ Ġ. isEqualTo (" Yes !") ĊĠ Ġ} ĊĊĠ Ġ@ Test ĊĠ Ġfun Ġtest GetCurrent State _ after Submit ting Wrong Multi Choice Answer _ updates Pending State () Ġ{ ĊĠĠĠ Ġval Ġcurrent State LiveData Ġ= ĊĠĠĠĠĠ Ġexploration Progress Controller . getCurrent State (). to LiveData () ĊĠĠĠ Ġcurrent State LiveData . observe Fore ver ( mock Current State LiveData Observer ) ĊĠĠĠ Ġplay Ex ploration ( TEST _ EX PL OR ATION _ ID _ 0 ) ĊĊĠĠĠ Ġsubmit Multiple Choice Answer ( 2 ) ĊĊĠĠĠ Ġ// ĠVerify Ġthat Ġthe Ġcurrent Ġstate Ġupdates . ĠIt Ġshould Ġnow Ġbe Ġcompleted Ġwith Ġthe Ġcorrect Ġanswer . ĊĠĠĠ Ġverify ( ĊĠĠĠĠĠ Ġmock Current State LiveData Observer , ĊĠĠĠĠĠ Ġat Least Once () ĊĠĠĠ Ġ). on Changed ( currentState Result Captor . capture ()) ĊĠĠĠ ĠassertThat ( currentState Result Captor . value . is Success ()). isTrue () ĊĠĠĠ Ġval Ġcurrent State Ġ= Ġcurrent State Result Captor . value . get OrThrow () ĊĠĠĠ ĠassertThat ( currentState . state Type Case ) ĊĠĠĠĠĠ Ġ. isEqualTo ( PENDING _ STATE ) ĊĠĠĠ ĠassertThat ( currentState . pending State . wrong Answer Count ) ĊĠĠĠĠĠ Ġ. isEqualTo ( 1 ) ĊĠĠĠ ĠassertThat ( currentState . pending State . get Wrong Answer ( 0 ). user Answer . answer . non Negative Int ) ĊĠĠĠĠĠ Ġ. isEqualTo ( ĊĠĠĠĠĠĠĠĠ 2 ĊĠĠĠĠĠ Ġ) ĊĠĠĠ ĠassertThat ( currentState . pending State . get Wrong Answer ( 0 ). feedback . html ) ĊĠĠĠĠĠ Ġ. contains (" Have Ġanother Ġgo ?") ĊĠ Ġ} ĊĊĠ Ġ@ Test ĊĠ Ġfun Ġtest GetCurrent State _ after Submit ting Wrong Then Right Answer _ updates To State With Both Answers () Ġ{ ĊĠĠĠ Ġsubscribe To Current State To Allow Ex ploration To Load () ĊĠĠĠ Ġplay Ex ploration ( TEST _ EX PL OR ATION _ ID _ 0 ) ĊĠĠĠ Ġsubmit Multiple Choice Answer ( 2 ) ĊĊĠĠĠ Ġsubmit Multiple Choice Answer ( 0 ) ĊĊĠĠĠ Ġ// ĠVerify Ġthat Ġthe Ġcurrent Ġstate Ġupdates . ĠIt Ġshould Ġnow Ġbe Ġcompleted Ġwith Ġboth Ġthe Ġwrong Ġand Ġcorrect Ġanswers . ĊĠĠĠ Ġverify ( ĊĠĠĠĠĠ Ġmock Current State LiveData Observer , ĊĠĠĠĠĠ Ġat Least Once () ĊĠĠĠ Ġ). on Changed ( currentState Result Captor . capture ()) ĊĠĠĠ ĠassertThat ( currentState Result Captor . value . is Success ()). isTrue () ĊĠĠĠ Ġval Ġcurrent State Ġ= Ġcurrent State Result Captor . value . get OrThrow () ĊĠĠĠ ĠassertThat ( currentState . state Type Case ) ĊĠĠĠĠĠ Ġ. isEqualTo ( COMPLETED _ STATE ) ĊĠĠĠ ĠassertThat ( currentState . completed State . answer Count ) ĊĠĠĠĠĠ Ġ. isEqualTo ( 2 ) ĊĠĠĠ ĠassertThat ( currentState . completed State . get Answer ( 0 ). user Answer . answer . non Negative Int ) ĊĠĠĠĠĠ Ġ. isEqualTo ( 2 ) ĊĠĠĠ ĠassertThat ( currentState . completed State . get Answer ( 0 ). feedback . html ) ĊĠĠĠĠĠ Ġ. contains (" Have Ġanother Ġgo ?") ĊĠĠĠ ĠassertThat ( currentState . completed State . get Answer ( 1 ). user Answer . answer . non Negative Int ) ĊĠĠĠĠĠ Ġ. isEqualTo ( 0 ) ĊĠĠĠ ĠassertThat ( currentState . completed State . get Answer ( 1 ). feedback . html ) ĊĠĠĠĠĠ Ġ. isEqualTo (" Yes !") ĊĠ Ġ} ĊĊĠ Ġ@ Test ĊĠ Ġfun Ġtest MoveTo Next _ before Playing _ fails WithError () Ġ{ ĊĠĠĠ Ġval Ġmove To State Result Ġ= Ġexploration Progress Controller . moveTo Next State () ĊĠĠĠ Ġmove To State Result . observe Fore ver ( mock AsyncResult LiveData Observer ) ĊĊĠĠĠ Ġverify ( mock AsyncResult LiveData Observer , Ġat Least Once ()). on Changed ( async Result Captor . capture ()) ĊĠĠĠ ĠassertThat ( async Result Captor . value . is Failure ()). isTrue () ĊĠĠĠ ĠassertThat ( async Result Captor . value . getError OrNull ()) ĊĠĠĠĠĠ Ġ. has Message That () ĊĠĠĠĠĠ Ġ. contains (" Cannot Ġnavigate Ġto Ġa Ġnext Ġstate Ġif Ġan Ġexploration Ġis Ġnot Ġbeing Ġplayed .") ĊĠ Ġ} ĊĊĠ Ġ@ Test ĊĠ Ġfun Ġtest MoveTo Next _ while Loading Ex ploration _ fails WithError () Ġ{ ĊĠĠĠ Ġ// ĠStart Ġplaying Ġan Ġexploration , Ġbut Ġdon 't Ġwait Ġfor Ġit Ġto Ġcomplete . ĊĠĠĠ Ġsubscribe To Current State To Allow Ex ploration To Load () ĊĠĠĠ Ġexploration Data Controller . start Playing Ex ploration ( TEST _ EX PL OR ATION _ ID _ 0 ) ĊĊĠĠĠ Ġval Ġmove To State Result Ġ= Ġexploration Progress Controller . moveTo Next State () ĊĠĠĠ Ġmove To State Result . observe Fore ver ( mock AsyncResult LiveData Observer ) ĊĊĠĠĠ Ġverify ( mock AsyncResult LiveData Observer , Ġat Least Once ()). on Changed ( async Result Captor . capture ()) ĊĠĠĠ ĠassertThat ( async Result Captor . value . is Failure ()). isTrue () ĊĠĠĠ ĠassertThat ( async Result Captor . value . getError OrNull ()) ĊĠĠĠĠĠ Ġ. has Message That () ĊĠĠĠĠĠ Ġ. contains (" Cannot Ġnavigate Ġto Ġa Ġnext Ġstate Ġif Ġan Ġexploration Ġis Ġbeing Ġloaded .") ĊĠ Ġ} ĊĊĠ Ġ@ Test ĊĠ Ġfun Ġtest MoveTo Next _ for Pending InitialState _ fails WithError () Ġ{ ĊĠĠĠ Ġsubscribe To Current State To Allow Ex ploration To Load () ĊĠĠĠ Ġplay Ex ploration ( TEST _ EX PL OR ATION _ ID _ 0 ) ĊĊĠĠĠ Ġval Ġmove To State Result Ġ= Ġexploration Progress Controller . moveTo Next State () ĊĠĠĠ Ġmove To State Result . observe Fore ver ( mock AsyncResult LiveData Observer ) ĊĠĠĠ Ġtest Coroutine Dispatch ers . run Current () ĊĊĠĠĠ Ġ// ĠVerify Ġthat Ġwe Ġcan 't Ġmove Ġahead Ġsince Ġthe Ġcurrent Ġstate Ġisn 't Ġyet Ġcompleted . ĊĠĠĠ Ġverify ( mock AsyncResult LiveData Observer , Ġat Least Once ()). on Changed ( async Result Captor . capture ()) ĊĠĠĠ ĠassertThat ( async Result Captor . value . is Failure ()). isTrue () ĊĠĠĠ ĠassertThat ( async Result Captor . value . getError OrNull ()) ĊĠĠĠĠĠ Ġ. has Message That () ĊĠĠĠĠĠ Ġ. contains (" Cannot Ġnavigate Ġto Ġnext Ġstate ; Ġat Ġmost Ġrecent Ġstate .") ĊĠ Ġ} ĊĊĠ Ġ@ Test ĊĠ Ġfun Ġtest MoveTo Next _ for Completed State _ suc ceeds () Ġ{ ĊĠĠĠ Ġsubscribe To Current State To Allow Ex ploration To Load () ĊĠĠĠ Ġplay Ex ploration ( TEST _ EX PL OR ATION _ ID _ 0 ) ĊĠĠĠ Ġsubmit Multiple Choice Answer ( 0 ) ĊĊĠĠĠ Ġval Ġmove To State Result Ġ= Ġexploration Progress Controller . moveTo Next State () ĊĠĠĠ Ġmove To State Result . observe Fore ver ( mock AsyncResult LiveData Observer ) ĊĠĠĠ Ġtest Coroutine Dispatch ers . run Current () ĊĊĠĠĠ Ġverify ( mock AsyncResult LiveData Observer , Ġat Least Once ()). on Changed ( async Result Captor . capture ()) ĊĠĠĠ ĠassertThat ( async Result Captor . value . is Success ()). isTrue () ĊĠ Ġ} ĊĊĠ Ġ@ Test ĊĠ Ġfun Ġtest MoveTo Next _ for Completed State _ moves To Next State () Ġ{ ĊĠĠĠ Ġval Ġcurrent State LiveData Ġ= ĊĠĠĠĠĠ Ġexploration Progress Controller . getCurrent State (). to LiveData () ĊĠĠĠ Ġcurrent State LiveData . observe Fore ver ( mock Current State LiveData Observer ) ĊĠĠĠ Ġplay Ex ploration ( TEST _ EX PL OR ATION _ ID _ 0 ) ĊĠĠĠ Ġsubmit Multiple Choice Answer ( 0 ) ĊĊĠĠĠ Ġmove To Next State () ĊĊĠĠĠ Ġverify ( ĊĠĠĠĠĠ Ġmock Current State LiveData Observer , ĊĠĠĠĠĠ Ġat Least Once () ĊĠĠĠ Ġ). on Changed ( currentState Result Captor . capture ()) ĊĠĠĠ ĠassertThat ( currentState Result Captor . value . is Success ()). isTrue () ĊĠĠĠ Ġval Ġcurrent State Ġ= Ġcurrent State Result Captor . value . get OrThrow () ĊĠĠĠ ĠassertThat ( currentState . state . name ). isEqualTo (" What Ġlanguage ") ĊĠĠĠ ĠassertThat ( currentState . state Type Case ). isEqualTo ( PENDING _ STATE ) ĊĠ Ġ} ĊĊĠ Ġ@ Test ĊĠ Ġfun Ġtest MoveTo Next _ after Moving From Completed State _ fails WithError () Ġ{ ĊĠĠĠ Ġsubscribe To Current State To Allow Ex ploration To Load () ĊĠĠĠ Ġplay Ex ploration ( TEST _ EX PL OR ATION _ ID _ 0 ) ĊĠĠĠ Ġsubmit Multiple Choice Answer ( 0 ) ĊĠĠĠ Ġmove To Next State () ĊĊĠĠĠ Ġ// ĠTry Ġskipping Ġpast Ġthe Ġcurrent Ġstate . ĊĠĠĠ Ġval Ġmove To State Result Ġ= ĊĠĠĠĠĠ Ġexploration Progress Controller . moveTo Next State () ĊĠĠĠ Ġmove To State Result . observe Fore ver ( mock AsyncResult LiveData Observer ) ĊĠĠĠ Ġtest Coroutine Dispatch ers . run Current () ĊĊĠĠĠ Ġ// ĠVerify Ġwe Ġcan 't Ġmove Ġahead Ġsince Ġthe Ġnew Ġstate Ġisn 't Ġyet Ġcompleted . ĊĠĠĠ Ġverify ( mock AsyncResult LiveData Observer , Ġat Least Once ()). on Changed ( async Result Captor . capture ()) ĊĠĠĠ ĠassertThat ( async Result Captor . value . is Failure ()). isTrue () ĊĠĠĠ ĠassertThat ( async Result Captor . value . getError OrNull ()) ĊĠĠĠĠĠ Ġ. has Message That () ĊĠĠĠĠĠ Ġ. contains (" Cannot Ġnavigate Ġto Ġnext Ġstate ; Ġat Ġmost Ġrecent Ġstate .") ĊĠ Ġ} ĊĊĠ Ġ@ Test ĊĠ Ġfun Ġtest MoveTo Previous _ before Playing _ fails WithError () Ġ{ ĊĠĠĠ Ġval Ġmove To State Result Ġ= ĊĠĠĠĠĠ Ġexploration Progress Controller . moveTo Previous State () ĊĠĠĠ Ġmove To State Result . observe Fore ver ( mock AsyncResult LiveData Observer ) ĊĠĠĠ Ġtest Coroutine Dispatch ers . run Current () ĊĊĠĠĠ Ġverify ( mock AsyncResult LiveData Observer , Ġat Least Once ()). on Changed ( async Result Captor . capture ()) ĊĠĠĠ ĠassertThat ( async Result Captor . value . is Failure ()). isTrue () ĊĠĠĠ ĠassertThat ( async Result Captor . value . getError OrNull ()) ĊĠĠĠĠĠ Ġ. has Message That () ĊĠĠĠĠĠ Ġ. contains (" Cannot Ġnavigate Ġto Ġa Ġprevious Ġstate Ġif Ġan Ġexploration Ġis Ġnot Ġbeing Ġplayed .") ĊĠ Ġ} ĊĊĠ Ġ@ Test ĊĠ Ġfun Ġtest MoveTo Previous _ while Loading Ex ploration _ fails WithError () Ġ{ ĊĠĠĠ Ġ// ĠStart Ġplaying Ġan Ġexploration , Ġbut Ġdon 't Ġwait Ġfor Ġit Ġto Ġcomplete . ĊĠĠĠ Ġsubscribe To Current State To Allow Ex ploration To Load () ĊĠĠĠ Ġexploration Data Controller . start Playing Ex ploration ( TEST _ EX PL OR ATION _ ID _ 0 ) ĊĊĠĠĠ Ġval Ġmove To State Result Ġ= ĊĠĠĠĠĠ Ġexploration Progress Controller . moveTo Previous State () ĊĠĠĠ Ġmove To State Result . observe Fore ver ( mock AsyncResult LiveData Observer ) ĊĠĠĠ Ġtest Coroutine Dispatch ers . run Current () ĊĊĠĠĠ Ġverify ( mock AsyncResult LiveData Observer , Ġat Least Once ()). on Changed ( async Result Captor . capture ()) ĊĠĠĠ ĠassertThat ( async Result Captor . value . is Failure ()). isTrue () ĊĠĠĠ ĠassertThat ( async Result Captor . value . getError OrNull ()) ĊĠĠĠĠĠ Ġ. has Message That () ĊĠĠĠĠĠ Ġ. contains (" Cannot Ġnavigate Ġto Ġa Ġprevious Ġstate Ġif Ġan Ġexploration Ġis Ġbeing Ġloaded .") ĊĠ Ġ} ĊĊĠ Ġ@ Test ĊĠ Ġfun Ġtest MoveTo Previous _ on Pending InitialState _ fails WithError () Ġ{ ĊĠĠĠ Ġsubscribe To Current State To Allow Ex ploration To Load () ĊĠĠĠ Ġplay Ex ploration ( TEST _ EX PL OR ATION _ ID _ 0 ) ĊĊĠĠĠ Ġval Ġmove To State Result Ġ= ĊĠĠĠĠĠ Ġexploration Progress Controller . moveTo Previous State () ĊĠĠĠ Ġmove To State Result . observe Fore ver ( mock AsyncResult LiveData Observer ) ĊĠĠĠ Ġtest Coroutine Dispatch ers . run Current () ĊĊĠĠĠ Ġ// ĠVerify Ġwe Ġcan 't Ġmove Ġbehind Ġsince Ġthe Ġcurrent Ġstate Ġis Ġthe Ġinitial Ġexploration Ġstate . ĊĠĠĠ Ġverify ( mock AsyncResult LiveData Observer , Ġat Least Once ()). on Changed ( async Result Captor . capture ()) ĊĠĠĠ ĠassertThat ( async Result Captor . value . is Failure ()). isTrue () ĊĠĠĠ ĠassertThat ( async Result Captor . value . getError OrNull ()) ĊĠĠĠĠĠ Ġ. has Message That () ĊĠĠĠĠĠ Ġ. contains (" Cannot Ġnavigate Ġto Ġprevious Ġstate ; Ġat Ġinitial Ġstate .") ĊĠ Ġ} ĊĊĠ Ġ@ Test ĊĠ Ġfun Ġtest MoveTo Previous _ on Completed InitialState _ fails WithError () Ġ{ ĊĠĠĠ Ġsubscribe To Current State To Allow Ex ploration To Load () ĊĠĠĠ Ġplay Ex ploration ( TEST _ EX PL OR ATION _ ID _ 0 ) ĊĠĠĠ Ġsubmit Multiple Choice Answer ( 0 ) ĊĊĠĠĠ Ġval Ġmove To State Result Ġ= ĊĠĠĠĠĠ Ġexploration Progress Controller . moveTo Previous State () ĊĠĠĠ Ġmove To State Result . observe Fore ver ( mock AsyncResult LiveData Observer ) ĊĠĠĠ Ġtest Coroutine Dispatch ers . run Current () ĊĊĠĠĠ Ġ// ĠStill Ġcan 't Ġnavigate Ġbehind Ġfor Ġa Ġcompleted Ġinitial Ġstate Ġsince Ġthere 's Ġno Ġprevious Ġstate . ĊĠĠĠ Ġverify ( mock AsyncResult LiveData Observer , Ġat Least Once ()). on Changed ( async Result Captor . capture ()) ĊĠĠĠ ĠassertThat ( async Result Captor . value . is Failure ()). isTrue () ĊĠĠĠ ĠassertThat ( async Result Captor . value . getError OrNull ()) ĊĠĠĠĠĠ Ġ. has Message That () ĊĠĠĠĠĠ Ġ. contains (" Cannot Ġnavigate Ġto Ġprevious Ġstate ; Ġat Ġinitial Ġstate .") ĊĠ Ġ} ĊĊĠ Ġ@ Test ĊĠ Ġfun Ġtest MoveTo Previous _ for State With Completed Previous State _ suc ceeds () Ġ{ ĊĠĠĠ Ġsubscribe To Current State To Allow Ex ploration To Load () ĊĠĠĠ Ġplay Ex ploration ( TEST _ EX PL OR ATION _ ID _ 0 ) ĊĠĠĠ Ġsubmit Multiple Choice Answer And MoveTo Next State ( 0 ) ĊĊĠĠĠ Ġval Ġmove To State Result Ġ= ĊĠĠĠĠĠ Ġexploration Progress Controller . moveTo Previous State () ĊĠĠĠ Ġmove To State Result . observe Fore ver ( mock AsyncResult LiveData Observer ) ĊĠĠĠ Ġtest Coroutine Dispatch ers . run Current () ĊĊĠĠĠ Ġ// ĠVerify Ġthat Ġwe Ġcan Ġnavigate Ġto Ġthe Ġprevious Ġstate Ġsince Ġthe Ġcurrent Ġstate Ġis Ġcomplete Ġand Ġnot Ġinitial . ĊĠĠĠ Ġverify ( mock AsyncResult LiveData Observer , Ġat Least Once ()). on Changed ( async Result Captor . capture ()) ĊĠĠĠ ĠassertThat ( async Result Captor . value . is Success ()). isTrue () ĊĠ Ġ} ĊĊĠ Ġ@ Test ĊĠ Ġfun Ġtest MoveTo Previous _ for Completed State _ moves To Previous State () Ġ{ ĊĠĠĠ Ġval Ġcurrent State LiveData Ġ= ĊĠĠĠĠĠ Ġexploration Progress Controller . getCurrent State (). to LiveData () ĊĠĠĠ Ġcurrent State LiveData . observe Fore ver ( mock Current State LiveData Observer ) ĊĠĠĠ Ġplay Ex ploration ( TEST _ EX PL OR ATION _ ID _ 0 ) ĊĠĠĠ Ġsubmit Multiple Choice Answer And MoveTo Next State ( 0 ) ĊĊĠĠĠ Ġmove To Previous State () ĊĊĠĠĠ Ġ// ĠSince Ġthe Ġanswer Ġsubmission Ġand Ġforward Ġnavigation Ġshould Ġwork Ġ( see Ġearlier Ġtests ), Ġverify Ġthat Ġthe Ġmove Ġto Ġthe ĊĠĠĠ Ġ// Ġprevious Ġstate Ġdoes Ġreturn Ġus Ġback Ġto Ġthe Ġinitial Ġexploration Ġstate Ġ( which Ġis Ġnow Ġcompleted ). ĊĠĠĠ Ġverify ( ĊĠĠĠĠĠ Ġmock Current State LiveData Observer , ĊĠĠĠĠĠ Ġat Least Once () ĊĠĠĠ Ġ). on Changed ( currentState Result Captor . capture ()) ĊĠĠĠ ĠassertThat ( currentState Result Captor . value . is Success ()). isTrue () ĊĠĠĠ Ġval Ġcurrent State Ġ= Ġcurrent State Result Captor . value . get OrThrow () ĊĠĠĠ ĠassertThat ( currentState . state . name ). isEqualTo (" Welcome !") ĊĠĠĠ ĠassertThat ( currentState . state Type Case ). isEqualTo ( COMPLETED _ STATE ) ĊĠ Ġ} ĊĊĠ Ġ@ Test ĊĠ Ġfun Ġtest MoveTo Previous _ navig ated Forward Then Back To Initial _ fails WithError () Ġ{ ĊĠĠĠ Ġsubscribe To Current State To Allow Ex ploration To Load () ĊĠĠĠ Ġplay Ex ploration ( TEST _ EX PL OR ATION _ ID _ 0 ) ĊĠĠĠ Ġsubmit Multiple Choice Answer And MoveTo Next State ( 0 ) ĊĠĠĠ Ġmove To Previous State () ĊĊĠĠĠ Ġval Ġmove To State Result Ġ= ĊĠĠĠĠĠ Ġexploration Progress Controller . moveTo Previous State () ĊĠĠĠ Ġmove To State Result . observe Fore ver ( mock AsyncResult LiveData Observer ) ĊĠĠĠ Ġtest Coroutine Dispatch ers . run Current () ĊĊĠĠĠ Ġ// ĠThe Ġfirst Ġprevious Ġnavigation Ġshould Ġsucceed Ġ( see Ġabove ), Ġbut Ġthe Ġsecond Ġwill Ġfail Ġsince Ġwe 're Ġback Ġat Ġthe ĊĠĠĠ Ġ// Ġinitial Ġstate . ĊĠĠĠ Ġverify ( mock AsyncResult LiveData Observer , Ġat Least Once ()). on Changed ( async Result Captor . capture ()) ĊĠĠĠ ĠassertThat ( async Result Captor . value . is Failure ()). isTrue () ĊĠĠĠ ĠassertThat ( async Result Captor . value . getError OrNull ()) ĊĠĠĠĠĠ Ġ. has Message That () ĊĠĠĠĠĠ Ġ. contains (" Cannot Ġnavigate Ġto Ġprevious Ġstate ; Ġat Ġinitial Ġstate .") ĊĠ Ġ} ĊĊĠ Ġ@ Test ĊĠ Ġfun Ġtest Submit Answer _ for TextInput _ correct Answer _ returns Outcome With Transition () Ġ{ ĊĠĠĠ Ġsubscribe To Current State To Allow Ex ploration To Load () ĊĠĠĠ Ġplay Ex ploration ( TEST _ EX PL OR ATION _ ID _ 0 ) ĊĠĠĠ Ġsubmit Multiple Choice Answer And MoveTo Next State ( 0 ) ĊĊĠĠĠ Ġval Ġresult Ġ= ĊĠĠĠĠĠ Ġexploration Progress Controller . submit Answer ( create TextInput Answer (" Fin nish ")) ĊĠĠĠ Ġresult . observe Fore ver ( mock Async Answer Outcome Observer ) ĊĠĠĠ Ġtest Coroutine Dispatch ers . run Current () ĊĊĠĠĠ Ġ// ĠVerify Ġthat Ġthe Ġanswer Ġsubmission Ġwas Ġsuccessful . ĊĠĠĠ Ġverify ( ĊĠĠĠĠĠ Ġmock Async Answer Outcome Observer , ĊĠĠĠĠĠ Ġat Least Once () ĊĠĠĠ Ġ). on Changed ( async Answer Outcome Captor . capture ()) ĊĠĠĠ Ġval Ġanswer Outcome Ġ= Ġasync Answer Outcome Captor . value . get OrThrow () ĊĠĠĠ ĠassertThat ( answer Outcome . destination Case ). isEqualTo ( Answer Outcome . Destination Case . STATE _ NAME ) ĊĠĠĠ ĠassertThat ( answer Outcome . feedback . html ). contains (" Yes ! ĠO pp ia Ġis Ġthe ĠFin nish Ġword Ġfor Ġlearn .") ĊĠ Ġ} ĊĊĠ Ġ@ Test ĊĠ Ġfun Ġtest Submit Answer _ for TextInput _ wrong Answer _ returns Default Outcome () Ġ{ ĊĠĠĠ Ġsubscribe To Current State To Allow Ex ploration To Load () ĊĠĠĠ Ġplay Ex ploration ( TEST _ EX PL OR ATION _ ID _ 0 ) ĊĠĠĠ Ġsubmit Multiple Choice Answer And MoveTo Next State ( 0 ) ĊĊĠĠĠ Ġval Ġresult Ġ= ĊĠĠĠĠĠ Ġexploration Progress Controller . submit Answer ( create TextInput Answer (" K ling on ")) ĊĠĠĠ Ġresult . observe Fore ver ( mock Async Answer Outcome Observer ) ĊĠĠĠ Ġtest Coroutine Dispatch ers . run Current () ĊĊĠĠĠ Ġ// ĠVerify Ġthat Ġthe Ġanswer Ġwas Ġwrong , Ġand Ġthat Ġthere 's Ġno Ġhandler Ġfor Ġit Ġso Ġthe Ġdefault Ġoutcome Ġis Ġreturned . ĊĠĠĠ Ġverify ( ĊĠĠĠĠĠ Ġmock Async Answer Outcome Observer , ĊĠĠĠĠĠ Ġat Least Once () ĊĠĠĠ Ġ). on Changed ( async Answer Outcome Captor . capture ()) ĊĠĠĠ Ġval Ġanswer Outcome Ġ= Ġasync Answer Outcome Captor . value . get OrThrow () ĊĠĠĠ ĠassertThat ( answer Outcome . destination Case ). isEqualTo ( Answer Outcome . Destination Case . SAME _ STATE ) ĊĠĠĠ ĠassertThat ( answer Outcome . feedback . html ). contains (" Sorry , Ġno pe ") ĊĠ Ġ} ĊĊĠ Ġ@ Test ĊĠ Ġfun Ġtest Submit Answer _ for TextInput _ wrong Answer _ returns Default Outcome _ show Hint () Ġ{ ĊĠĠĠ Ġsubscribe To Current State To Allow Ex ploration To Load () ĊĠĠĠ Ġplay Ex ploration ( TEST _ EX PL OR ATION _ ID _ 0 ) ĊĠĠĠ Ġsubmit Multiple Choice Answer And MoveTo Next State ( 0 ) ĊĊĠĠĠ Ġval Ġresult Ġ= ĊĠĠĠĠĠ Ġexploration Progress Controller . submit Answer ( create TextInput Answer (" K ling on ")) ĊĠĠĠ Ġresult . observe Fore ver ( mock Async Answer Outcome Observer ) ĊĠĠĠ Ġtest Coroutine Dispatch ers . run Current () ĊĊĠĠĠ Ġ// ĠVerify Ġthat Ġthe Ġcurrent Ġstate Ġupdates . ĠIt Ġshould Ġstay Ġpending , Ġand Ġthe Ġwrong Ġanswer Ġshould Ġbe Ġappended . ĊĠĠĠ Ġverify ( ĊĠĠĠĠĠ Ġmock Current State LiveData Observer , ĊĠĠĠĠĠ Ġat Least Once () ĊĠĠĠ Ġ). on Changed ( currentState Result Captor . capture ()) ĊĠĠĠ ĠassertThat ( currentState Result Captor . value . is Success ()). isTrue () ĊĠĠĠ Ġval Ġcurrent State Ġ= Ġcurrent State Result Captor . value . get OrThrow () ĊĠĠĠ ĠassertThat ( currentState . state Type Case ). isEqualTo ( PENDING _ STATE ) ĊĠĠĠ ĠassertThat ( currentState . pending State . wrong Answer Count ). isEqualTo ( 1 ) ĊĠĠĠ Ġval Ġanswer And Feedback Ġ= Ġcurrent State . pending State . get Wrong Answer ( 0 ) ĊĠĠĠ ĠassertThat ( answer And Feedback . user Answer . answer . normalized String ). isEqualTo (" K ling on ") ĊĠĠĠ ĠassertThat ( answer And Feedback . feedback . html ). contains (" Sorry , Ġno pe ") ĊĠĠĠ Ġval Ġhint And Solution Ġ= Ġcurrent State . state . interaction . get Hint ( 0 ) ĊĠĠĠ ĠassertThat ( hint And Solution . hint Content . html ). contains (" Start Ġby Ġfinding Ġthe Ġdenominator ") ĊĠ Ġ} ĊĊĠ Ġ@ Test ĊĠ Ġfun Ġtest Re veal Hint _ for Wrong Answer _ show Hint _ return Hint Is Re ve aled () Ġ{ ĊĠĠĠ Ġsubscribe To Current State To Allow Ex ploration To Load () ĊĠĠĠ Ġplay Ex ploration ( TEST _ EX PL OR ATION _ ID _ 0 ) ĊĠĠĠ Ġsubmit Multiple Choice Answer And MoveTo Next State ( 0 ) ĊĊĠĠĠ Ġ// ĠVerify Ġthat Ġthe Ġcurrent Ġstate Ġupdates . ĠIt Ġshould Ġstay Ġpending , Ġon Ġsubmission Ġof Ġwrong Ġanswer . ĊĠĠĠ Ġverify ( ĊĠĠĠĠĠ Ġmock Current State LiveData Observer , ĊĠĠĠĠĠ Ġat Least Once () ĊĠĠĠ Ġ). on Changed ( currentState Result Captor . capture ()) ĊĠĠĠ ĠassertThat ( currentState Result Captor . value . is Success ()). isTrue () ĊĠĠĠ Ġval Ġcurrent State Ġ= Ġcurrent State Result Captor . value . get OrThrow () ĊĊĠĠĠ Ġval Ġresult Ġ= Ġexploration Progress Controller . submit Hint Is Re ve aled ( ĊĠĠĠĠĠ Ġcurrent State . state , ĊĠĠĠĠĠ Ġtrue , ĊĠĠĠĠĠĠ 0 ĊĠĠĠ Ġ) ĊĠĠĠ Ġresult . observe Fore ver ( mock Async Hint Observer ) ĊĠĠĠ Ġtest Coroutine Dispatch ers . run Current () ĊĊĠĠĠ ĠassertThat ( currentState . state Type Case ). isEqualTo ( PENDING _ STATE ) ĊĊĠĠĠ Ġval Ġhint And Solution Ġ= Ġcurrent State . state . interaction . get Hint ( 0 ) ĊĠĠĠ ĠassertThat ( hint And Solution . hint Content . html ). contains (" Start Ġby Ġfinding Ġthe Ġdenominator ") ĊĊĠĠĠ Ġ// ĠVerify Ġthat Ġthe Ġcurrent Ġstate Ġupdates . ĠHint Ġreve aled Ġis Ġtrue . ĊĠĠĠ Ġverify ( ĊĠĠĠĠĠ Ġmock Current State LiveData Observer , ĊĠĠĠĠĠ Ġat Least Once () ĊĠĠĠ Ġ). on Changed ( currentState Result Captor . capture ()) ĊĠĠĠ ĠassertThat ( currentState Result Captor . value . is Success ()). isTrue () ĊĠĠĠ Ġval Ġupdated State Ġ= Ġcurrent State Result Captor . value . get OrThrow () ĊĊĠĠĠ ĠassertThat ( updated State . state . interaction . get Hint ( 0 ). hint Is Re ve aled ). isTrue () ĊĠ Ġ} ĊĊĠ Ġ@ Test ĊĠ Ġfun Ġtest Re veal Solution _ for Wrong Answer _ show Solution _ return Solution Is Re ve aled () Ġ{ ĊĠĠĠ Ġsubscribe To Current State To Allow Ex ploration To Load () ĊĠĠĠ Ġplay Ex ploration ( TEST _ EX PL OR ATION _ ID _ 0 ) ĊĠĠĠ Ġsubmit Multiple Choice Answer And MoveTo Next State ( 0 ) ĊĊĠĠĠ Ġ// ĠVerify Ġthat Ġthe Ġcurrent Ġstate Ġupdates . ĠIt Ġshould Ġstay Ġpending , Ġon Ġsubmission Ġof Ġwrong Ġanswer . ĊĠĠĠ Ġverify ( ĊĠĠĠĠĠ Ġmock Current State LiveData Observer , ĊĠĠĠĠĠ Ġat Least Once () ĊĠĠĠ Ġ). on Changed ( currentState Result Captor . capture ()) ĊĠĠĠ ĠassertThat ( currentState Result Captor . value . is Success ()). isTrue () ĊĠĠĠ Ġval Ġcurrent State Ġ= Ġcurrent State Result Captor . value . get OrThrow () ĊĊĠĠĠ Ġval Ġresult Ġ= Ġexploration Progress Controller . submit Solution Is Re ve aled ( currentState . state ) ĊĠĠĠ Ġresult . observe Fore ver ( mock Async Solution Observer ) ĊĠĠĠ Ġtest Coroutine Dispatch ers . run Current () ĊĊĠĠĠ ĠassertThat ( currentState . state Type Case ). isEqualTo ( PENDING _ STATE ) ĊĊĠĠĠ Ġ// ĠVerify Ġthat Ġthe Ġcurrent Ġstate Ġupdates . ĠSolution Ġreve aled Ġis Ġtrue . ĊĠĠĠ Ġverify ( ĊĠĠĠĠĠ Ġmock Current State LiveData Observer , ĊĠĠĠĠĠ Ġat Least Once () ĊĠĠĠ Ġ). on Changed ( currentState Result Captor . capture ()) ĊĠĠĠ ĠassertThat ( currentState Result Captor . value . is Success ()). isTrue () ĊĠĠĠ Ġval Ġupdated State Ġ= Ġcurrent State Result Captor . value . get OrThrow () ĊĊĠĠĠ ĠassertThat ( updated State . state . interaction . solution . solution Is Re ve aled ). isTrue () ĊĠ Ġ} ĊĊĠ Ġ@ Test ĊĠ Ġfun Ġtest Submit Answer _ for TextInput _ wrong Answer _ after All Hints Are Ex hausted _ show Solution () Ġ{ ĊĠĠĠ Ġsubscribe To Current State To Allow Ex ploration To Load () ĊĠĠĠ Ġplay Ex ploration ( TEST _ EX PL OR ATION _ ID _ 0 ) ĊĠĠĠ Ġsubmit Multiple Choice Answer And MoveTo Next State ( 0 ) ĊĊĠĠĠ Ġval Ġresult Ġ= ĊĠĠĠĠĠ Ġexploration Progress Controller . submit Answer ( create TextInput Answer (" K ling on ")) ĊĠĠĠ Ġresult . observe Fore ver ( mock Async Answer Outcome Observer ) ĊĠĠĠ Ġtest Coroutine Dispatch ers . run Current () ĊĊĠĠĠ Ġ// ĠVerify Ġthat Ġthe Ġcurrent Ġstate Ġupdates . ĠIt Ġshould Ġstay Ġpending , Ġand Ġthe Ġwrong Ġanswer Ġshould Ġbe Ġappended . ĊĠĠĠ Ġverify ( ĊĠĠĠĠĠ Ġmock Current State LiveData Observer , ĊĠĠĠĠĠ Ġat Least Once () ĊĠĠĠ Ġ). on Changed ( currentState Result Captor . capture ()) ĊĠĠĠ ĠassertThat ( currentState Result Captor . value . is Success ()). isTrue () ĊĠĠĠ Ġval Ġcurrent State Ġ= Ġcurrent State Result Captor . value . get OrThrow () ĊĠĠĠ ĠassertThat ( currentState . state Type Case ). isEqualTo ( PENDING _ STATE ) ĊĠĠĠ ĠassertThat ( currentState . pending State . wrong Answer Count ). isEqualTo ( 1 ) ĊĊĠĠĠ Ġval Ġhint 1 Ġ= Ġcurrent State . state . interaction . get Hint ( 0 ) ĊĠĠĠ ĠassertThat ( hint 1 . hint Content . html ) ĊĠĠĠĠĠ Ġ. contains (" Start Ġby Ġfinding Ġthe Ġdenominator ") ĊĠĠĠ Ġval Ġhint 2 Ġ= Ġcurrent State . state . interaction . get Hint ( 1 ) ĊĠĠĠ ĠassertThat ( hint 2 . hint Content . html ) ĊĠĠĠĠĠ Ġ. contains (" Next , Ġfind Ġthe Ġnum erator Ġby Ġcounting Ġthe Ġnumber Ġof Ġselected Ġparts .") ĊĠĠĠ Ġval Ġhint 3 Ġ= Ġcurrent State . state . interaction . get Hint ( 2 ) ĊĠĠĠ ĠassertThat ( hint 3 . hint Content . html ) ĊĠĠĠĠĠ Ġ. contains (" Always Ġbe Ġcareful Ġabout Ġwhat Ġyou 're Ġcounting . ĠThe Ġquestion Ġwill Ġhave Ġcl ues !") ĊĊĠĠĠ Ġval Ġsolution Ġ= Ġcurrent State . state . interaction . solution ĊĠĠĠ ĠassertThat ( solution . correct Answer . correct Answer ) ĊĠĠĠĠĠ Ġ. isEqualTo (" 3 ") ĊĠĠĠ ĠassertThat ( solution . explanation . html ) ĊĠĠĠĠĠ Ġ. contains (" The Ġdenominator Ġof Ġa Ġfraction Ġis Ġthe Ġsecond Ġnumber Ġin Ġthe Ġfraction .") ĊĠ Ġ} ĊĊĠ Ġ@ Test ĊĠ Ġfun Ġtest GetCurrent State _ second State _ submit Right Answer _ pending State Be come s Completed () Ġ{ ĊĠĠĠ Ġsubscribe To Current State To Allow Ex ploration To Load () ĊĠĠĠ Ġplay Ex ploration ( TEST _ EX PL OR ATION _ ID _ 0 ) ĊĠĠĠ Ġsubmit Multiple Choice Answer And MoveTo Next State ( 0 ) ĊĊĠĠĠ Ġval Ġresult Ġ= ĊĠĠĠĠĠ Ġexploration Progress Controller . submit Answer ( create TextInput Answer (" Fin nish ")) ĊĠĠĠ Ġresult . observe Fore ver ( mock Async Answer Outcome Observer ) ĊĠĠĠ Ġtest Coroutine Dispatch ers . run Current () ĊĊĠĠĠ Ġ// ĠVerify Ġthat Ġthe Ġcurrent Ġstate Ġupdates . ĠIt Ġshould Ġnow Ġbe Ġcompleted Ġwith Ġthe Ġcorrect Ġanswer . ĊĠĠĠ Ġverify ( ĊĠĠĠĠĠ Ġmock Current State LiveData Observer , ĊĠĠĠĠĠ Ġat Least Once () ĊĠĠĠ Ġ). on Changed ( currentState Result Captor . capture ()) ĊĠĠĠ ĠassertThat ( currentState Result Captor . value . is Success ()). isTrue () ĊĠĠĠ Ġval Ġcurrent State Ġ= Ġcurrent State Result Captor . value . get OrThrow () ĊĠĠĠ ĠassertThat ( currentState . state Type Case ). isEqualTo ( COMPLETED _ STATE ) ĊĠĠĠ ĠassertThat ( currentState . completed State . answer Count ). isEqualTo ( 1 ) ĊĠĠĠ Ġval Ġanswer And Feedback Ġ= Ġcurrent State . completed State . get Answer ( 0 ) ĊĠĠĠ ĠassertThat ( answer And Feedback . user Answer . answer . normalized String ). isEqualTo (" Fin nish ") ĊĠĠĠ ĠassertThat ( answer And Feedback . feedback . html ). contains (" Yes ! ĠO pp ia Ġis Ġthe ĠFin nish Ġword ") ĊĠ Ġ} ĊĊĠ Ġ@ Test ĊĠ Ġfun Ġtest Submit Answer _ for TextInput _ with Spaces _ updates State With Ver batim Answer () Ġ{ ĊĠĠĠ Ġsubscribe To Current State To Allow Ex ploration To Load () ĊĠĠĠ Ġplay Ex ploration ( TEST _ EX PL OR ATION _ ID _ 0 ) ĊĠĠĠ Ġsubmit Multiple Choice Answer And MoveTo Next State ( 0 ) ĊĊĠĠĠ Ġval Ġresult Ġ= ĊĠĠĠĠĠ Ġexploration Progress Controller . submit Answer ( create TextInput Answer (" Fin nish Ġ Ġ")) ĊĠĠĠ Ġresult . observe Fore ver ( mock Async Answer Outcome Observer ) ĊĠĠĠ Ġtest Coroutine Dispatch ers . run Current () ĊĊĠĠĠ Ġ// ĠVerify Ġthat Ġthe Ġcurrent Ġstate Ġupdates . ĠThe Ġsubmitted Ġanswer Ġshould Ġhave Ġa Ġtext ual Ġversion Ġthat Ġis Ġa Ġver batim ĊĠĠĠ Ġ// Ġversion Ġof Ġthe Ġuser - submitted Ġanswer . ĊĠĠĠ Ġverify ( ĊĠĠĠĠĠ Ġmock Current State LiveData Observer , ĊĠĠĠĠĠ Ġat Least Once () ĊĠĠĠ Ġ). on Changed ( currentState Result Captor . capture ()) ĊĠĠĠ ĠassertThat ( currentState Result Captor . value . is Success ()). isTrue () ĊĠĠĠ Ġval Ġcurrent State Ġ= Ġcurrent State Result Captor . value . get OrThrow () ĊĠĠĠ ĠassertThat ( currentState . state Type Case ) ĊĠĠĠĠĠ Ġ. isEqualTo ( COMPLETED _ STATE ) ĊĠĠĠ ĠassertThat ( currentState . completed State . answer Count ) ĊĠĠĠĠĠ Ġ. isEqualTo ( 1 ) ĊĠĠĠ Ġval Ġanswer And Feedback Ġ= Ġcurrent State . completed State . get Answer ( 0 ) ĊĠĠĠ ĠassertThat ( answer And Feedback . user Answer . text ual Answer Case ) ĊĠĠĠĠĠ Ġ. isEqualTo ( User Answer . Text ual Answer Case . PLAIN _ AN SW ER ) ĊĠĠĠ ĠassertThat ( answer And Feedback . user Answer . plain Answer ) ĊĠĠĠĠĠ Ġ. isEqualTo (" Fin nish Ġ Ġ") ĊĠ Ġ} ĊĊĠ Ġ@ Test ĊĠ Ġfun Ġtest GetCurrent State _ second State _ submit Wrong Answer _ update Pending State () Ġ{ ĊĠĠĠ Ġsubscribe To Current State To Allow Ex ploration To Load () ĊĠĠĠ Ġplay Ex ploration ( TEST _ EX PL OR ATION _ ID _ 0 ) ĊĠĠĠ Ġsubmit Multiple Choice Answer And MoveTo Next State ( 0 ) ĊĊĠĠĠ Ġval Ġresult Ġ= ĊĠĠĠĠĠ Ġexploration Progress Controller . submit Answer ( create TextInput Answer (" K ling on ")) ĊĠĠĠ Ġresult . observe Fore ver ( mock Async Answer Outcome Observer ) ĊĠĠĠ Ġtest Coroutine Dispatch ers . run Current () ĊĊĠĠĠ Ġ// ĠVerify Ġthat Ġthe Ġcurrent Ġstate Ġupdates . ĠIt Ġshould Ġstay Ġpending , Ġand Ġthe Ġwrong Ġanswer Ġshould Ġbe Ġappended . ĊĠĠĠ Ġverify ( ĊĠĠĠĠĠ Ġmock Current State LiveData Observer , ĊĠĠĠĠĠ Ġat Least Once () ĊĠĠĠ Ġ). on Changed ( currentState Result Captor . capture ()) ĊĠĠĠ ĠassertThat ( currentState Result Captor . value . is Success ()). isTrue () ĊĠĠĠ Ġval Ġcurrent State Ġ= Ġcurrent State Result Captor . value . get OrThrow () ĊĠĠĠ ĠassertThat ( currentState . state Type Case ). isEqualTo ( PENDING _ STATE ) ĊĠĠĠ ĠassertThat ( currentState . pending State . wrong Answer Count ). isEqualTo ( 1 ) ĊĠĠĠ Ġval Ġanswer And Feedback Ġ= Ġcurrent State . pending State . get Wrong Answer ( 0 ) ĊĠĠĠ ĠassertThat ( answer And Feedback . user Answer . answer . normalized String ). isEqualTo (" K ling on ") ĊĠĠĠ ĠassertThat ( answer And Feedback . feedback . html ). contains (" Sorry , Ġno pe ") ĊĠ Ġ} ĊĊĠ Ġ@ Test ĊĠ Ġfun Ġtest GetCurrent State _ after Move Previous And Next _ returns Current State () Ġ{ ĊĠĠĠ Ġval Ġcurrent State LiveData Ġ= ĊĠĠĠĠĠ Ġexploration Progress Controller . getCurrent State (). to LiveData () ĊĠĠĠ Ġcurrent State LiveData . observe Fore ver ( mock Current State LiveData Observer ) ĊĠĠĠ Ġplay Ex ploration ( TEST _ EX PL OR ATION _ ID _ 0 ) ĊĠĠĠ Ġsubmit Multiple Choice Answer And MoveTo Next State ( 0 ) ĊĊĠĠĠ Ġmove To Previous State () ĊĠĠĠ Ġmove To Next State () ĊĊĠĠĠ Ġ// ĠThe Ġcurrent Ġstate Ġshould Ġstay Ġthe Ġsame . ĊĠĠĠ Ġverify ( ĊĠĠĠĠĠ Ġmock Current State LiveData Observer , ĊĠĠĠĠĠ Ġat Least Once () ĊĠĠĠ Ġ). on Changed ( currentState Result Captor . capture ()) ĊĠĠĠ ĠassertThat ( currentState Result Captor . value . is Success ()). isTrue () ĊĠĠĠ Ġval Ġcurrent State Ġ= Ġcurrent State Result Captor . value . get OrThrow () ĊĠĠĠ ĠassertThat ( currentState . state . name ). isEqualTo (" What Ġlanguage ") ĊĠĠĠ ĠassertThat ( currentState . state Type Case ). isEqualTo ( PENDING _ STATE ) ĊĠ Ġ} ĊĊĠ Ġ@ Test ĊĠ Ġfun Ġtest GetCurrent State _ after MoveNext And Previous _ returns Current State () Ġ{ ĊĠĠĠ Ġval Ġcurrent State LiveData Ġ= ĊĠĠĠĠĠ Ġexploration Progress Controller . getCurrent State (). to LiveData () ĊĠĠĠ Ġcurrent State LiveData . observe Fore ver ( mock Current State LiveData Observer ) ĊĠĠĠ Ġplay Ex ploration ( TEST _ EX PL OR ATION _ ID _ 0 ) ĊĠĠĠ Ġsubmit Multiple Choice Answer And MoveTo Next State ( 0 ) ĊĠĠĠ Ġsubmit TextInput Answer (" Fin nish ") Ġ// ĠSubmit Ġthe Ġanswer Ġbut Ġdo Ġnot Ġproceed Ġto Ġthe Ġnext Ġstate . ĊĊĠĠĠ Ġmove To Next State () ĊĠĠĠ Ġmove To Previous State () ĊĊĠĠĠ Ġ// ĠThe Ġcurrent Ġstate Ġshould Ġstay Ġthe Ġsame . ĊĠĠĠ Ġverify ( ĊĠĠĠĠĠ Ġmock Current State LiveData Observer , ĊĠĠĠĠĠ Ġat Least Once () ĊĠĠĠ Ġ). on Changed ( currentState Result Captor . capture ()) ĊĠĠĠ ĠassertThat ( currentState Result Captor . value . is Success ()). isTrue () ĊĠĠĠ Ġval Ġcurrent State Ġ= Ġcurrent State Result Captor . value . get OrThrow () ĊĠĠĠ ĠassertThat ( currentState . state . name ). isEqualTo (" What Ġlanguage ") ĊĠĠĠ ĠassertThat ( currentState . state Type Case ). isEqualTo ( COMPLETED _ STATE ) ĊĠ Ġ} ĊĊĠ Ġ@ Test ĊĠ Ġfun Ġtest GetCurrent State _ after MoveTo Prev _ on Third State _ new Observer _ re ceiv es Completed Second State () Ġ{ ĊĠĠĠ Ġsubscribe To Current State To Allow Ex ploration To Load () ĊĠĠĠ Ġplay Ex ploration ( TEST _ EX PL OR ATION _ ID _ 0 ) ĊĠĠĠ Ġsubmit Multiple Choice Answer And MoveTo Next State ( 0 ) Ġ// ĠFirst Ġstate Ġ-> Ġsecond ĊĠĠĠ Ġsubmit TextInput Answer And MoveTo Next State (" Fin nish ") Ġ// ĠSecond Ġstate Ġ-> Ġthird ĊĊĠĠĠ Ġ// ĠMove Ġto Ġthe Ġprevious Ġstate Ġand Ġregister Ġa Ġnew Ġobserver . ĊĠĠĠ Ġmove To Previous State () Ġ// ĠThird Ġstate Ġ-> Ġsecond ĊĠĠĠ Ġval Ġcurrent State LiveData Ġ= ĊĠĠĠĠĠ Ġexploration Progress Controller . getCurrent State (). to LiveData () ĊĠĠĠ Ġcurrent State LiveData . observe Fore ver ( mock Current State LiveData Observer 2 ) ĊĠĠĠ Ġtest Coroutine Dispatch ers . run Current () ĊĊĠĠĠ Ġ// ĠThe Ġnew Ġobserver Ġshould Ġobserve Ġthe Ġcompleted Ġsecond Ġstate Ġsince Ġit 's Ġthe Ġcurrent Ġpending Ġstate . ĊĠĠĠ Ġverify ( ĊĠĠĠĠĠ Ġmock Current State LiveData Observer 2 , ĊĠĠĠĠĠ Ġat Least Once () ĊĠĠĠ Ġ). on Changed ( currentState Result Captor . capture ()) ĊĠĠĠ ĠassertThat ( currentState Result Captor . value . is Success ()). isTrue () ĊĠĠĠ Ġval Ġcurrent State Ġ= Ġcurrent State Result Captor . value . get OrThrow () ĊĠĠĠ ĠassertThat ( currentState . state . name ). isEqualTo (" What Ġlanguage ") ĊĠĠĠ ĠassertThat ( currentState . state Type Case ). isEqualTo ( COMPLETED _ STATE ) ĊĠ Ġ} ĊĊĠ Ġ@ Test ĊĠ Ġfun Ġtest GetCurrent State _ for First State _ does Not Have Next State () Ġ{ ĊĠĠĠ Ġval Ġcurrent State LiveData Ġ= ĊĠĠĠĠĠ Ġexploration Progress Controller . getCurrent State (). to LiveData () ĊĠĠĠ Ġcurrent State LiveData . observe Fore ver ( mock Current State LiveData Observer ) ĊĊĠĠĠ Ġplay Ex ploration ( TEST _ EX PL OR ATION _ ID _ 0 ) ĊĊĠĠĠ Ġ// ĠThe Ġinitial Ġstate Ġshould Ġnot Ġhave Ġa Ġnext Ġstate . ĊĠĠĠ Ġverify ( ĊĠĠĠĠĠ Ġmock Current State LiveData Observer , ĊĠĠĠĠĠ Ġat Least Once () ĊĠĠĠ Ġ). on Changed ( currentState Result Captor . capture ()) ĊĠĠĠ ĠassertThat ( currentState Result Captor . value . is Success ()). isTrue () ĊĠĠĠ ĠassertThat ( currentState Result Captor . value . get OrThrow (). hasNext State ). isFalse () ĊĠ Ġ} ĊĊĠ Ġ@ Test ĊĠ Ġfun Ġtest GetCurrent State _ for First State _ after Answer Submission _ does Not Have Next State () Ġ{ ĊĠĠĠ Ġval Ġcurrent State LiveData Ġ= ĊĠĠĠĠĠ Ġexploration Progress Controller . getCurrent State (). to LiveData () ĊĠĠĠ Ġcurrent State LiveData . observe Fore ver ( mock Current State LiveData Observer ) ĊĠĠĠ Ġplay Ex ploration ( TEST _ EX PL OR ATION _ ID _ 0 ) ĊĊĠĠĠ Ġsubmit Multiple Choice Answer ( 0 ) ĊĊĠĠĠ Ġ// ĠSimply Ġcomplet ing Ġthe Ġcurrent Ġstate Ġshould Ġnot Ġresult Ġin Ġthere Ġbeing Ġa Ġnext Ġstate Ġsince Ġthe Ġuser Ġhasn 't Ġpro ceeded ĊĠĠĠ Ġ// Ġto Ġthe Ġfollowing Ġstate , Ġyet . ĊĠĠĠ Ġverify ( ĊĠĠĠĠĠ Ġmock Current State LiveData Observer , ĊĠĠĠĠĠ Ġat Least Once () ĊĠĠĠ Ġ). on Changed ( currentState Result Captor . capture ()) ĊĠĠĠ ĠassertThat ( currentState Result Captor . value . is Success ()). isTrue () ĊĠĠĠ ĠassertThat ( currentState Result Captor . value . get OrThrow (). hasNext State ). isFalse () ĊĠ Ġ} ĊĊĠ Ġ@ Test ĊĠ Ġfun Ġtest GetCurrent State _ for Second State _ does Not Have Next State () Ġ{ ĊĠĠĠ Ġval Ġcurrent State LiveData Ġ= ĊĠĠĠĠĠ Ġexploration Progress Controller . getCurrent State (). to LiveData () ĊĠĠĠ Ġcurrent State LiveData . observe Fore ver ( mock Current State LiveData Observer ) ĊĠĠĠ Ġplay Ex ploration ( TEST _ EX PL OR ATION _ ID _ 0 ) ĊĊĠĠĠ Ġsubmit Multiple Choice Answer And MoveTo Next State ( 0 ) ĊĊĠĠĠ Ġ// ĠThe Ġcurrent Ġstate Ġshould Ġhave Ġa Ġprevious Ġstate . ĊĠĠĠ Ġverify ( ĊĠĠĠĠĠ Ġmock Current State LiveData Observer , ĊĠĠĠĠĠ Ġat Least Once () ĊĠĠĠ Ġ). on Changed ( currentState Result Captor . capture ()) ĊĠĠĠ ĠassertThat ( currentState Result Captor . value . is Success ()). isTrue () ĊĠĠĠ ĠassertThat ( currentState Result Captor . value . get OrThrow (). hasNext State ). isFalse () ĊĠ Ġ} ĊĊĠ Ġ@ Test ĊĠ Ġfun Ġtest GetCurrent State _ for Second State _ navigate Backward _ hasNext State () Ġ{ ĊĠĠĠ Ġval Ġcurrent State LiveData Ġ= ĊĠĠĠĠĠ Ġexploration Progress Controller . getCurrent State (). to LiveData () ĊĠĠĠ Ġcurrent State LiveData . observe Fore ver ( mock Current State LiveData Observer ) ĊĠĠĠ Ġplay Ex ploration ( TEST _ EX PL OR ATION _ ID _ 0 ) ĊĠĠĠ Ġsubmit Multiple Choice Answer And MoveTo Next State ( 0 ) ĊĊĠĠĠ Ġmove To Previous State () ĊĊĠĠĠ Ġ// ĠThe Ġprevious Ġstate Ġshould Ġhave Ġa Ġnext Ġstate . ĊĠĠĠ Ġverify ( ĊĠĠĠĠĠ Ġmock Current State LiveData Observer , ĊĠĠĠĠĠ Ġat Least Once () ĊĠĠĠ Ġ). on Changed ( currentState Result Captor . capture ()) ĊĠĠĠ ĠassertThat ( currentState Result Captor . value . is Success ()). isTrue () ĊĠĠĠ ĠassertThat ( currentState Result Captor . value . get OrThrow (). hasNext State ). isTrue () ĊĠ Ġ} ĊĊĠ Ġ@ Test ĊĠ Ġfun Ġtest GetCurrent State _ for Second State _ navigate Backward Then Forward _ does Not Have Next State () Ġ{ ĊĠĠĠ Ġval Ġcurrent State LiveData Ġ= ĊĠĠĠĠĠ Ġexploration Progress Controller . getCurrent State (). to LiveData () ĊĠĠĠ Ġcurrent State LiveData . observe Fore ver ( mock Current State LiveData Observer ) ĊĠĠĠ Ġplay Ex ploration ( TEST _ EX PL OR ATION _ ID _ 0 ) ĊĠĠĠ Ġsubmit Multiple Choice Answer And MoveTo Next State ( 0 ) ĊĊĠĠĠ Ġmove To Previous State () ĊĠĠĠ Ġmove To Next State () ĊĊĠĠĠ Ġ// ĠIter ating Ġback Ġto Ġthe Ġcurrent Ġstate Ġshould Ġresult Ġin Ġno Ġlonger Ġhaving Ġa Ġnext Ġstate . ĊĠĠĠ Ġverify ( ĊĠĠĠĠĠ Ġmock Current State LiveData Observer , ĊĠĠĠĠĠ Ġat Least Once () ĊĠĠĠ Ġ). on Changed ( currentState Result Captor . capture ()) ĊĠĠĠ ĠassertThat ( currentState Result Captor . value . is Success ()). isTrue () ĊĠĠĠ ĠassertThat ( currentState Result Captor . value . get OrThrow (). hasNext State ). isFalse () ĊĠ Ġ} ĊĊĠ Ġ@ Test ĊĠ Ġfun Ġtest Submit Answer _ for Numeric Input _ correct Answer _ returns Outcome With Transition () Ġ{ ĊĠĠĠ Ġsubscribe To Current State To Allow Ex ploration To Load () ĊĠĠĠ Ġplay Ex ploration ( TEST _ EX PL OR ATION _ ID _ 0 ) ĊĠĠĠ Ġsubmit Multiple Choice Answer And MoveTo Next State ( 0 ) ĊĠĠĠ Ġsubmit TextInput Answer And MoveTo Next State (" Fin nish ") ĊĊĠĠĠ Ġval Ġresult Ġ= Ġexploration Progress Controller . submit Answer ( ĊĠĠĠĠĠ Ġcreate Numeric Input Answer ( 1 2 1 . 0 ) ĊĠĠĠ Ġ) ĊĠĠĠ Ġresult . observe Fore ver ( mock Async Answer Outcome Observer ) ĊĠĠĠ Ġtest Coroutine Dispatch ers . run Current () ĊĊĠĠĠ Ġ// ĠVerify Ġthat Ġthe Ġanswer Ġsubmission Ġwas Ġsuccessful . ĊĠĠĠ Ġverify ( ĊĠĠĠĠĠ Ġmock Async Answer Outcome Observer , ĊĠĠĠĠĠ Ġat Least Once () ĊĠĠĠ Ġ). on Changed ( async Answer Outcome Captor . capture ()) ĊĠĠĠ Ġval Ġanswer Outcome Ġ= Ġasync Answer Outcome Captor . value . get OrThrow () ĊĠĠĠ ĠassertThat ( answer Outcome . destination Case ). isEqualTo ( Answer Outcome . Destination Case . STATE _ NAME ) ĊĠĠĠ ĠassertThat ( answer Outcome . feedback . html ). contains (" Yes , Ġthat 's Ġcorrect : Ġ 1 1 Ġtimes Ġ 1 1 Ġis Ġ 1 2 1 .") ĊĠ Ġ} ĊĊĠ Ġ@ Test ĊĠ Ġfun Ġtest Submit Answer _ for Numeric Input _ wrong Answer _ returns Outcome With Transition () Ġ{ ĊĠĠĠ Ġsubscribe To Current State To Allow Ex ploration To Load () ĊĠĠĠ Ġplay Ex ploration ( TEST _ EX PL OR ATION _ ID _ 0 ) ĊĠĠĠ Ġsubmit Multiple Choice Answer And MoveTo Next State ( 0 ) ĊĠĠĠ Ġsubmit TextInput Answer And MoveTo Next State (" Fin nish ") ĊĊĠĠĠ Ġval Ġresult Ġ= Ġexploration Progress Controller . submit Answer ( ĊĠĠĠĠĠ Ġcreate Numeric Input Answer ( 1 2 2 . 0 ) ĊĠĠĠ Ġ) ĊĠĠĠ Ġresult . observe Fore ver ( mock Async Answer Outcome Observer ) ĊĠĠĠ Ġtest Coroutine Dispatch ers . run Current () ĊĊĠĠĠ Ġ// ĠVerify Ġthat Ġthe Ġanswer Ġsubmission Ġfailed Ġas Ġexpected . ĊĠĠĠ Ġverify ( ĊĠĠĠĠĠ Ġmock Async Answer Outcome Observer , ĊĠĠĠĠĠ Ġat Least Once () ĊĠĠĠ Ġ). on Changed ( async Answer Outcome Captor . capture ()) ĊĠĠĠ Ġval Ġanswer Outcome Ġ= Ġasync Answer Outcome Captor . value . get OrThrow () ĊĠĠĠ ĠassertThat ( answer Outcome . destination Case ). isEqualTo ( Answer Outcome . Destination Case . SAME _ STATE ) ĊĠĠĠ ĠassertThat ( answer Outcome . feedback . html ). contains (" You Ġare Ġactually Ġvery Ġclose .") ĊĠ Ġ} ĊĊĠ Ġ@ Test ĊĠ Ġfun Ġtest Submit Answer _ for Continue _ returns Outcome With Transition () Ġ{ ĊĠĠĠ Ġsubscribe To Current State To Allow Ex ploration To Load () ĊĠĠĠ Ġplay Ex ploration ( TEST _ EX PL OR ATION _ ID _ 0 ) ĊĠĠĠ Ġsubmit Multiple Choice Answer And MoveTo Next State ( 0 ) ĊĠĠĠ Ġsubmit TextInput Answer And MoveTo Next State (" Fin nish ") ĊĠĠĠ Ġsubmit Numeric Input Answer And MoveTo Next State ( 1 2 1 . 0 ) ĊĊĠĠĠ Ġval Ġresult Ġ= Ġexploration Progress Controller . submit Answer ( ĊĠĠĠĠĠ Ġcreate Continue Button Answer () ĊĠĠĠ Ġ) ĊĠĠĠ Ġresult . observe Fore ver ( mock Async Answer Outcome Observer ) ĊĠĠĠ Ġtest Coroutine Dispatch ers . run Current () ĊĊĠĠĠ Ġ// ĠVerify Ġthat Ġthe Ġcontinue Ġbutton Ġsucceeds Ġby Ġdefault . ĊĠĠĠ Ġverify ( ĊĠĠĠĠĠ Ġmock Async Answer Outcome Observer , ĊĠĠĠĠĠ Ġat Least Once () ĊĠĠĠ Ġ). on Changed ( async Answer Outcome Captor . capture ()) ĊĠĠĠ Ġval Ġanswer Outcome Ġ= Ġasync Answer Outcome Captor . value . get OrThrow () ĊĠĠĠ ĠassertThat ( answer Outcome . destination Case ). isEqualTo ( Answer Outcome . Destination Case . STATE _ NAME ) ĊĠĠĠ ĠassertThat ( answer Outcome . feedback . html ). isEmpty () ĊĠ Ġ} ĊĊĠ Ġ@ Test ĊĠ Ġfun Ġtest GetCurrent State _ f ifth State _ is Terminal State () Ġ{ ĊĠĠĠ Ġval Ġcurrent State LiveData Ġ= ĊĠĠĠĠĠ Ġexploration Progress Controller . getCurrent State (). to LiveData () ĊĠĠĠ Ġcurrent State LiveData . observe Fore ver ( mock Current State LiveData Observer ) ĊĠĠĠ Ġplay Ex ploration ( TEST _ EX PL OR ATION _ ID _ 0 ) ĊĠĠĠ Ġsubmit Multiple Choice Answer And MoveTo Next State ( 0 ) ĊĠĠĠ Ġsubmit TextInput Answer And MoveTo Next State (" Fin nish ") ĊĠĠĠ Ġsubmit Numeric Input Answer And MoveTo Next State ( 1 2 1 . 0 ) ĊĊĠĠĠ Ġsubmit Continue Button Answer And MoveTo Next State () ĊĊĠĠĠ Ġ// ĠVerify Ġthat Ġthe Ġf ifth Ġstate Ġis Ġterminal . ĊĠĠĠ Ġverify ( ĊĠĠĠĠĠ Ġmock Current State LiveData Observer , ĊĠĠĠĠĠ Ġat Least Once () ĊĠĠĠ Ġ). on Changed ( currentState Result Captor . capture ()) ĊĠĠĠ ĠassertThat ( currentState Result Captor . value . is Success ()). isTrue () ĊĠĠĠ Ġval Ġcurrent State Ġ= Ġcurrent State Result Captor . value . get OrThrow () ĊĠĠĠ ĠassertThat ( currentState . state Type Case ). isEqualTo ( TERMIN AL _ STATE ) ĊĠ Ġ} ĊĊĠ Ġ@ Test ĊĠ Ġfun Ġtest GetCurrent State _ after MoveTo Previous _ on Third State _ updates To Completed Second State () Ġ{ ĊĠĠĠ Ġval Ġcurrent State LiveData Ġ= ĊĠĠĠĠĠ Ġexploration Progress Controller . getCurrent State (). to LiveData () ĊĠĠĠ Ġcurrent State LiveData . observe Fore ver ( mock Current State LiveData Observer ) ĊĠĠĠ Ġplay Ex ploration ( TEST _ EX PL OR ATION _ ID _ 0 ) ĊĠĠĠ Ġsubmit Multiple Choice Answer And MoveTo Next State ( 0 ) ĊĠĠĠ Ġsubmit TextInput Answer And MoveTo Next State (" Fin nish ") ĊĊĠĠĠ Ġmove To Previous State () ĊĊĠĠĠ Ġ// ĠVerify Ġthat Ġthe Ġcurrent Ġstate Ġis Ġthe Ġsecond Ġstate , Ġand Ġis Ġcompleted . ĠIt Ġshould Ġalso Ġhave Ġthe Ġpreviously Ġsubmitted ĊĠĠĠ Ġ// Ġanswer , Ġallowing Ġlearn ers Ġto Ġpotentially Ġview Ġpast Ġanswers . ĊĠĠĠ Ġverify ( ĊĠĠĠĠĠ Ġmock Current State LiveData Observer , ĊĠĠĠĠĠ Ġat Least Once () ĊĠĠĠ Ġ). on Changed ( currentState Result Captor . capture ()) ĊĠĠĠ ĠassertThat ( currentState Result Captor . value . is Success ()). isTrue () ĊĠĠĠ Ġval Ġcurrent State Ġ= Ġcurrent State Result Captor . value . get OrThrow () ĊĠĠĠ ĠassertThat ( currentState . state Type Case ) ĊĠĠĠĠĠ Ġ. isEqualTo ( COMPLETED _ STATE ) ĊĠĠĠ ĠassertThat ( currentState . state . name ) ĊĠĠĠĠĠ Ġ. isEqualTo (" What Ġlanguage ") ĊĠĠĠ ĠassertThat ( currentState . completed State . get Answer ( 0 ). user Answer . answer . normalized String ) ĊĠĠĠĠĠ Ġ. isEqualTo (" Fin nish ") ĊĠ Ġ} ĊĊĠ Ġ@ Test ĊĠ Ġfun Ġtest MoveTo Next _ on Final State _ fails WithError () Ġ{ ĊĠĠĠ Ġsubscribe To Current State To Allow Ex ploration To Load () ĊĠĠĠ Ġplay Ex ploration ( TEST _ EX PL OR ATION _ ID _ 0 ) ĊĠĠĠ Ġsubmit Multiple Choice Answer And MoveTo Next State ( 0 ) ĊĠĠĠ Ġsubmit TextInput Answer And MoveTo Next State (" Fin nish ") ĊĠĠĠ Ġsubmit Numeric Input Answer And MoveTo Next State ( 1 2 1 . 0 ) ĊĠĠĠ Ġsubmit Continue Button Answer And MoveTo Next State () ĊĊĠĠĠ Ġval Ġmove To State Result Ġ= Ġexploration Progress Controller . moveTo Next State () ĊĠĠĠ Ġmove To State Result . observe Fore ver ( mock AsyncResult LiveData Observer ) ĊĠĠĠ Ġtest Coroutine Dispatch ers . run Current () ĊĊĠĠĠ Ġ// ĠVerify Ġwe Ġcan 't Ġnavigate Ġpast Ġthe Ġlast Ġstate Ġof Ġthe Ġexploration . ĊĠĠĠ Ġverify ( mock AsyncResult LiveData Observer , Ġat Least Once ()). on Changed ( async Result Captor . capture ()) ĊĠĠĠ ĠassertThat ( async Result Captor . value . is Failure ()). isTrue () ĊĠĠĠ ĠassertThat ( async Result Captor . value . getError OrNull ()) ĊĠĠĠĠĠ Ġ. has Message That () ĊĠĠĠĠĠ Ġ. contains (" Cannot Ġnavigate Ġto Ġnext Ġstate ; Ġat Ġmost Ġrecent Ġstate .") ĊĠ Ġ} ĊĊĠ Ġ@ Test ĊĠ Ġfun Ġtest GetCurrent State _ after Playing Full Second Ex ploration _ returns Terminal State () Ġ{ ĊĠĠĠ Ġval Ġcurrent State LiveData Ġ= ĊĠĠĠĠĠ Ġexploration Progress Controller . getCurrent State (). to LiveData () ĊĠĠĠ Ġcurrent State LiveData . observe Fore ver ( mock Current State LiveData Observer ) ĊĊĠĠĠ Ġplay Ex ploration ( TEST _ EX PL OR ATION _ ID _ 1 ) ĊĠĠĠ Ġsubmit Continue Button Answer And MoveTo Next State () ĊĠĠĠ Ġsubmit Multiple Choice Answer And MoveTo Next State ( 3 ) Ġ// ĠThose Ġwere Ġall Ġthe Ġquestions ĠI Ġhad ! ĊĠĠĠ Ġsubmit Continue Button Answer And MoveTo Next State () ĊĊĠĠĠ Ġ// ĠVerify Ġthat Ġwe 're Ġnow Ġon Ġthe Ġfinal Ġstate . ĊĠĠĠ Ġverify ( ĊĠĠĠĠĠ Ġmock Current State LiveData Observer , ĊĠĠĠĠĠ Ġat Least Once () ĊĠĠĠ Ġ). on Changed ( currentState Result Captor . capture ()) ĊĠĠĠ ĠassertThat ( currentState Result Captor . value . is Success ()). isTrue () ĊĠĠĠ Ġval Ġcurrent State Ġ= Ġcurrent State Result Captor . value . get OrThrow () ĊĠĠĠ ĠassertThat ( currentState . state Type Case ). isEqualTo ( TERMIN AL _ STATE ) ĊĠ Ġ} ĊĊĠ Ġ@ Test ĊĠ Ġfun Ġtest GetCurrent State _ after Playing Full Second Ex ploration _ diff Path _ returns Terminal State () Ġ{ ĊĠĠĠ Ġval Ġcurrent State LiveData Ġ= ĊĠĠĠĠĠ Ġexploration Progress Controller . getCurrent State (). to LiveData () ĊĠĠĠ Ġcurrent State LiveData . observe Fore ver ( mock Current State LiveData Observer ) ĊĊĠĠĠ Ġplay Ex ploration ( TEST _ EX PL OR ATION _ ID _ 1 ) ĊĠĠĠ Ġsubmit Continue Button Answer And MoveTo Next State () ĊĠĠĠ Ġsubmit Multiple Choice Answer And MoveTo Next State ( 0 ) Ġ// ĠHow Ġdo Ġyour Ġexplor ations Ġwork ? ĊĠĠĠ Ġsubmit TextInput Answer And MoveTo Next State (" Opp ia ĠO t ter ") Ġ// ĠCan ĠI Ġask Ġyour Ġname ? ĊĠĠĠ Ġsubmit Continue Button Answer And MoveTo Next State () ĊĠĠĠ Ġsubmit Multiple Choice Answer And MoveTo Next State ( 3 ) Ġ// ĠThose Ġwere Ġall Ġthe Ġquestions ĠI Ġhad ! ĊĠĠĠ Ġsubmit Continue Button Answer And MoveTo Next State () ĊĊĠĠĠ Ġ// ĠVerify Ġthat Ġa Ġdifferent Ġpath Ġcan Ġalso Ġresult Ġin Ġre aching Ġthe Ġend Ġstate . ĊĠĠĠ Ġverify ( ĊĠĠĠĠĠ Ġmock Current State LiveData Observer , ĊĠĠĠĠĠ Ġat Least Once () ĊĠĠĠ Ġ). on Changed ( currentState Result Captor . capture ()) ĊĠĠĠ ĠassertThat ( currentState Result Captor . value . is Success ()). isTrue () ĊĠĠĠ Ġval Ġcurrent State Ġ= Ġcurrent State Result Captor . value . get OrThrow () ĊĠĠĠ ĠassertThat ( currentState . state Type Case ). isEqualTo ( TERMIN AL _ STATE ) ĊĠ Ġ} ĊĊĠ Ġ@ Test ĊĠ Ġfun Ġtest GetCurrent State _ after Playing Through Previous Ex plor ations _ returns State From Second Exp () Ġ{ ĊĠĠĠ Ġval Ġcurrent State LiveData Ġ= ĊĠĠĠĠĠ Ġexploration Progress Controller . getCurrent State (). to LiveData () ĊĠĠĠ Ġcurrent State LiveData . observe Fore ver ( mock Current State LiveData Observer ) ĊĠĠĠ Ġplay Through Ex ploration 5 () ĊĊĠĠĠ Ġplay Ex ploration ( TEST _ EX PL OR ATION _ ID _ 1 ) ĊĠĠĠ Ġsubmit Continue Button Answer And MoveTo Next State () ĊĠĠĠ Ġ// ĠThose Ġwere Ġall Ġthe Ġquestions ĠI Ġhad ! ĊĠĠĠ Ġsubmit Multiple Choice Answer And MoveTo Next State ( 3 ) ĊĊĠĠĠ Ġ// ĠVerify Ġthat Ġwe 're Ġon Ġthe Ġsecond - to - last Ġstate Ġof Ġthe Ġsecond Ġexploration . ĊĠĠĠ Ġverify ( ĊĠĠĠĠĠ Ġmock Current State LiveData Observer , ĊĠĠĠĠĠ Ġat Least Once () ĊĠĠĠ Ġ). on Changed ( currentState Result Captor . capture ()) ĊĠĠĠ ĠassertThat ( currentState Result Captor . value . is Success ()). isTrue () ĊĠĠĠ Ġval Ġcurrent State Ġ= Ġcurrent State Result Captor . value . get OrThrow () ĊĠĠĠ ĠassertThat ( currentState . state Type Case ). isEqualTo ( PENDING _ STATE ) ĊĠĠĠ Ġ// ĠThis Ġstate Ġis Ġnot Ġin Ġthe Ġother Ġtest Ġexp . ĊĠĠĠ ĠassertThat ( currentState . state . name ). isEqualTo (" End ĠCard ") ĊĠ Ġ} ĊĊĠ Ġ@ Test ĊĠ Ġfun Ġtest MoveTo Next _ before Playing _ fails WithError _ logs Exception () Ġ{ ĊĠĠĠ Ġval Ġmove To State Result Ġ= ĊĠĠĠĠĠ Ġexploration Progress Controller . moveTo Next State () ĊĠĠĠ Ġmove To State Result . observe Fore ver ( mock AsyncResult LiveData Observer ) ĊĠĠĠ Ġval Ġexception Ġ= Ġfake Exception Logger . get Most Recent Exception () ĊĊĠĠĠ ĠassertThat ( exception ). isInstanceOf ( IllegalStateException :: class . java ) ĊĠĠĠ ĠassertThat ( exception ). has Message That () ĊĠĠĠĠĠ Ġ. contains (" Cannot Ġnavigate Ġto Ġa Ġnext Ġstate Ġif Ġan Ġexploration Ġis Ġnot Ġbeing Ġplayed .") ĊĠ Ġ} ĊĊĠ Ġ@ Test ĊĠ Ġfun Ġtest MoveTo Previous _ navig ated Forward Then Back To Initial _ fails WithError _ logs Exception () Ġ{ ĊĠĠĠ Ġsubscribe To Current State To Allow Ex ploration To Load () ĊĠĠĠ Ġplay Ex ploration ( TEST _ EX PL OR ATION _ ID _ 0 ) ĊĠĠĠ Ġsubmit Multiple Choice Answer And MoveTo Next State ( 0 ) ĊĠĠĠ Ġmove To Previous State () ĊĊĠĠĠ Ġval Ġmove To State Result Ġ= ĊĠĠĠĠĠ Ġexploration Progress Controller . moveTo Previous State () ĊĠĠĠ Ġmove To State Result . observe Fore ver ( mock AsyncResult LiveData Observer ) ĊĠĠĠ Ġtest Coroutine Dispatch ers . run Current () ĊĠĠĠ Ġval Ġexception Ġ= Ġfake Exception Logger . get Most Recent Exception () ĊĊĠĠĠ ĠassertThat ( exception ). isInstanceOf ( IllegalStateException :: class . java ) ĊĠĠĠ ĠassertThat ( exception ). has Message That () ĊĠĠĠĠĠ Ġ. contains (" Cannot Ġnavigate Ġto Ġprevious Ġstate ; Ġat Ġinitial Ġstate .") ĊĠ Ġ} ĊĊĠ Ġ@ Test ĊĠ Ġfun Ġtest Submit Answer _ before Playing _ fails WithError _ logs Exception () Ġ{ ĊĠĠĠ Ġval Ġresult Ġ= Ġexploration Progress Controller . submit Answer ( ĊĠĠĠĠĠ Ġcreate Multiple Choice Answer ( 0 ) ĊĠĠĠ Ġ) ĊĠĠĠ Ġresult . observe Fore ver ( mock Async Answer Outcome Observer ) ĊĠĠĠ Ġtest Coroutine Dispatch ers . run Current () ĊĠĠĠ Ġval Ġexception Ġ= Ġfake Exception Logger . get Most Recent Exception () ĊĊĠĠĠ ĠassertThat ( exception ). isInstanceOf ( IllegalStateException :: class . java ) ĊĠĠĠ ĠassertThat ( exception ). has Message That () ĊĠĠĠĠĠ Ġ. contains (" Cannot Ġsubmit Ġan Ġanswer Ġif Ġan Ġexploration Ġis Ġnot Ġbeing Ġplayed .") ĊĠ Ġ} ĊĊĠ Ġ@ Test ĊĠ Ġfun Ġtest GetCurrent State _ play Invalid Ex ploration _ returns Failure _ logs Exception () Ġ{ ĊĠĠĠ Ġval Ġcurrent State LiveData Ġ= ĊĠĠĠĠĠ Ġexploration Progress Controller . getCurrent State (). to LiveData () ĊĠĠĠ Ġcurrent State LiveData . observe Fore ver ( mock Current State LiveData Observer ) ĊĊĠĠĠ Ġplay Ex ploration (" invalid _ exp _ id ") ĊĠĠĠ Ġval Ġexception Ġ= Ġfake Exception Logger . get Most Recent Exception () ĊĊĠĠĠ ĠassertThat ( exception ). isInstanceOf ( FileNotFoundException :: class . java ) ĊĠĠĠ ĠassertThat ( exception ). has Message That (). contains (" invalid _ exp _ id . json ") ĊĠ Ġ} ĊĊĠ Ġprivate Ġfun Ġget Test Ex ploration 5 (): ĠEx ploration Ġ{ ĊĠĠĠ Ġreturn Ġexploration Retriever . load Ex ploration ( TEST _ EX PL OR ATION _ ID _ 0 ) ĊĠ Ġ} ĊĊĠ Ġprivate Ġfun Ġget Test Ex ploration 6 (): ĠEx ploration Ġ{ ĊĠĠĠ Ġreturn Ġexploration Retriever . load Ex ploration ( TEST _ EX PL OR ATION _ ID _ 1 ) ĊĠ Ġ} ĊĊĠ Ġprivate Ġfun ĠsetUp Test Application Component () Ġ{ ĊĠĠĠ ĠApplication Provider . getApplicationContext < Test Application >(). inject ( this ) ĊĠ Ġ} ĊĊĠ Ġ/** ĊĠĠ Ġ* ĠCreates Ġa Ġblank Ġsubscription Ġto Ġthe Ġcurrent Ġstate Ġto Ġensure Ġthat Ġrequests Ġto Ġload Ġthe Ġexploration Ġcomplete , ĊĠĠ Ġ* Ġotherwise Ġpost - load Ġoperations Ġmay Ġfail . ĠAn Ġobserver Ġis Ġrequired Ġsince Ġthe Ġcurrent Ġmedi ator Ġlive Ġdata ĊĠĠ Ġ* Ġimplementation Ġwill Ġonly Ġl az ily Ġload Ġdata Ġbased Ġon Ġwhether Ġthere 's Ġan Ġactive Ġsubscription . ĊĠĠ Ġ*/ ĊĠ Ġprivate Ġfun Ġsubscribe To Current State To Allow Ex ploration To Load () Ġ{ ĊĠĠĠ Ġexploration Progress Controller . getCurrent State () ĊĠĠĠĠĠ Ġ. to LiveData () ĊĠĠĠĠĠ Ġ. observe Fore ver ( mock Current State LiveData Observer ) ĊĠ Ġ} ĊĊĠ Ġprivate Ġfun Ġplay Ex ploration ( ex ploration Id : ĠString ) Ġ{ ĊĠĠĠ Ġexploration Data Controller . start Playing Ex ploration ( ex ploration Id ) ĊĠĠĠ Ġtest Coroutine Dispatch ers . run Current () ĊĠ Ġ} ĊĊĠ Ġprivate Ġfun Ġsubmit Multiple Choice Answer ( choice Index : ĠInt ) Ġ{ ĊĠĠĠ Ġexploration Progress Controller . submit Answer ( create Multiple Choice Answer ( choice Index )) ĊĠĠĠ Ġtest Coroutine Dispatch ers . run Current () ĊĠ Ġ} ĊĊĠ Ġprivate Ġfun Ġsubmit TextInput Answer ( text Answer : ĠString ) Ġ{ ĊĠĠĠ Ġexploration Progress Controller . submit Answer ( create TextInput Answer ( text Answer )) ĊĠĠĠ Ġtest Coroutine Dispatch ers . run Current () ĊĠ Ġ} ĊĊĠ Ġprivate Ġfun Ġsubmit Numeric Input Answer ( numeric Answer : ĠDouble ) Ġ{ ĊĠĠĠ Ġexploration Progress Controller . submit Answer ( create Numeric Input Answer ( numeric Answer )) ĊĠĠĠ Ġtest Coroutine Dispatch ers . run Current () ĊĠ Ġ} ĊĊĠ Ġprivate Ġfun Ġsubmit Continue Button Answer () Ġ{ ĊĠĠĠ Ġexploration Progress Controller . submit Answer ( create Continue Button Answer ()) ĊĠĠĠ Ġtest Coroutine Dispatch ers . run Current () ĊĠ Ġ} ĊĊĠ Ġprivate Ġfun Ġsubmit Multiple Choice Answer And MoveTo Next State ( choice Index : ĠInt ) Ġ{ ĊĠĠĠ Ġsubmit Multiple Choice Answer ( choice Index ) ĊĠĠĠ Ġmove To Next State () ĊĠ Ġ} ĊĊĠ Ġprivate Ġfun Ġsubmit TextInput Answer And MoveTo Next State ( text Answer : ĠString ) Ġ{ ĊĠĠĠ Ġsubmit TextInput Answer ( text Answer ) ĊĠĠĠ Ġmove To Next State () ĊĠ Ġ} ĊĊĠ Ġprivate Ġfun Ġsubmit Numeric Input Answer And MoveTo Next State ( numeric Answer : ĠDouble ) Ġ{ ĊĠĠĠ Ġsubmit Numeric Input Answer ( numeric Answer ) ĊĠĠĠ Ġmove To Next State () ĊĠ Ġ} ĊĊĠ Ġprivate Ġfun Ġsubmit Continue Button Answer And MoveTo Next State () Ġ{ ĊĠĠĠ Ġsubmit Continue Button Answer () ĊĠĠĠ Ġmove To Next State () ĊĠ Ġ} ĊĊĠ Ġprivate Ġfun Ġmove To Next State () Ġ{ ĊĠĠĠ Ġexploration Progress Controller . moveTo Next State () ĊĠĠĠ Ġtest Coroutine Dispatch ers . run Current () ĊĠ Ġ} ĊĊĠ Ġprivate Ġfun Ġmove To Previous State () Ġ{ ĊĠĠĠ Ġexploration Progress Controller . moveTo Previous State () ĊĠĠĠ Ġtest Coroutine Dispatch ers . run Current () ĊĠ Ġ} ĊĊĠ Ġprivate Ġfun Ġend Ex ploration () Ġ{ ĊĠĠĠ Ġexploration Data Controller . stop Playing Ex ploration () ĊĠĠĠ Ġtest Coroutine Dispatch ers . run Current () ĊĠ Ġ} ĊĊĠ Ġprivate Ġfun Ġplay Through Ex ploration 5 () Ġ{ ĊĠĠĠ Ġplay Ex ploration ( TEST _ EX PL OR ATION _ ID _ 0 ) ĊĠĠĠ Ġsubmit Multiple Choice Answer And MoveTo Next State ( 0 ) ĊĠĠĠ Ġsubmit TextInput Answer And MoveTo Next State (" Fin nish ") ĊĠĠĠ Ġsubmit Numeric Input Answer And MoveTo Next State ( 1 2 1 . 0 ) ĊĠĠĠ Ġsubmit Continue Button Answer And MoveTo Next State () ĊĠĠĠ Ġend Ex ploration () ĊĠ Ġ} ĊĊĠ Ġprivate Ġfun Ġcreate Multiple Choice Answer ( choice Index : ĠInt ): ĠUser Answer Ġ{ ĊĠĠĠ Ġreturn ĠconvertTo User Answer ( ĊĠĠĠĠĠ ĠInteraction Object . newBuilder (). set Non Negative Int ( choice Index ). build () ĊĠĠĠ Ġ) ĊĠ Ġ} ĊĊĠ Ġprivate Ġfun Ġcreate TextInput Answer ( text Answer : ĠString ): ĠUser Answer Ġ{ ĊĠĠĠ Ġval Ġanswer Ġ= ĠInteraction Object . newBuilder (). set Normalized String ( text Answer ) ĊĠĠĠĠĠ Ġ. build () ĊĠĠĠ Ġreturn ĠUser Answer . newBuilder (). set Answer ( answer ). set Plain Answer ( text Answer ). build () ĊĠ Ġ} ĊĊĠ Ġprivate Ġfun Ġcreate Numeric Input Answer ( numeric Answer : ĠDouble ): ĠUser Answer Ġ{ ĊĠĠĠ Ġreturn ĠconvertTo User Answer ( Interaction Object . newBuilder (). set Real ( numeric Answer ). build ()) ĊĠ Ġ} ĊĊĠ Ġprivate Ġfun ĠconvertTo User Answer ( answer : ĠInteraction Object ): ĠUser Answer Ġ{ ĊĠĠĠ Ġreturn ĠUser Answer . newBuilder (). set Answer ( answer ). set Plain Answer ( answer . to Answer String ()). build () ĊĠ Ġ} ĊĊĠ Ġprivate Ġfun Ġcreate Continue Button Answer () Ġ= ĊĠĠĠ Ġcreate TextInput Answer ( DEFAULT _ CONTINUE _ INTER ACTION _ TEXT _ AN SW ER ) ĊĊĠ Ġ// ĠTODO (# 8 9 ): ĠMove Ġthis Ġto Ġa Ġcommon Ġtest Ġapplication Ġcomponent . ĊĠ Ġ@ Module ĊĠ Ġclass ĠTest Module Ġ{ ĊĠĠĠ Ġ@ Provides ĊĠĠĠ Ġ@ Singleton ĊĠĠĠ Ġfun Ġprovide Context ( application : ĠApplication ): ĠContext Ġ{ ĊĠĠĠĠĠ Ġreturn Ġapplication ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Enable Console Log ĊĠĠĠ Ġ@ Provides ĊĠĠĠ Ġfun Ġprovide Enable Console Log (): ĠBoolean Ġ= Ġtrue ĊĊĠĠĠ Ġ@ Enable File Log ĊĠĠĠ Ġ@ Provides ĊĠĠĠ Ġfun Ġprovide Enable File Log (): ĠBoolean Ġ= Ġfalse ĊĊĠĠĠ Ġ@ Global LogLevel ĊĠĠĠ Ġ@ Provides ĊĠĠĠ Ġfun Ġprovide Global LogLevel (): ĠLogLevel Ġ= ĠLogLevel . VERBOSE ĊĊĠĠĠ Ġ@ Cache Assets Loc ally ĊĠĠĠ Ġ@ Provides ĊĠĠĠ Ġfun Ġprovide Cache Assets Loc ally (): ĠBoolean Ġ= Ġfalse ĊĊĠĠĠ Ġ@ Provides ĊĠĠĠ Ġ@ Topic List To Cache ĊĠĠĠ Ġfun Ġprovide Topic List To Cache (): ĠList < String > Ġ= ĠlistOf () ĊĊĠĠĠ Ġ@ Provides ĊĠĠĠ Ġ@ Load Lesson Protos From Assets ĊĠĠĠ Ġfun Ġprovide Load Lesson Protos From Assets (): ĠBoolean Ġ= Ġfalse ĊĠ Ġ} ĊĊĠ Ġ// ĠTODO (# 8 9 ): ĠMove Ġthis Ġto Ġa Ġcommon Ġtest Ġapplication Ġcomponent . ĊĠ Ġ@ Singleton ĊĠ Ġ@ Component ( ĊĠĠĠ Ġmodules Ġ= Ġ[ ĊĠĠĠĠĠ ĠTest Module :: class , ĠContinue Module :: class , ĠFraction Input Module :: class , ĊĠĠĠĠĠ ĠItem Selection Input Module :: class , ĠMultiple Choice Input Module :: class , ĊĠĠĠĠĠ ĠNumber With Units Rule Module :: class , ĠNumeric Input Rule Module :: class , ĠText Input Rule Module :: class , ĊĠĠĠĠĠ ĠDrag Drop Sort Input Module :: class , ĠInter actions Module :: class , ĠTest Log Reporting Module :: class , ĊĠĠĠĠĠ ĠImage Click Input Module :: class , ĠLog Storage Module :: class , ĠTest Dispatcher Module :: class , ĊĠĠĠĠĠ ĠR atio Input Module :: class , ĠRo bo lectric Module :: class , ĠFake Opp ia Clock Module :: class ĊĠĠĠ Ġ] ĊĠ Ġ) ĊĠ Ġinterface ĠTest Application Component Ġ: ĠData Providers Injector Ġ{ ĊĠĠĠ Ġ@ Component . Builder ĊĠĠĠ Ġinterface ĠBuilder Ġ{ ĊĠĠĠĠĠ Ġ@ Bind s Instance ĊĠĠĠĠĠ Ġfun Ġset Application ( application : ĠApplication ): ĠBuilder ĊĊĠĠĠĠĠ Ġfun Ġbuild (): ĠTest Application Component ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġfun Ġinject ( ex ploration Progress Controller Test : ĠEx ploration Progress Controller Test ) ĊĠ Ġ} ĊĊĠ Ġclass ĠTest Application Ġ: ĠApplication (), ĠData Providers Injector Provider Ġ{ ĊĠĠĠ Ġprivate Ġval Ġcomponent : ĠTest Application Component Ġby Ġlazy Ġ{ ĊĠĠĠĠĠ ĠD agger Ex ploration Progress Controller Test _ Test Application Component . builder () ĊĠĠĠĠĠĠĠ Ġ. set Application ( this ) ĊĠĠĠĠĠĠĠ Ġ. build () ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġfun Ġinject ( ex ploration Progress Controller Test : ĠEx ploration Progress Controller Test ) Ġ{ ĊĠĠĠĠĠ Ġcomponent . inject ( ex ploration Progress Controller Test ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġoverride Ġfun ĠgetData Providers Injector (): ĠData Providers Injector Ġ= Ġcomponent ĊĠ Ġ} Ċ } Ċ