package Ġcom . av ito . report Ċ Ċ import Ġcom . av ito . logger . Stub LoggerFactory Ċ import Ġcom . av ito . report . model . Get Report Result Ċ import Ġcom . av ito . report . model . Report Coordinates Ċ import Ġcom . av ito . test . http . Mock WebServer Factory Ċ import Ġcom . av ito . truth . Result Subject . Companion . assertThat Ċ import Ġcom . av ito . truth . isInstanceOf Ċ import Ġcom . av ito . utils . file From Jar Resources Ċ import Ġcom . github . sal om on br ys . kot son . jsonObject Ċ import Ġcom . google . common . truth . Truth . assertThat Ċ import Ġokhttp 3 . mock webserver . Mock Response Ċ import Ġorg . junit . jupiter . api . After Each Ċ import Ġorg . junit . jupiter . api . Test Ċ Ċ internal Ġclass ĠReports Api Test Ġ{ ĊĊĠĠĠ Ġprivate Ġval Ġmock WebServer Ġ= ĠMock WebServer Factory . create () ĊĊĠĠĠ Ġprivate Ġval Ġlogger Factory Ġ= ĠStub LoggerFactory ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġ` get Report Ġ- Ġreturns ĠNotFound Ġ- Ġwhen Ġthrows Ġexception Ġwith Ġno Ġdata `() Ġ{ ĊĠĠĠĠĠĠĠ Ġmock WebServer . enqueue ( ĊĠĠĠĠĠĠĠĠĠĠĠ ĠMock Response () ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ. set Response Code ( 5 0 0 ) ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ. set Body ( ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ"{\" jsonrpc \":\" 2 . 0 \ "," Ġ+ ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ"\" error \":{\" code \": - 3 2 6 0 3 ,\" message \":\" Internal Ġerror \",\" data \":\" not Ġfound \" }," Ġ+ ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ"\" id \": 1 }" ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ) ĊĠĠĠĠĠĠĠ Ġ) ĊĊĠĠĠĠĠĠĠ Ġval Ġresult Ġ= Ġcreate No Retries Reports Api (). get Report ( ĊĠĠĠĠĠĠĠĠĠĠĠ ĠReport Coordinates (" Av ito Android ", Ġ" Functional Tests ", Ġ" 1 2 3 4 5 ") ĊĠĠĠĠĠĠĠ Ġ) ĊĊĠĠĠĠĠĠĠ ĠassertThat ( result ). isInstanceOf < Get Report Result . NotFound >() ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġ` get Report Ġ- Ġreturns ĠError Ġ- Ġwhen Ġthrows Ġexception Ġwith Ġno Ġdata `() Ġ{ ĊĠĠĠĠĠĠĠ Ġmock WebServer . enqueue ( Mock Response (). set Response Code ( 5 0 0 )) ĊĊĠĠĠĠĠĠĠ Ġval Ġresult Ġ= Ġcreate No Retries Reports Api (). get Report ( ĊĠĠĠĠĠĠĠĠĠĠĠ ĠReport Coordinates (" Av ito Android ", Ġ" Functional Tests ", Ġ" 1 2 3 4 5 ") ĊĠĠĠĠĠĠĠ Ġ) ĊĊĠĠĠĠĠĠĠ ĠassertThat ( result ). isInstanceOf < Get Report Result . Error >() ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġ` get Report Ġ- Ġreturns ĠReport `() Ġ{ ĊĠĠĠĠĠĠĠ Ġmock WebServer . enqueue ( ĊĠĠĠĠĠĠĠĠĠĠĠ ĠMock Response () ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ. set Body ( file From Jar Resources < Reports Api Test >(" get Report . json "). read Text ()) ĊĠĠĠĠĠĠĠ Ġ) ĊĊĠĠĠĠĠĠĠ Ġval Ġresult Ġ= Ġcreate No Retries Reports Api (). get Report ( Report Coordinates (" Av ito Android ", Ġ" Functional Tests ", Ġ"")) ĊĊĠĠĠĠĠĠĠ ĠassertThat ( result ). isInstanceOf < Get Report Result . Found >() ĊĊĠĠĠĠĠĠĠ Ġ( result Ġas ĠGet Report Result . Found ). report . run Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ// Ġsee Ġjson ĊĠĠĠĠĠĠĠĠĠĠĠ ĠassertThat ( id ). isEqualTo (" 5 c 8 0 3 2 d 5 cc df 7 8 0 0 0 1 c 4 9 5 7 6 ") ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġ` get Tests For Run Id Ġ- Ġreturns Ġok `() Ġ{ ĊĠĠĠĠĠĠĠ Ġmock WebServer . enqueue ( ĊĠĠĠĠĠĠĠĠĠĠĠ ĠMock Response (). set Body ( file From Jar Resources < Reports Api Test >(" get Report . json "). read Text ()) ĊĠĠĠĠĠĠĠ Ġ) ĊĠĠĠĠĠĠĠ Ġmock WebServer . enqueue ( ĊĠĠĠĠĠĠĠĠĠĠĠ ĠMock Response (). set Body ( file From Jar Resources < Reports Api Test >(" get Tests For Run Id . json "). read Text ()) ĊĠĠĠĠĠĠĠ Ġ) ĊĊĠĠĠĠĠĠĠ Ġval Ġresult Ġ= Ġcreate No Retries Reports Api (). get Tests For Run Id ( ĊĠĠĠĠĠĠĠĠĠĠĠ ĠReport Coordinates (" Av ito Android ", Ġ" Functional Tests ", Ġ"") ĊĠĠĠĠĠĠĠ Ġ) ĊĊĠĠĠĠĠĠĠ ĠassertThat ( result ). is Success () ĊĊĠĠĠĠĠĠĠ ĠassertThat ( ĊĠĠĠĠĠĠĠĠĠĠĠ Ġresult . get OrThrow (). first (). name ĊĠĠĠĠĠĠĠ Ġ). isEqualTo (" ru . dom of ond . features . Remote Toggle Monitor Test . check _ remote _ toggle ") ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġ` push Prepared Data Ġ- Ġreturns Ġok `() Ġ{ ĊĠĠĠĠĠĠĠ Ġmock WebServer . enqueue ( ĊĠĠĠĠĠĠĠĠĠĠĠ ĠMock Response (). set Body ( file From Jar Resources < Reports Api Test >(" push Prepared Data . json "). read Text ()) ĊĠĠĠĠĠĠĠ Ġ) ĊĊĠĠĠĠĠĠĠ Ġval Ġresult Ġ= Ġcreate No Retries Reports Api (). push Prepared Data (" any ", Ġ" any ", ĠjsonObject (" any " Ġto Ġ" any ")) ĊĊĠĠĠĠĠĠĠ ĠassertThat ( result ). is Success () ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ After Each ĊĠĠĠ Ġfun Ġteardown () Ġ{ ĊĠĠĠĠĠĠĠ Ġmock WebServer . shutdown () ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġprivate Ġfun Ġcreate No Retries Reports Api (): ĠReports Api Ġ= ĠReports Api Factory . create ( ĊĠĠĠĠĠĠĠ Ġhost Ġ= Ġmock WebServer . url ("/ "). toString (), ĊĠĠĠĠĠĠĠ Ġlogger Factory Ġ= Ġlogger Factory , ĊĠĠĠĠĠĠĠ Ġretry Interceptor Ġ= Ġnull ĊĠĠĠ Ġ) Ċ } Ċ