package Ġio . github . w ulkan owy . api . service Ċ Ċ import Ġio . github . w ulkan owy . api . Api Ċ import Ġio . github . w ulkan owy . api . ApiException Ċ import Ġio . github . w ulkan owy . api . Base Test Ċ import Ġio . github . w ulkan owy . api . Ok HttpClient BuilderFactory Ċ import Ġio . github . w ulkan owy . api . interceptor . Error Interceptor Test Ċ import Ġio . github . w ulkan owy . api . login . Login Test Ċ import Ġio . github . w ulkan owy . api . notes . Notes Response Ċ import Ġio . github . w ulkan owy . api . notes . Notes Test Ċ import Ġio . github . w ulkan owy . api . register . Student Ċ import Ġio . reactivex . ob servers . Test Observer Ċ import Ġokhttp 3 . Interceptor Ċ import Ġokhttp 3 . logging . Http Logging Interceptor Ċ import Ġokhttp 3 . mock webserver . Mock Response Ċ import Ġokhttp 3 . mock webserver . Mock WebServer Ċ import Ġorg . junit . After Ċ import Ġorg . junit . Assert . assertEquals Ċ import Ġorg . junit . Before Ċ import Ġorg . junit . Test Ċ import Ġjava . io . IOException Ċ import Ġjava . net . URL Ċ Ċ class ĠService Manager Test Ġ: ĠBaseTest () Ġ{ ĊĊĠĠĠ Ġlateinit Ġvar Ġserver : ĠMock WebServer ĊĊĠĠĠ Ġ@ Before ĊĠĠĠ Ġfun ĠsetUp () Ġ{ ĊĠĠĠĠĠĠĠ Ġserver Ġ= ĠMock WebServer () ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ After ĊĠĠĠ Ġfun Ġshut Down () Ġ{ ĊĠĠĠĠĠĠĠ Ġserver . shutdown () ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġinterceptor Test () Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġmanager Ġ= ĠService Manager ( Ok HttpClient BuilderFactory (), ĠHttp Logging Interceptor . Level . NONE , ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ ĠApi . Login Type . STANDARD , Ġ" http ", Ġ" fake log . localhost : 3 0 0 0 ", Ġ" default ", Ġ" email ", Ġ" password ", ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ" school Symbol ", Ġ 1 2 3 , Ġ 1 0 1 , Ġ"", Ġ"" ĊĠĠĠĠĠĠĠ Ġ) ĊĠĠĠĠĠĠĠ Ġmanager . set Interceptor ( Interceptor Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġthrow ĠApiException (" Test ") ĊĠĠĠĠĠĠĠ Ġ}) ĊĊĠĠĠĠĠĠĠ Ġval Ġnotes Ġ= Ġmanager . getS np Service (). get Notes () ĊĠĠĠĠĠĠĠ Ġval Ġobserver Ġ= ĠTest Observer < Notes Response >() ĊĠĠĠĠĠĠĠ Ġnotes . subscribe ( observer ) ĊĠĠĠĠĠĠĠ Ġobserver . assert Terminated () ĊĠĠĠĠĠĠĠ Ġobserver . assertNot Complete () ĊĠĠĠĠĠĠĠ Ġobserver . assert Error ( ApiException :: class . java ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġinterceptor Test _ prepend () Ġ{ ĊĠĠĠĠĠĠĠ Ġserver . enqueue ( Mock Response (). set Body ( Notes Test :: class . java . getResource (" Uw agi O si agn iec ia - filled . html "). read Text ())) ĊĠĠĠĠĠĠĠ Ġserver . start ( 3 0 0 0 ) ĊĠĠĠĠĠĠĠ Ġval Ġmanager Ġ= ĠService Manager ( Ok HttpClient BuilderFactory (), ĠHttp Logging Interceptor . Level . NONE , ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ ĠApi . Login Type . STANDARD , Ġ" http ", Ġ" fake log . localhost : 3 0 0 0 ", Ġ" default ", Ġ" email ", Ġ" password ", ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ" school Symbol ", Ġ 1 2 3 , Ġ 1 0 1 , Ġ"", Ġ"" ĊĠĠĠĠĠĠĠ Ġ) ĊĠĠĠĠĠĠĠ Ġmanager . set Interceptor ( Interceptor Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġthrow ĠIOException (" Test ") ĊĠĠĠĠĠĠĠ Ġ}) ĊĠĠĠĠĠĠĠ Ġmanager . set Interceptor ( Interceptor Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġthrow ĠApiException (" Test ") ĊĠĠĠĠĠĠĠ Ġ}, Ġfalse , Ġ 0 ) ĊĊĠĠĠĠĠĠĠ Ġval Ġnotes Ġ= Ġmanager . getS np Service (). get Notes () ĊĠĠĠĠĠĠĠ Ġval Ġobserver Ġ= ĠTest Observer < Notes Response >() ĊĠĠĠĠĠĠĠ Ġnotes . subscribe ( observer ) ĊĠĠĠĠĠĠĠ Ġobserver . assert Terminated () ĊĠĠĠĠĠĠĠ Ġobserver . assertNot Complete () ĊĠĠĠĠĠĠĠ Ġobserver . assert Error ( ApiException :: class . java ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġapi Normalized Symbol _ blank () Ġ{ ĊĠĠĠĠĠĠĠ Ġserver . enqueue ( Mock Response (). set Body ( Login Test :: class . java . getResource (" Login Page - standard . html "). read Text (). replace (" fake log . cf ", Ġ" fake log . localhost : 3 0 0 0 "))) ĊĠĠĠĠĠĠĠ Ġserver . enqueue ( Mock Response (). set Body ( Login Test :: class . java . getResource (" Log owanie - u onet . html "). read Text ())) ĊĠĠĠĠĠĠĠ Ġserver . enqueue ( Mock Response (). set Body ( Login Test :: class . java . getResource (" Log owanie - br ak - d ost ep u . html "). read Text ())) ĊĠĠĠĠĠĠĠ Ġserver . enqueue ( Mock Response (). set Body ( Error Interceptor Test :: class . java . getResource (" Offline . html "). read Text ())) ĊĠĠĠĠĠĠĠ Ġserver . enqueue ( Mock Response (). set Body ( Login Test :: class . java . getResource (" Log owanie - br ak - d ost ep u . html "). read Text ())) ĊĠĠĠĠĠĠĠ Ġserver . enqueue ( Mock Response (). set Body ( Login Test :: class . java . getResource (" Log owanie - br ak - d ost ep u . html "). read Text ())) ĊĠĠĠĠĠĠĠ Ġserver . enqueue ( Mock Response (). set Body ( Login Test :: class . java . getResource (" Log owanie - br ak - d ost ep u . html "). read Text ())) ĊĠĠĠĠĠĠĠ Ġserver . enqueue ( Mock Response (). set Body ( Login Test :: class . java . getResource (" Log owanie - br ak - d ost ep u . html "). read Text ())) ĊĠĠĠĠĠĠĠ Ġserver . start ( 3 0 0 0 ) ĊĊĠĠĠĠĠĠĠ Ġval Ġapi Ġ= ĠApi (). apply Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġlog Level Ġ= ĠHttp Logging Interceptor . Level . BASIC ĊĠĠĠĠĠĠĠĠĠĠĠ Ġssl Ġ= Ġfalse ĊĠĠĠĠĠĠĠĠĠĠĠ Ġhost Ġ= Ġ" fake log . localhost : 3 0 0 0 " ĊĠĠĠĠĠĠĠĠĠĠĠ Ġemail Ġ= Ġ" jan @ fake log . cf " ĊĠĠĠĠĠĠĠĠĠĠĠ Ġpassword Ġ= Ġ" jan 1 2 3 " ĊĠĠĠĠĠĠĠĠĠĠĠ Ġsymbol Ġ= Ġ"" ĊĠĠĠĠĠĠĠ Ġ} ĊĊĠĠĠĠĠĠĠ Ġval Ġp up ils Ġ= Ġapi . get Students () ĊĠĠĠĠĠĠĠ Ġval Ġobserver Ġ= ĠTest Observer < List < Student >>() ĊĠĠĠĠĠĠĠ Ġp up ils . subscribe ( observer ) ĊĠĠĠĠĠĠĠ Ġobserver . assert Terminated () ĊĠĠĠĠĠĠĠ Ġobserver . assert Error ( ApiException :: class . java ) ĊĊĠĠĠĠĠĠĠ Ġserver . take Request () ĊĠĠĠĠĠĠĠ Ġ// Ġ/ Default / Account / Log On Ġ< âĢĵ Ġdefault Ġsymbol Ġset ĊĠĠĠĠĠĠĠ ĠassertEquals ("/ Default / Account / Log On ", ĠURL ( server . take Request (). request Url . toString ()). path ) ĊĠĠĠ Ġ} Ċ } Ċ