package Ġkin . backup and restore . restore . presenter Ċ Ċ import Ġandroid . net . Uri Ċ import Ġcom . n ha ar man . mock it ok otlin 2 . do Throw Ċ import Ġcom . n ha ar man . mock it ok otlin 2 . mock Ċ import Ġcom . n ha ar man . mock it ok otlin 2 . never Ċ import Ġcom . n ha ar man . mock it ok otlin 2 . verify Ċ import Ġcom . n ha ar man . mock it ok otlin 2 . verify No More Interactions Ċ import Ġcom . n ha ar man . mock it ok otlin 2 . wh enever Ċ import Ġkin . backup and restore . events . Callback Manager Ċ import Ġkin . backup and restore . events . Restore Event Code . REST ORE _ ARE _ YOUR _ S URE _ CANCEL _ T AP PED Ċ import Ġkin . backup and restore . events . Restore Event Code . REST ORE _ ARE _ YOUR _ S URE _ OK _ T AP PED Ċ import Ġkin . backup and restore . events . Restore Event Code . REST ORE _ UPLOAD _ QR _ CODE _ BACK _ T AP PED Ċ import Ġkin . backup and restore . events . Restore Event Code . REST ORE _ UPLOAD _ QR _ CODE _ BUTTON _ T AP PED Ċ import Ġkin . backup and restore . events . Restore Event Code . REST ORE _ UPLOAD _ QR _ CODE _ PAGE _ VIEW ED Ċ import Ġkin . backup and restore . qr . QR Barcode Generator Ċ import Ġkin . backup and restore . restore . presenter . File Sharing Helper . REQUEST _ RESULT _ C ANCE LED Ċ import Ġkin . backup and restore . restore . presenter . File Sharing Helper . REQUEST _ RESULT _ FAILED Ċ import Ġkin . backup and restore . restore . presenter . File Sharing Helper . REQUEST _ RESULT _ OK Ċ import Ġkin . backup and restore . restore . view . Upload QR View Ċ import Ġorg . junit . Before Ċ import Ġorg . junit . Test ĊĊ Ċ class ĠUpload Q RP res enter Impl Test Ġ{ ĊĊĠĠĠ Ġprivate Ġval Ġcallback Manager : ĠCallback Manager Ġ= Ġmock () ĊĠĠĠ Ġprivate Ġval Ġfile Sharing Helper : ĠFile Sharing Helper Ġ= Ġmock () ĊĠĠĠ Ġprivate Ġval Ġqr Barcode Generator : ĠQR Barcode Generator Ġ= Ġmock () ĊĠĠĠ Ġprivate Ġval Ġparent Presenter : ĠRestore Presenter Ġ= Ġmock () ĊĊĠĠĠ Ġprivate Ġval Ġview : ĠUpload QR View Ġ= Ġmock () ĊĊĠĠĠ Ġprivate Ġlateinit Ġvar Ġpresenter : ĠUpload Q RP res enter Impl ĊĊĠĠĠ Ġ@ Before ĊĠĠĠ Ġfun ĠsetUp () Ġ{ ĊĠĠĠĠĠĠĠ Ġpresenter Ġ= ĠUpload Q RP res enter Impl ( callback Manager , Ġfile Sharing Helper , Ġqr Barcode Generator ) ĊĠĠĠĠĠĠĠ Ġpresenter . on Attach ( view , Ġparent Presenter ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġ` send Ġevent Ġon Ġattach Ġupload Ġqr Ġpage Ġviewed `() Ġ{ ĊĠĠĠĠĠĠĠ Ġverify ( callback Manager ). send Restore Event ( REST ORE _ UPLOAD _ QR _ CODE _ PAGE _ VIEW ED ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġ` upload Clicked , Ġshow Ġconsent Ġdialog Ġand Ġsend Ġevent `() Ġ{ ĊĠĠĠĠĠĠĠ Ġpresenter . upload Clicked () ĊĠĠĠĠĠĠĠ Ġverify ( view ). show Consent Dialog () ĊĠĠĠĠĠĠĠ Ġverify ( callback Manager ). send Restore Event ( REST ORE _ UPLOAD _ QR _ CODE _ BUTTON _ T AP PED ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġ` on Ok Pressed Ġrequest Ġload Ġimage Ġand Ġsend Ġevent `() Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġtitle Ġ= Ġ" some Ġtitle " ĊĠĠĠĠĠĠĠ Ġpresenter . on Ok Pressed ( title ) ĊĠĠĠĠĠĠĠ Ġverify ( file Sharing Helper ). request Image File ( title ) ĊĠĠĠĠĠĠĠ Ġverify ( callback Manager ). send Restore Event ( REST ORE _ ARE _ YOUR _ S URE _ OK _ T AP PED ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġ` on Cancel Pressed Ġsend Ġevent `() Ġ{ ĊĠĠĠĠĠĠĠ Ġpresenter . on Cancel Pressed () ĊĠĠĠĠĠĠĠ Ġverify ( callback Manager ). send Restore Event ( REST ORE _ ARE _ YOUR _ S URE _ CANCEL _ T AP PED ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġ` on Activity Result Ġresult Ġcancel , Ġdo Ġnothing `() Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġreq Ġ= Ġ 1 ĊĠĠĠĠĠĠĠ Ġval Ġres Ġ= Ġ 1 ĊĠĠĠĠĠĠĠ Ġval Ġdata Ġ= Ġnull ĊĠĠĠĠĠĠĠ Ġverify ( callback Manager ). send Restore Event ( REST ORE _ UPLOAD _ QR _ CODE _ PAGE _ VIEW ED ) ĊĠĠĠĠĠĠĠ Ġwhenever ( file Sharing Helper . extract Uri From Activity Result ( req , Ġres , Ġdata )). thenReturn ( ĊĠĠĠĠĠĠĠĠĠĠĠ ĠFile Sharing Helper . Request File Result ( REQUEST _ RESULT _ C ANCE LED , Ġnull ) ĊĠĠĠĠĠĠĠ Ġ) ĊĠĠĠĠĠĠĠ Ġpresenter . on Activity Result ( req , Ġres , Ġdata ) ĊĠĠĠĠĠĠĠ Ġverify ( file Sharing Helper ). extract Uri From Activity Result ( req , Ġres , Ġdata ) ĊĠĠĠĠĠĠĠ Ġverify No More Interactions ( view , Ġcallback Manager , Ġfile Sharing Helper , Ġqr Barcode Generator ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġ` on Activity Result Ġresult Ġfailed , Ġshow Ġerror Ġdialog `() Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġreq Ġ= Ġ 1 ĊĠĠĠĠĠĠĠ Ġval Ġres Ġ= Ġ 1 ĊĠĠĠĠĠĠĠ Ġval Ġdata Ġ= Ġnull ĊĠĠĠĠĠĠĠ Ġverify ( callback Manager ). send Restore Event ( REST ORE _ UPLOAD _ QR _ CODE _ PAGE _ VIEW ED ) ĊĠĠĠĠĠĠĠ Ġwhenever ( file Sharing Helper . extract Uri From Activity Result ( req , Ġres , Ġdata )). thenReturn ( ĊĠĠĠĠĠĠĠĠĠĠĠ ĠFile Sharing Helper . Request File Result ( REQUEST _ RESULT _ FAILED , Ġnull ) ĊĠĠĠĠĠĠĠ Ġ) ĊĠĠĠĠĠĠĠ Ġpresenter . on Activity Result ( req , Ġres , Ġdata ) ĊĊĠĠĠĠĠĠĠ Ġverify ( file Sharing Helper ). extract Uri From Activity Result ( req , Ġres , Ġdata ) ĊĠĠĠĠĠĠĠ Ġverify ( view ). show Error Loading FileDialog () ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġ` on Activity Result Ġresult Ġok , Ġload Ġencrypted Ġkeystore `() Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġreq Ġ= Ġ 1 ĊĠĠĠĠĠĠĠ Ġval Ġres Ġ= Ġ 1 ĊĠĠĠĠĠĠĠ Ġval Ġdata Ġ= Ġnull ĊĠĠĠĠĠĠĠ Ġval Ġaccount Key Ġ= Ġ" some _ account _ key " ĊĠĠĠĠĠĠĠ Ġval Ġresult : ĠFile Sharing Helper . Request File Result Ġ= Ġmock () ĊĠĠĠĠĠĠĠ Ġval Ġuri : ĠUri Ġ= Ġmock () ĊĊĠĠĠĠĠĠĠ Ġverify ( callback Manager ). send Restore Event ( REST ORE _ UPLOAD _ QR _ CODE _ PAGE _ VIEW ED ) ĊĠĠĠĠĠĠĠ Ġwhenever ( file Sharing Helper . extract Uri From Activity Result ( req , Ġres , Ġdata )). thenReturn ( result ) ĊĠĠĠĠĠĠĠ Ġwhenever ( result . result ). thenReturn ( REQUEST _ RESULT _ OK ) ĊĠĠĠĠĠĠĠ Ġwhenever ( result . file Uri ). thenReturn ( uri ) ĊĠĠĠĠĠĠĠ Ġwhenever ( qr Barcode Generator . decode QR ( uri )). thenReturn ( account Key ) ĊĠĠĠĠĠĠĠ Ġpresenter . on Activity Result ( req , Ġres , Ġdata ) ĊĠĠĠĠĠĠĠ Ġverify ( file Sharing Helper ). extract Uri From Activity Result ( req , Ġres , Ġdata ) ĊĠĠĠĠĠĠĠ Ġverify ( qr Barcode Generator ). decode QR ( uri ) ĊĠĠĠĠĠĠĠ Ġverify ( parent Presenter ). navigate To Enter Password Page ( account Key ) ĊĠĠĠĠĠĠĠ Ġverify ( view , Ġnever ()). show Error Loading FileDialog () ĊĠĠĠĠĠĠĠ Ġverify ( view , Ġnever ()). show Error De coding QR Dialog () ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġ` on Activity Result Ġresult Ġok , Ġload Ġencrypted Ġthrow ĠQR File Handling Exception , Ġshow Ġerror Ġloading Ġdialog `() Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġreq Ġ= Ġ 1 ĊĠĠĠĠĠĠĠ Ġval Ġres Ġ= Ġ 1 ĊĠĠĠĠĠĠĠ Ġval Ġdata Ġ= Ġnull ĊĠĠĠĠĠĠĠ Ġval Ġaccount Key Ġ= Ġ" some _ account _ key " ĊĠĠĠĠĠĠĠ Ġval Ġresult : ĠFile Sharing Helper . Request File Result Ġ= Ġmock () ĊĠĠĠĠĠĠĠ Ġval Ġuri : ĠUri Ġ= Ġmock () ĊĊĠĠĠĠĠĠĠ Ġverify ( callback Manager ). send Restore Event ( REST ORE _ UPLOAD _ QR _ CODE _ PAGE _ VIEW ED ) ĊĠĠĠĠĠĠĠ Ġwhenever ( file Sharing Helper . extract Uri From Activity Result ( req , Ġres , Ġdata )). thenReturn ( result ) ĊĠĠĠĠĠĠĠ Ġwhenever ( result . result ). thenReturn ( REQUEST _ RESULT _ OK ) ĊĠĠĠĠĠĠĠ Ġwhenever ( result . file Uri ). thenReturn ( uri ) ĊĠĠĠĠĠĠĠ Ġwhenever ( qr Barcode Generator . decode QR ( uri )) Ġdo Throw Ġ( QR Barcode Generator . QR File Handling Exception :: class ) ĊĠĠĠĠĠĠĠ Ġpresenter . on Activity Result ( req , Ġres , Ġdata ) ĊĠĠĠĠĠĠĠ Ġverify ( file Sharing Helper ). extract Uri From Activity Result ( req , Ġres , Ġdata ) ĊĠĠĠĠĠĠĠ Ġverify ( qr Barcode Generator ). decode QR ( uri ) ĊĠĠĠĠĠĠĠ Ġverify ( view ). show Error Loading FileDialog () ĊĠĠĠĠĠĠĠ Ġverify ( parent Presenter , Ġnever ()). navigate To Enter Password Page ( account Key ) ĊĠĠĠĠĠĠĠ Ġverify ( view , Ġnever ()). show Error De coding QR Dialog () ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġ` on Activity Result Ġresult Ġok , Ġload Ġencrypted Ġthrow ĠQR Barcode Generator Exception , Ġshow Ġerror Ġdecoding Ġqr Ġdialog `() Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġreq Ġ= Ġ 1 ĊĠĠĠĠĠĠĠ Ġval Ġres Ġ= Ġ 1 ĊĠĠĠĠĠĠĠ Ġval Ġdata Ġ= Ġnull ĊĠĠĠĠĠĠĠ Ġval Ġaccount Key Ġ= Ġ" some _ account _ key " ĊĠĠĠĠĠĠĠ Ġval Ġresult : ĠFile Sharing Helper . Request File Result Ġ= Ġmock () ĊĠĠĠĠĠĠĠ Ġval Ġuri : ĠUri Ġ= Ġmock () ĊĊĠĠĠĠĠĠĠ Ġverify ( callback Manager ). send Restore Event ( REST ORE _ UPLOAD _ QR _ CODE _ PAGE _ VIEW ED ) ĊĠĠĠĠĠĠĠ Ġwhenever ( file Sharing Helper . extract Uri From Activity Result ( req , Ġres , Ġdata )). thenReturn ( result ) ĊĠĠĠĠĠĠĠ Ġwhenever ( result . result ). thenReturn ( REQUEST _ RESULT _ OK ) ĊĠĠĠĠĠĠĠ Ġwhenever ( result . file Uri ). thenReturn ( uri ) ĊĠĠĠĠĠĠĠ Ġwhenever ( qr Barcode Generator . decode QR ( uri )). thenReturn ( account Key ) ĊĠĠĠĠĠĠĠ Ġpresenter . on Activity Result ( req , Ġres , Ġdata ) ĊĠĠĠĠĠĠĠ Ġverify ( file Sharing Helper ). extract Uri From Activity Result ( req , Ġres , Ġdata ) ĊĠĠĠĠĠĠĠ Ġverify ( qr Barcode Generator ). decode QR ( uri ) ĊĠĠĠĠĠĠĠ Ġverify ( parent Presenter ). navigate To Enter Password Page ( account Key ) ĊĠĠĠĠĠĠĠ Ġverify ( view , Ġnever ()). show Error Loading FileDialog () ĊĠĠĠĠĠĠĠ Ġverify ( view , Ġnever ()). show Error De coding QR Dialog () ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġ` on Back Clicked Ġdo Ġprevious Step Ġand Ġsend Ġevent `() Ġ{ ĊĠĠĠĠĠĠĠ Ġpresenter . on Back Clicked () ĊĠĠĠĠĠĠĠ Ġverify ( callback Manager ). send Restore Event ( REST ORE _ UPLOAD _ QR _ CODE _ BACK _ T AP PED ) ĊĠĠĠĠĠĠĠ Ġverify ( parent Presenter ). previous Step () ĊĠĠĠ Ġ} Ċ } Ċ