package Ġcom . kl arna . in app . sdk . flutter _ kl arna _ in app _ sdk . post purchase Ċ Ċ import Ġandroid . webkit . WebView Ċ import Ġcom . kl arna . in app . sdk . flutter _ kl arna _ in app _ sdk . core . webview . WebView Manager Ċ import Ġcom . kl arna . in app . sdk . flutter _ kl arna _ in app _ sdk . hybrid . Kl arna Hybrid SDK Handler Ċ import Ġcom . kl arna . mobile . sdk . api . hybrid . Kl arna Hybrid SDK Ċ import Ġio . flutter . plugin . common . Method Channel Ċ import Ġio . mock k .* Ċ import Ġorg . junit . After Ċ import Ġorg . junit . Before Ċ import Ġorg . junit . Test Ċ Ċ class ĠPost Purchase Experience Manager Test Ġ{ ĊĊĠĠĠ Ġprivate Ġval Ġp pe Manager Ġ= ĠPost Purchase Experience Manager () ĊĠĠĠ Ġprivate Ġval Ġresult : ĠMethod Channel . Result Ġ= Ġmock k () ĊĠĠĠ Ġprivate Ġval ĠwebView Manager : ĠWebView Manager Ġ= Ġmock k ( relax ed Ġ= Ġtrue ) ĊĠĠĠ Ġprivate Ġval ĠwebView : ĠWebView Ġ= Ġmock k ( relax ed Ġ= Ġtrue ) ĊĠĠĠ Ġprivate Ġval Ġhybrid SDK : ĠK l arna Hybrid SDK Ġ= Ġmock k () ĊĊĠĠĠ Ġ@ Before ĊĠĠĠ Ġfun Ġsetup () Ġ{ ĊĠĠĠĠĠĠĠ Ġmock k Object ( Post Purchase Experience Manager ) ĊĠĠĠĠĠĠĠ Ġmock k Object ( Kl arna Hybrid SDK Handler ) ĊĊĠĠĠĠĠĠĠ Ġevery Ġ{ ĠK l arna Hybrid SDK Handler . hybrid SDK Ġ} Ġreturns Ġhybrid SDK ĊĠĠĠĠĠĠĠ Ġevery Ġ{ Ġhybrid SDK . add WebView ( any ()) Ġ} Ġjust Ġruns ĊĊĠĠĠĠĠĠĠ Ġevery Ġ{ Ġresult . success ( any ()) Ġ} Ġjust Ġruns ĊĠĠĠĠĠĠĠ Ġevery Ġ{ Ġresult . error ( any (), Ġany (), Ġany ()) Ġ} Ġjust Ġruns ĊĊĠĠĠĠĠĠĠ Ġp pe Manager . web View Manager Ġ= ĠwebView Manager ĊĊĠĠĠĠĠĠĠ Ġmock k Constructor ( Post Purchase Experience WebView Client :: class ) ĊĊĠĠĠĠĠĠĠ Ġevery Ġ{ ĠwebView Manager . web View Ġ} Ġreturns Ġnull Ġand Then ĠwebView ĊĠĠĠĠĠĠĠ Ġevery Ġ{ ĠwebView Manager . require WebView () Ġ} Ġreturns ĠwebView ĊĠĠĠĠĠĠĠ Ġevery Ġ{ ĠwebView . settings Ġ} Ġreturns Ġmock k ( relax ed Ġ= Ġtrue ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ After ĊĠĠĠ Ġfun Ġteardown () Ġ{ ĊĠĠĠĠĠĠĠ Ġclear All Mocks () ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġtest Not Initialized () Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġp pe Manager Ġ= ĠPost Purchase Experience Manager () ĊĠĠĠĠĠĠĠ Ġp pe Manager . render Operation ( mock k (), Ġresult ) ĊĠĠĠĠĠĠĠ Ġp pe Manager . authorization Request ( mock k (), Ġresult ) ĊĠĠĠĠĠĠĠ Ġverify ( exact ly Ġ= Ġ 2 ) Ġ{ ĠPost Purchase Experience Manager . not Initialized ( result ) Ġ} ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġtest Initialize () Ġ{ ĊĠĠĠĠĠĠĠ Ġp pe Manager . initialize ( mock k ( relax ed Ġ= Ġtrue ), Ġresult ) ĊĠĠĠĠĠĠĠ Ġverify Ġ{ ĠK l arna Hybrid SDK Handler . hybrid SDK Ġ} ĊĠĠĠĠĠĠĠ Ġverify Ġ{ ĠwebView Manager . initialize ( null ) Ġ} ĊĠĠĠĠĠĠĠ Ġverify Ġ{ ĠwebView Manager . addTo Hybrid Sdk ( null ) Ġ} ĊĠĠĠĠĠĠĠ Ġverify Ġ{ ĠwebView . web View Client Ġ= Ġany () Ġ} ĊĠĠĠĠĠĠĠ Ġverify Ġ{ ĠwebView . web Chrome Client Ġ= Ġany () Ġ} ĊĠĠĠĠĠĠĠ Ġverify Ġ{ ĠwebView . add Javascript Interface ( any (), Ġ" PPE Callback ") Ġ} ĊĠĠĠĠĠĠĠ Ġverify Ġ{ ĠwebView . load Url (" file :/// android _ asset / p pe . html ") Ġ} ĊĠĠĠĠĠĠĠ Ġverify Ġ{ Ġp pe Manager . web View Client ?. queue JS ( any (), Ġany ()) Ġ} ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġtest Destroy () Ġ{ ĊĠĠĠĠĠĠĠ Ġp pe Manager . destroy ( mock k ( relax ed Ġ= Ġtrue ), Ġresult ) ĊĠĠĠĠĠĠĠ Ġverify Ġ{ ĠwebView Manager . destroy ( null ) Ġ} ĊĠĠĠĠĠĠĠ Ġverify Ġ{ Ġresult . success ( null ) Ġ} ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġtest Render Operation () Ġ{ ĊĠĠĠĠĠĠĠ Ġp pe Manager . initialized Ġ= Ġtrue ĊĠĠĠĠĠĠĠ Ġp pe Manager . web View Client Ġ= Ġmock k ( relax ed Ġ= Ġtrue ) ĊĠĠĠĠĠĠĠ Ġp pe Manager . render Operation ( mock k ( relax ed Ġ= Ġtrue ), Ġresult ) ĊĠĠĠĠĠĠĠ Ġverify Ġ{ Ġp pe Manager . web View Client ?. queue JS ( any (), Ġany ()) Ġ} ĊĠĠĠĠĠĠĠ Ġverify Ġ{ ĠwebView Manager . show ( null ) Ġ} ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġtest Authorization Request () Ġ{ ĊĠĠĠĠĠĠĠ Ġp pe Manager . initialized Ġ= Ġtrue ĊĠĠĠĠĠĠĠ Ġp pe Manager . web View Client Ġ= Ġmock k ( relax ed Ġ= Ġtrue ) ĊĠĠĠĠĠĠĠ Ġp pe Manager . authorization Request ( mock k ( relax ed Ġ= Ġtrue ), Ġresult ) ĊĠĠĠĠĠĠĠ Ġverify Ġ{ Ġp pe Manager . web View Client ?. queue JS ( any (), Ġany ()) Ġ} ĊĠĠĠĠĠĠĠ Ġverify Ġ{ ĠwebView Manager . show ( null ) Ġ} ĊĠĠĠ Ġ} Ċ }