package Ġorg . opp ia . android . domain . ex ploration Ċ Ċ import Ġandroid . app . Application Ċ import Ġandroid . content . Context Ċ 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 . Test Ċ import Ġorg . junit . runner . RunWith Ċ import Ġorg . opp ia . android . app . model . Ex ploration Checkpoint Ċ import Ġorg . opp ia . android . domain . classify . Interactions Module Ċ import Ġorg . opp ia . android . domain . classify . rules . algebra ic expression input . Algebra ic Expression Input 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 . mat he quation input . Math Equation 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 expression input . Numeric Expression Input 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 . ex ploration . light weight checkpoint ing . Ex ploration Storage Database Size Ċ import Ġorg . opp ia . android . domain . hint sand solution . Hints And Solution Config Module Ċ import Ġorg . opp ia . android . domain . hint sand solution . Hints And Solution Prod Module Ċ import Ġorg . opp ia . android . domain . opp ialog ger . Log Storage Module Ċ import Ġorg . opp ia . android . domain . topic . FR ACTION S _ EX PL OR ATION _ ID _ 0 Ċ import Ġorg . opp ia . android . domain . topic . FR ACTION S _ EX PL OR ATION _ ID _ 1 Ċ import Ġorg . opp ia . android . domain . topic . RAT IOS _ EX PL OR ATION _ ID _ 0 Ċ import Ġorg . opp ia . android . domain . topic . RAT IOS _ EX PL OR ATION _ ID _ 1 Ċ import Ġorg . opp ia . android . domain . topic . RAT IOS _ EX PL OR ATION _ ID _ 2 Ċ import Ġorg . opp ia . android . domain . topic . RAT IOS _ EX PL OR ATION _ ID _ 3 Ċ import Ġorg . opp ia . android . domain . topic . TEST _ EX PL OR ATION _ ID _ 2 Ċ import Ġorg . opp ia . android . domain . topic . TEST _ EX PL OR ATION _ ID _ 4 Ċ import Ġorg . opp ia . android . domain . topic . TEST _ ST ORY _ ID _ 0 Ċ import Ġorg . opp ia . android . domain . topic . TEST _ ST ORY _ ID _ 2 Ċ import Ġorg . opp ia . android . domain . topic . TEST _ TOPIC _ ID _ 0 Ċ import Ġorg . opp ia . android . domain . topic . TEST _ TOPIC _ ID _ 1 Ċ 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 . data . DataProvider Test Monitor Ċ import Ġorg . opp ia . android . testing . environment . Test Environment Config Ċ import Ġorg . opp ia . android . testing . light weight checkpoint ing . Ex ploration Checkpoint TestHelper Ċ 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 . Asset 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 . Data Providers Injector Ċ import Ġorg . opp ia . android . util . data . Data Providers Injector Provider Ċ import Ġorg . opp ia . android . util . locale . Locale Prod Module Ċ 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 . opp ia . android . util . networking . Network Connection Util Debug Module Ċ import Ġorg . ro bo lectric . annotation . Config Ċ import Ġorg . ro bo lectric . annotation . Looper Mode Ċ import Ġjavax . inject . Inject Ċ import Ġjavax . inject . Singleton Ċ Ċ /** ĠTests Ġfor Ġ[ Ex ploration Data Controller ]. Ġ*/ Ċ // ĠFunction Ġname : Ġtest Ġnames Ġare Ġconvention ally Ġnamed Ġwith Ġunders cores . Ċ @ Suppress (" FunctionName ") Ċ @ RunWith ( Android JUnit 4 :: class ) Ċ @ Looper Mode ( Looper Mode . Mode . PA USED ) Ċ @ Config ( application Ġ= ĠEx ploration Data Controller Test . Test Application :: class ) Ċ class ĠEx ploration Data Controller Test Ġ{ ĊĠ Ġ@ Inject Ġlateinit Ġvar Ġexploration Data Controller : ĠEx ploration Data Controller ĊĠ Ġ@ Inject Ġlateinit Ġvar Ġfake Exception Logger : ĠFake Exception Logger ĊĠ Ġ@ Inject Ġlateinit Ġvar Ġtest Coroutine Dispatch ers : ĠTest Coroutine Dispatch ers ĊĠ Ġ@ Inject Ġlateinit Ġvar Ġmonitor Factory : ĠData Provider Test Monitor . Factory ĊĊĠ Ġprivate Ġval Ġinternal Profile Id : ĠInt Ġ= Ġ- 1 ĊĊĠ Ġ@ Before ĊĠ Ġfun ĠsetUp () Ġ{ ĊĠĠĠ ĠsetUp Test Application Component () ĊĠ Ġ} ĊĊĠ Ġprivate Ġfun ĠsetUp Test Application Component () Ġ{ ĊĠĠĠ ĠApplication Provider . getApplicationContext < Test Application >(). inject ( this ) ĊĠ Ġ} ĊĊĠ Ġ@ Test ĊĠ Ġfun Ġtest Controller _ provides InitialState For Fr actions 0 Ex ploration () Ġ{ ĊĠĠĠ Ġval Ġexploration Result Ġ= Ġexploration Data Controller . get Ex ploration ById ( FR ACTION S _ EX PL OR ATION _ ID _ 0 ) ĊĊĠĠĠ Ġval Ġexploration Ġ= Ġmonitor Factory . waitFor Next Successful Result ( ex ploration Result ) ĊĠĠĠ ĠassertThat ( ex ploration . title ). isEqualTo (" What Ġis Ġa ĠFraction ?") ĊĠĠĠ ĠassertThat ( ex ploration . language Code ). isEqualTo (" en ") ĊĠĠĠ ĠassertThat ( ex ploration . states Count ). isEqualTo ( 2 5 ) ĊĠ Ġ} ĊĊĠ Ġ@ Test ĊĠ Ġfun Ġtest Controller _ provides InitialState For Fr actions 1 Ex ploration () Ġ{ ĊĠĠĠ Ġval Ġexploration Result Ġ= Ġexploration Data Controller . get Ex ploration ById ( FR ACTION S _ EX PL OR ATION _ ID _ 1 ) ĊĊĠĠĠ Ġval Ġexploration Ġ= Ġmonitor Factory . waitFor Next Successful Result ( ex ploration Result ) ĊĠĠĠ ĠassertThat ( ex ploration . title ). isEqualTo (" The ĠMean ing Ġof Ġ\" Equal ĠPart s \" ") ĊĠĠĠ ĠassertThat ( ex ploration . language Code ). isEqualTo (" en ") ĊĠĠĠ ĠassertThat ( ex ploration . states Count ). isEqualTo ( 1 8 ) ĊĠ Ġ} ĊĊĠ Ġ@ Test ĊĠ Ġfun Ġtest Controller _ provides InitialState For Rat ios 0 Ex ploration () Ġ{ ĊĠĠĠ Ġval Ġexploration Result Ġ= Ġexploration Data Controller . get Ex ploration ById ( RAT IOS _ EX PL OR ATION _ ID _ 0 ) ĊĊĠĠĠ Ġval Ġexploration Ġ= Ġmonitor Factory . waitFor Next Successful Result ( ex ploration Result ) ĊĠĠĠ ĠassertThat ( ex ploration . title ). isEqualTo (" What Ġis Ġa ĠR atio ?") ĊĠĠĠ ĠassertThat ( ex ploration . language Code ). isEqualTo (" en ") ĊĠĠĠ ĠassertThat ( ex ploration . states Count ). isEqualTo ( 2 6 ) ĊĠ Ġ} ĊĊĠ Ġ@ Test ĊĠ Ġfun Ġtest Controller _ provides InitialState For Rat ios 1 Ex ploration () Ġ{ ĊĠĠĠ Ġval Ġexploration Result Ġ= Ġexploration Data Controller . get Ex ploration ById ( RAT IOS _ EX PL OR ATION _ ID _ 1 ) ĊĊĠĠĠ Ġval Ġexploration Ġ= Ġmonitor Factory . waitFor Next Successful Result ( ex ploration Result ) ĊĠĠĠ ĠassertThat ( ex ploration . title ). isEqualTo (" Order Ġis ĠImport ant ") ĊĠĠĠ ĠassertThat ( ex ploration . language Code ). isEqualTo (" en ") ĊĠĠĠ ĠassertThat ( ex ploration . states Count ). isEqualTo ( 2 2 ) ĊĠ Ġ} ĊĊĠ Ġ@ Test ĊĠ Ġfun Ġtest Controller _ provides InitialState For Rat ios 2 Ex ploration () Ġ{ ĊĠĠĠ Ġval Ġexploration Result Ġ= Ġexploration Data Controller . get Ex ploration ById ( RAT IOS _ EX PL OR ATION _ ID _ 2 ) ĊĊĠĠĠ Ġval Ġexploration Ġ= Ġmonitor Factory . waitFor Next Successful Result ( ex ploration Result ) ĊĠĠĠ ĠassertThat ( ex ploration . title ). isEqualTo (" Equivalent ĠR at ios ") ĊĠĠĠ ĠassertThat ( ex ploration . language Code ). isEqualTo (" en ") ĊĠĠĠ ĠassertThat ( ex ploration . states Count ). isEqualTo ( 2 4 ) ĊĠ Ġ} ĊĊĠ Ġ@ Test ĊĠ Ġfun Ġtest Controller _ provides InitialState For Rat ios 3 Ex ploration () Ġ{ ĊĠĠĠ Ġval Ġexploration Result Ġ= Ġexploration Data Controller . get Ex ploration ById ( RAT IOS _ EX PL OR ATION _ ID _ 3 ) ĊĊĠĠĠ Ġval Ġexploration Ġ= Ġmonitor Factory . waitFor Next Successful Result ( ex ploration Result ) ĊĠĠĠ ĠassertThat ( ex ploration . title ). isEqualTo (" Writing ĠR at ios Ġin ĠSimple st ĠForm ") ĊĠĠĠ ĠassertThat ( ex ploration . language Code ). isEqualTo (" en ") ĊĠĠĠ ĠassertThat ( ex ploration . states Count ). isEqualTo ( 2 1 ) ĊĠ Ġ} ĊĊĠ Ġ@ Test ĊĠ Ġfun Ġtest Controller _ returns Failed For Non Ex istent Ex ploration () Ġ{ ĊĠĠĠ Ġval Ġexploration Result Ġ= Ġexploration Data Controller . get Ex ploration ById (" NON _ EXIST ENT _ TEST ") ĊĊĠĠĠ Ġmonitor Factory . waitFor Next Failure Result ( ex ploration Result ) ĊĠĠĠ Ġval Ġexception Ġ= Ġfake Exception Logger . get Most Recent Exception () ĊĠĠĠ ĠassertThat ( exception ). isInstanceOf ( IllegalStateException :: class . java ) ĊĠĠĠ ĠassertThat ( exception ). has Message That (). contains (" Asset Ġdoesn 't Ġexist : ĠNON _ EXIST ENT _ TEST ") ĊĠ Ġ} ĊĊĠ Ġ@ Test ĊĠ Ġfun Ġtest Controller _ returns Failed _ logs Exception () Ġ{ ĊĠĠĠ Ġval Ġexploration Result Ġ= Ġexploration Data Controller . get Ex ploration ById (" NON _ EXIST ENT _ TEST ") ĊĊĠĠĠ Ġmonitor Factory . waitFor Next Failure Result ( ex ploration Result ) ĊĠĠĠ Ġval Ġexception Ġ= Ġfake Exception Logger . get Most Recent Exception () ĊĠĠĠ ĠassertThat ( exception ). isInstanceOf ( IllegalStateException :: class . java ) ĊĠĠĠ ĠassertThat ( exception ). has Message That (). contains (" Asset Ġdoesn 't Ġexist : ĠNON _ EXIST ENT _ TEST ") ĊĠ Ġ} ĊĊĠ Ġ@ Test ĊĠ Ġfun Ġtest Stop Playing Ex ploration _ without Starting Session _ returns Failure () Ġ{ ĊĠĠĠ Ġval Ġresult Provider Ġ= Ġexploration Data Controller . stop Playing Ex ploration () ĊĊĠĠĠ Ġval Ġresult Ġ= Ġmonitor Factory . waitFor Next Failure Result ( result Provider ) ĊĠĠĠ ĠassertThat ( result ). isInstanceOf ( java . lang . IllegalStateException :: class . java ) ĊĠĠĠ ĠassertThat ( result ). has Message That (). contains (" Session Ġisn 't Ġinitialized Ġyet .") ĊĠ Ġ} ĊĊĠ Ġ@ Test ĊĠ Ġfun Ġtest Start Playing Ex ploration _ without Stopping Session _ suc ceeds () Ġ{ ĊĠĠĠ Ġexploration Data Controller . start Playing Ex ploration ( ĊĠĠĠĠĠ Ġinternal Profile Id , ĊĠĠĠĠĠ ĠTEST _ TOPIC _ ID _ 0 , ĊĠĠĠĠĠ ĠTEST _ ST ORY _ ID _ 0 , ĊĠĠĠĠĠ ĠTEST _ EX PL OR ATION _ ID _ 2 , ĊĠĠĠĠĠ Ġshould Save Partial Progress Ġ= Ġfalse , ĊĠĠĠĠĠ Ġexploration Checkpoint Ġ= ĠEx ploration Checkpoint . getDefaultInstance () ĊĠĠĠ Ġ) ĊĊĠĠĠ Ġval Ġdata Provider Ġ= Ġexploration Data Controller . start Playing Ex ploration ( ĊĠĠĠĠĠ Ġinternal Profile Id , ĊĠĠĠĠĠ ĠTEST _ TOPIC _ ID _ 1 , ĊĠĠĠĠĠ ĠTEST _ ST ORY _ ID _ 2 , ĊĠĠĠĠĠ ĠTEST _ EX PL OR ATION _ ID _ 4 , ĊĠĠĠĠĠ Ġshould Save Partial Progress Ġ= Ġfalse , ĊĠĠĠĠĠ Ġexploration Checkpoint Ġ= ĠEx ploration Checkpoint . getDefaultInstance () ĊĠĠĠ Ġ) ĊĊĠĠĠ Ġ// ĠThe Ġnew Ġsession Ġover writes Ġthe Ġprevious . ĊĠĠĠ Ġmonitor Factory . waitFor Next Successful Result ( dataProvider ) ĊĠ Ġ} ĊĊĠ Ġ// Ġ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 ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ// ĠTODO (# 5 9 ): ĠEither Ġisolate Ġthese Ġto Ġtheir Ġown Ġshared Ġtest Ġmodule , Ġor Ġuse Ġthe Ġreal Ġlogging ĊĠĠĠ Ġ// Ġmodule Ġin Ġtests Ġto Ġavoid Ġneeding Ġto Ġspecify Ġthese Ġsettings Ġfor Ġtests . ĊĠĠĠ Ġ@ 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 ( test Environment Config : ĠTest Environment Config ): ĠBoolean Ġ= ĊĠĠĠĠĠ Ġtest Environment Config . is Using B azel () ĊĠ Ġ} ĊĊĠ Ġ@ Module ĊĠ Ġclass ĠTest Ex ploration Storage Module Ġ{ ĊĊĠĠĠ Ġ/** ĊĠĠĠĠ Ġ* ĠProvides Ġthe Ġsize Ġallocated Ġto Ġexploration Ġcheckpoint Ġdatabase . ĊĠĠĠĠ Ġ* ĊĠĠĠĠ Ġ* ĠFor Ġtesting , Ġthe Ġcurrent Ġ[ Ex ploration Storage Database Size ] Ġis Ġset Ġto Ġbe Ġ 1 5 0 ĠBytes . ĊĠĠĠĠ Ġ* ĊĠĠĠĠ Ġ* ĠThe Ġsize Ġlimit Ġis Ġset Ġso Ġthat Ġafter Ġthe Ġtwo Ġfake Ġcheck points Ġare Ġsaved Ġwith ĊĠĠĠĠ Ġ* Ġ[ Ex ploration Checkpoint TestHelper ], Ġthe Ġsize Ġof Ġthe Ġexploration Ġcheckpoint Ġdatabase Ġwill ĊĠĠĠĠ Ġ* Ġexceed Ġonce Ġthe Ġexploration Ġwith Ġ[ TEST _ EX PL OR ATION _ ID _ 2 ] Ġis Ġsaved Ġafter Ġit Ġhas Ġbeen Ġloaded . ĊĠĠĠĠ Ġ*/ ĊĠĠĠ Ġ@ Provides ĊĠĠĠ Ġ@ Ex ploration Storage Database Size ĊĠĠĠ Ġfun Ġprovide Ex ploration Storage Database Size (): ĠInt Ġ= Ġ 1 5 0 ĊĠ Ġ} ĊĊĠ Ġ// Ġ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 , ĊĠĠĠĠĠ ĠTest Ex ploration Storage Module :: class , ĠH ints And Solution Config Module :: class , ĊĠĠĠĠĠ ĠH ints And Solution Prod Module :: class , ĠNetwork Connection Util Debug Module :: class , ĊĠĠĠĠĠ ĠAsset Module :: class , ĠLocale Prod Module :: class , ĠNumeric Expression Input Module :: class , ĊĠĠĠĠĠ ĠAl gebra ic Expression Input Module :: class , ĠMath Equation Input 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 Data Controller Test : ĠEx ploration Data Controller Test ) ĊĠ Ġ} ĊĊĠ Ġclass ĠTest Application Ġ: ĠApplication (), ĠData Providers Injector Provider Ġ{ ĊĠĠĠ Ġprivate Ġval Ġcomponent : ĠTest Application Component Ġby Ġlazy Ġ{ ĊĠĠĠĠĠ ĠD agger Ex ploration Data Controller Test _ Test Application Component . builder () ĊĠĠĠĠĠĠĠ Ġ. set Application ( this ) ĊĠĠĠĠĠĠĠ Ġ. build () ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġfun Ġinject ( ex ploration Data Controller Test : ĠEx ploration Data Controller Test ) Ġ{ ĊĠĠĠĠĠ Ġcomponent . inject ( ex ploration Data Controller Test ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġoverride Ġfun ĠgetData Providers Injector (): ĠData Providers Injector Ġ= Ġcomponent ĊĠ Ġ} Ċ } Ċ