/* Ċ Ġ* ĠCopyright Ġ 2 0 1 9 - 2 0 2 0 ĠZ en Key , ĠLLC . Ċ Ġ* Ċ Ġ* ĠLicensed Ġunder Ġthe ĠApache ĠLicense , ĠVersion Ġ 2 . 0 Ġ( the Ġ" License "); Ċ Ġ* Ġyou Ġmay Ġnot Ġuse Ġthis Ġfile Ġexcept Ġin Ġcompliance Ġwith Ġthe ĠLicense . Ċ Ġ* ĠYou Ġmay Ġobtain Ġa Ġcopy Ġof Ġthe ĠLicense Ġat Ċ Ġ* Ċ Ġ* ĠĠĠĠ Ġhttp :// www . apache . org / licenses / LICENSE - 2 . 0 Ċ Ġ* Ċ Ġ* ĠUnless Ġrequired Ġby Ġapplicable Ġlaw Ġor Ġagreed Ġto Ġin Ġwriting , Ġsoftware Ċ Ġ* Ġdistributed Ġunder Ġthe ĠLicense Ġis Ġdistributed Ġon Ġan Ġ" AS ĠIS " ĠBASIS , Ċ Ġ* ĠWITHOUT ĠWARRANTIES ĠOR ĠCONDITIONS ĠOF ĠANY ĠKIND , Ġeither Ġexpress Ġor Ġimplied . Ċ Ġ* ĠSee Ġthe ĠLicense Ġfor Ġthe Ġspecific Ġlanguage Ġgoverning Ġpermissions Ġand Ċ Ġ* Ġlimitations Ġunder Ġthe ĠLicense . Ċ Ġ*/ Ċ package Ġcom . x ci . zen key . sdk . internal Ċ Ċ import Ġandroid . content . Intent Ċ import Ġandroid . content . pm .* Ċ import Ġandroid . content . pm . PackageManager .* Ċ import Ġandroid . net . Uri Ċ import Ġandroid . os . Build Ċ import Ġcom . n ha ar man . mock it ok otlin 2 . mock Ċ import Ġcom . n ha ar man . mock it ok otlin 2 . verify Ċ import Ġcom . n ha ar man . mock it ok otlin 2 . wh enever Ċ import Ġcom . x ci . zen key . sdk . internal . security . Fingerprint Factory Ċ import Ġorg . junit . Assert .* Ċ import Ġorg . junit . Before Ċ import Ġorg . junit . Test Ċ import Ġorg . junit . runner . RunWith Ċ import Ġorg . mockito . Argument Matchers . any Ċ import Ġorg . mockito . Argument Matchers . eq Ċ import Ġorg . ro bo lectric . Ro bo lectric TestRunner Ċ import Ġorg . ro bo lectric . annotation . Config Ċ import Ġjava . security . cert . Certificate Exception Ċ import Ġjava . util .* Ċ Ċ @ RunWith ( Ro bo lectric TestRunner :: class ) Ċ @ Config ( manifest Ġ= ĠConfig . NONE ) Ċ class ĠAndroid PackageManager Test Ġ{ ĊĊĠĠĠ Ġprivate Ġval Ġmock PackageManager Ġ= Ġmock < PackageManager >() ĊĠĠĠ Ġprivate Ġval Ġmock Resolve Info Ġ= Ġmock < Resolve Info >() ĊĠĠĠ Ġprivate Ġval Ġmock Activity Info Ġ= Ġmock < Activity Info >() ĊĠĠĠ Ġprivate Ġval Ġmock Signature Ġ= Ġmock < Signature >() ĊĠĠĠ Ġprivate Ġval Ġmock Package Info Ġ= Ġmock < Package Info >() ĊĠĠĠ Ġprivate Ġval Ġmock Signing Info Ġ= Ġmock < Signing Info >() ĊĠĠĠ Ġprivate Ġval Ġmock Fingerprint Factory Ġ= Ġmock < Fingerprint Factory >() ĊĊĠĠĠ Ġprivate Ġlateinit Ġvar Ġpackage Manager : ĠAndroid PackageManager ĊĊĠĠĠ Ġ@ Before ĊĠĠĠ Ġfun ĠsetUp () Ġ{ ĊĠĠĠĠĠĠĠ Ġpackage Manager Ġ= ĠAndroid PackageManager ( mock PackageManager , Ġmock Fingerprint Factory ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġshould Get Available Packages () Ġ{ ĊĠĠĠĠĠĠĠ Ġmock Resolve Info . activity Info Ġ= Ġmock Activity Info ĊĠĠĠĠĠĠĠ Ġmock Activity Info . packageName Ġ= ĠPACK AGE _ NAME 1 ĊĠĠĠĠĠĠĠ Ġval Ġinfo Ġ= ĠArrayList < Resolve Info >() ĊĠĠĠĠĠĠĠ Ġinfo . add ( mock Resolve Info ) ĊĠĠĠĠĠĠĠ Ġwhenever ( mock PackageManager . query Intent Activities ( any ( Intent :: class . java ), Ġeq ( MATCH _ DEFAULT _ ONLY ))) ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ. thenReturn ( info ) ĊĊĠĠĠĠĠĠĠ Ġval Ġpackages Ġ= Ġpackage Manager . get Available Packages ( Uri . EMPTY ) ĊĠĠĠĠĠĠĠ ĠassertFalse ( packages . isEmpty ()) ĊĠĠĠĠĠĠĠ ĠassertEquals ( PACKAGE _ NAME 1 , Ġpackages [ 0 ]) ĊĊĠĠĠĠĠĠĠ Ġverify ( mock PackageManager ). query Intent Activities ( any ( Intent :: class . java ), Ġeq ( MATCH _ DEFAULT _ ONLY )) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Suppress (" DE PREC ATION ") ĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġ@ Throws ( Name NotFoundException :: class , ĠCertificate Exception :: class ) ĊĠĠĠ Ġ@ Config ( sdk Ġ= Ġ[ Build . VERSION _ CODES . O ]) ĊĠĠĠ Ġfun Ġshould Get Fingerprint s Below Android P () Ġ{ ĊĠĠĠĠĠĠĠ Ġval ĠbyteArray Ġ= ĠByteArray ( 0 ) ĊĠĠĠĠĠĠĠ Ġval Ġsignatures Ġ= ĠarrayOf Null s < Signature >( 1 ) ĊĠĠĠĠĠĠĠ Ġsignatures [ 0 ] Ġ= Ġmock Signature ĊĠĠĠĠĠĠĠ Ġmock Package Info . signatures Ġ= Ġsignatures ĊĠĠĠĠĠĠĠ Ġwhenever ( mock PackageManager . get Package Info ( eq ( PACKAGE _ NAME 1 ), Ġeq ( GET _ SIGNATURE S ))) ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ. thenReturn ( mock Package Info ) ĊĊĠĠĠĠĠĠĠ Ġwhenever ( mock Signature . toByteArray ()). thenReturn ( byteArray ) ĊĊĠĠĠĠĠĠĠ Ġwhenever ( mock Fingerprint Factory . create ( byteArray )). thenReturn ( F ING ER PRINT ) ĊĊĠĠĠĠĠĠĠ Ġval Ġfingerprint s Ġ= Ġpackage Manager . get Certificate Fingerprint s ( PACKAGE _ NAME 1 ) ĊĊĠĠĠĠĠĠĠ ĠassertFalse ( fingerprint s . isEmpty ()) ĊĠĠĠĠĠĠĠ ĠassertEquals ( F ING ER PRINT , Ġfingerprint s [ 0 ]) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġ@ Throws ( Name NotFoundException :: class , ĠCertificate Exception :: class ) ĊĠĠĠ Ġ@ Config ( sdk Ġ= Ġ[ Build . VERSION _ CODES . P ]) ĊĠĠĠ Ġfun Ġshould Get Fingerprint s Above Android P With Multiple Sign ers () Ġ{ ĊĠĠĠĠĠĠĠ Ġval ĠbyteArray Ġ= ĠByteArray ( 0 ) ĊĠĠĠĠĠĠĠ Ġval Ġsignatures Ġ= ĠarrayOf Null s < Signature >( 1 ) ĊĠĠĠĠĠĠĠ Ġsignatures [ 0 ] Ġ= Ġmock Signature ĊĊĠĠĠĠĠĠĠ Ġmock Package Info . signing Info Ġ= Ġmock Signing Info ĊĠĠĠĠĠĠĠ Ġwhenever ( mock Signing Info . has Multiple Sign ers ()). thenReturn ( true ) ĊĠĠĠĠĠĠĠ Ġwhenever ( mock Signing Info . apk Contents Sign ers ). thenReturn ( signatures ) ĊĊĠĠĠĠĠĠĠ Ġwhenever ( mock PackageManager . get Package Info ( eq ( PACKAGE _ NAME 1 ), Ġeq ( GET _ SIGN ING _ CER TIF IC ATES ))) ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ. thenReturn ( mock Package Info ) ĊĠĠĠĠĠĠĠ Ġwhenever ( mock Signature . toByteArray ()). thenReturn ( byteArray ) ĊĠĠĠĠĠĠĠ Ġwhenever ( mock Fingerprint Factory . create ( byteArray )). thenReturn ( F ING ER PRINT ) ĊĊĠĠĠĠĠĠĠ Ġval Ġfingerprint s Ġ= Ġpackage Manager . get Certificate Fingerprint s ( PACKAGE _ NAME 1 ) ĊĊĠĠĠĠĠĠĠ ĠassertFalse ( fingerprint s . isEmpty ()) ĊĠĠĠĠĠĠĠ ĠassertEquals ( F ING ER PRINT , Ġfingerprint s [ 0 ]) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġ@ Throws ( Name NotFoundException :: class , ĠCertificate Exception :: class ) ĊĠĠĠ Ġ@ Config ( sdk Ġ= Ġ[ Build . VERSION _ CODES . P ]) ĊĠĠĠ Ġfun Ġshould Get Fingerprint s Above Android P With Unique Signer () Ġ{ ĊĠĠĠĠĠĠĠ Ġval ĠbyteArray Ġ= ĠByteArray ( 0 ) ĊĠĠĠĠĠĠĠ Ġval Ġsignatures Ġ= ĠarrayOf Null s < Signature >( 1 ) ĊĠĠĠĠĠĠĠ Ġsignatures [ 0 ] Ġ= Ġmock Signature ĊĊĠĠĠĠĠĠĠ Ġmock Package Info . signing Info Ġ= Ġmock Signing Info ĊĠĠĠĠĠĠĠ Ġwhenever ( mock Signing Info . has Multiple Sign ers ()). thenReturn ( false ) ĊĠĠĠĠĠĠĠ Ġwhenever ( mock Signing Info . signing Certificate History ). thenReturn ( signatures ) ĊĊĠĠĠĠĠĠĠ Ġwhenever ( mock PackageManager . get Package Info ( eq ( PACKAGE _ NAME 1 ), Ġeq ( GET _ SIGN ING _ CER TIF IC ATES ))) ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ. thenReturn ( mock Package Info ) ĊĊĠĠĠĠĠĠĠ Ġwhenever ( mock Signature . toByteArray ()). thenReturn ( byteArray ) ĊĊĠĠĠĠĠĠĠ Ġwhenever ( mock Fingerprint Factory . create ( byteArray )). thenReturn ( F ING ER PRINT ) ĊĊĠĠĠĠĠĠĠ Ġval Ġfingerprint s Ġ= Ġpackage Manager . get Certificate Fingerprint s ( PACKAGE _ NAME 1 ) ĊĊĠĠĠĠĠĠĠ ĠassertFalse ( fingerprint s . isEmpty ()) ĊĠĠĠĠĠĠĠ ĠassertEquals ( F ING ER PRINT , Ġfingerprint s [ 0 ]) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Suppress (" DE PREC ATION ") ĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġ@ Throws ( Name NotFoundException :: class ) ĊĠĠĠ Ġ@ Config ( sdk Ġ= Ġ[ Build . VERSION _ CODES . O ]) ĊĠĠĠ Ġfun Ġshould Not Get Fingerprint s If Name NotFoundException Below P () Ġ{ ĊĠĠĠĠĠĠĠ Ġwhenever ( mock PackageManager . get Package Info ( PACKAGE _ NAME 1 , ĠGET _ SIGNATURE S )) ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ. then Throw ( Name NotFoundException :: class . java ) ĊĊĠĠĠĠĠĠĠ Ġval Ġfingerprint s Ġ= Ġpackage Manager . get Certificate Fingerprint s ( PACKAGE _ NAME 1 ) ĊĊĠĠĠĠĠĠĠ ĠassertTrue ( fingerprint s . isEmpty ()) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġ@ Throws ( Name NotFoundException :: class ) ĊĠĠĠ Ġ@ Config ( sdk Ġ= Ġ[ Build . VERSION _ CODES . P ]) ĊĠĠĠ Ġfun Ġshould Not Get Fingerprint s If Name NotFoundException Above P With Multiple Sign ers () Ġ{ ĊĠĠĠĠĠĠĠ Ġwhenever ( mock PackageManager . get Package Info ( PACKAGE _ NAME 1 , ĠGET _ SIGN ING _ CER TIF IC ATES )) ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ. then Throw ( Name NotFoundException :: class . java ) ĊĊĠĠĠĠĠĠĠ Ġval Ġfingerprint s Ġ= Ġpackage Manager . get Certificate Fingerprint s ( PACKAGE _ NAME 1 ) ĊĊĠĠĠĠĠĠĠ ĠassertTrue ( fingerprint s . isEmpty ()) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġ@ Throws ( Name NotFoundException :: class ) ĊĠĠĠ Ġ@ Config ( sdk Ġ= Ġ[ Build . VERSION _ CODES . P ]) ĊĠĠĠ Ġfun Ġshould Not Get Fingerprint s If Name NotFoundException Above P With Single Sign ers () Ġ{ ĊĠĠĠĠĠĠĠ Ġwhenever ( mock PackageManager . get Package Info ( PACKAGE _ NAME 1 , ĠGET _ SIGN ING _ CER TIF IC ATES )) ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ. then Throw ( Name NotFoundException :: class . java ) ĊĊĠĠĠĠĠĠĠ Ġval Ġfingerprint s Ġ= Ġpackage Manager . get Certificate Fingerprint s ( PACKAGE _ NAME 1 ) ĊĊĠĠĠĠĠĠĠ ĠassertTrue ( fingerprint s . isEmpty ()) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġall Fingerprint s ShouldBe Valid () Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġexpected Ġ= ĠArrayList < String >() ĊĠĠĠĠĠĠĠ Ġexpected . add ( F ING ER PRINT ) ĊĠĠĠĠĠĠĠ Ġval Ġactual Ġ= ĠArrayList < String >() ĊĠĠĠĠĠĠĠ Ġactual . add ( F ING ER PRINT ) ĊĠĠĠĠĠĠĠ ĠassertTrue ( package Manager . all Fingerprint s Are Valid ( expected , Ġactual )) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġall Fingerprint s Should Not Be Valid () Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġexpected Ġ= ĠArrayList < String >() ĊĠĠĠĠĠĠĠ Ġexpected . add ( F ING ER PRINT 1 ) ĊĠĠĠĠĠĠĠ Ġval Ġactual Ġ= ĠArrayList < String >() ĊĠĠĠĠĠĠĠ Ġactual . add ( F ING ER PRINT 2 ) ĊĠĠĠĠĠĠĠ ĠassertFalse ( package Manager . all Fingerprint s Are Valid ( expected , Ġactual )) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġall Fingerprint s Should Not Be Valid If Actual Contain Unexpected () Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġactual Ġ= ĠArrayList < String >() ĊĠĠĠĠĠĠĠ Ġactual . add ( EXPECTED _ F ING ER PRINT ) ĊĠĠĠĠĠĠĠ Ġactual . add ( F ING ER PRINT 2 ) ĊĠĠĠĠĠĠĠ ĠassertFalse ( package Manager . all Fingerprint s Are Valid ( EXPECTED _ F ING ER PRINT S , Ġactual )) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Suppress (" DE PREC ATION ") ĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġ@ Throws ( Name NotFoundException :: class , ĠCertificate Exception :: class ) ĊĠĠĠ Ġ@ Config ( sdk Ġ= Ġ[ Build . VERSION _ CODES . O ]) ĊĠĠĠ Ġfun Ġshould Found A Valid Package Below Android P () Ġ{ ĊĊĠĠĠĠĠĠĠ Ġval Ġpackages Ġ= Ġmap Of ( PACKAGE _ NAME 1 Ġto ĠEXPECT ED _ F ING ER PRINT S ) ĊĊĠĠĠĠĠĠĠ Ġmock Resolve Info . activity Info Ġ= Ġmock Activity Info ĊĠĠĠĠĠĠĠ Ġmock Activity Info . packageName Ġ= ĠPACK AGE _ NAME 1 ĊĠĠĠĠĠĠĠ Ġval Ġinfo Ġ= ĠArrayList < Resolve Info >() ĊĠĠĠĠĠĠĠ Ġinfo . add ( mock Resolve Info ) ĊĠĠĠĠĠĠĠ Ġwhenever ( mock PackageManager . query Intent Activities ( any ( Intent :: class . java ), Ġeq ( MATCH _ DEFAULT _ ONLY ))) ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ. thenReturn ( info ) ĊĊĠĠĠĠĠĠĠ Ġval Ġactual Signatures Ġ= ĠarrayOf Null s < Signature >( 1 ) ĊĠĠĠĠĠĠĠ Ġactual Signatures [ 0 ] Ġ= ĠSignature ( PUBLIC _ KEY _ 1 ) ĊĠĠĠĠĠĠĠ Ġmock Package Info . signatures Ġ= Ġactual Signatures ĊĠĠĠĠĠĠĠ Ġwhenever ( mock PackageManager . get Package Info ( eq ( PACKAGE _ NAME 1 ), Ġeq ( GET _ SIGNATURE S ))) ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ. thenReturn ( mock Package Info ) ĊĊĠĠĠĠĠĠĠ Ġwhenever ( mock Fingerprint Factory . create ( PUBLIC _ KEY _ 1 )). thenReturn ( EXPECTED _ F ING ER PRINT ) ĊĊĠĠĠĠĠĠĠ ĠassertTrue ( package Manager . any Valid Package For ( Uri . EMPTY , Ġpackages )) ĊĊĠĠĠĠĠĠĠ Ġverify ( mock PackageManager ). query Intent Activities ( any ( Intent :: class . java ), Ġeq ( MATCH _ DEFAULT _ ONLY )) ĊĠĠĠĠĠĠĠ Ġverify ( mock PackageManager ). get Package Info ( eq ( PACKAGE _ NAME 1 ), Ġeq ( GET _ SIGNATURE S )) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Suppress (" DE PREC ATION ") ĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġ@ Throws ( Name NotFoundException :: class , ĠCertificate Exception :: class ) ĊĠĠĠ Ġ@ Config ( sdk Ġ= Ġ[ Build . VERSION _ CODES . P ]) ĊĠĠĠ Ġfun Ġshould Found A Valid Package Above Android P With Multiple Sign ers () Ġ{ ĊĊĠĠĠĠĠĠĠ Ġval Ġpackages Ġ= Ġmap Of ( PACKAGE _ NAME 1 Ġto ĠEXPECT ED _ F ING ER PRINT S ) ĊĊĠĠĠĠĠĠĠ Ġmock Resolve Info . activity Info Ġ= Ġmock Activity Info ĊĠĠĠĠĠĠĠ Ġmock Activity Info . packageName Ġ= ĠPACK AGE _ NAME 1 ĊĠĠĠĠĠĠĠ Ġval Ġinfo Ġ= ĠArrayList < Resolve Info >() ĊĠĠĠĠĠĠĠ Ġinfo . add ( mock Resolve Info ) ĊĠĠĠĠĠĠĠ Ġwhenever ( mock PackageManager . query Intent Activities ( any ( Intent :: class . java ), Ġeq ( MATCH _ DEFAULT _ ONLY ))) ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ. thenReturn ( info ) ĊĊĠĠĠĠĠĠĠ Ġval Ġactual Signatures Ġ= ĠarrayOf Null s < Signature >( 1 ) ĊĠĠĠĠĠĠĠ Ġactual Signatures [ 0 ] Ġ= ĠSignature ( PUBLIC _ KEY _ 1 ) ĊĊĠĠĠĠĠĠĠ Ġmock Package Info . signing Info Ġ= Ġmock Signing Info ĊĠĠĠĠĠĠĠ Ġwhenever ( mock Signing Info . has Multiple Sign ers ()). thenReturn ( true ) ĊĠĠĠĠĠĠĠ Ġwhenever ( mock Signing Info . apk Contents Sign ers ). thenReturn ( actual Signatures ) ĊĊĠĠĠĠĠĠĠ Ġwhenever ( mock PackageManager . get Package Info ( eq ( PACKAGE _ NAME 1 ), Ġeq ( GET _ SIGN ING _ CER TIF IC ATES ))) ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ. thenReturn ( mock Package Info ) ĊĊĠĠĠĠĠĠĠ Ġwhenever ( mock Fingerprint Factory . create ( PUBLIC _ KEY _ 1 )). thenReturn ( EXPECTED _ F ING ER PRINT ) ĊĊĠĠĠĠĠĠĠ ĠassertTrue ( package Manager . any Valid Package For ( Uri . EMPTY , Ġpackages )) ĊĊĠĠĠĠĠĠĠ Ġverify ( mock Signing Info ). has Multiple Sign ers () ĊĠĠĠĠĠĠĠ Ġverify ( mock Signing Info ). apk Contents Sign ers ĊĠĠĠĠĠĠĠ Ġverify ( mock PackageManager ). query Intent Activities ( any ( Intent :: class . java ), Ġeq ( MATCH _ DEFAULT _ ONLY )) ĊĠĠĠĠĠĠĠ Ġverify ( mock PackageManager ). get Package Info ( eq ( PACKAGE _ NAME 1 ), Ġeq ( GET _ SIGN ING _ CER TIF IC ATES )) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Suppress (" DE PREC ATION ") ĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġ@ Throws ( Name NotFoundException :: class , ĠCertificate Exception :: class ) ĊĠĠĠ Ġ@ Config ( sdk Ġ= Ġ[ Build . VERSION _ CODES . P ]) ĊĠĠĠ Ġfun Ġshould Found A Valid Package Above Android P With Single Signer () Ġ{ ĊĊĠĠĠĠĠĠĠ Ġval Ġpackages Ġ= Ġmap Of ( PACKAGE _ NAME 1 Ġto ĠEXPECT ED _ F ING ER PRINT S ) ĊĊĠĠĠĠĠĠĠ Ġmock Resolve Info . activity Info Ġ= Ġmock Activity Info ĊĠĠĠĠĠĠĠ Ġmock Activity Info . packageName Ġ= ĠPACK AGE _ NAME 1 ĊĠĠĠĠĠĠĠ Ġval Ġinfo Ġ= ĠArrayList < Resolve Info >() ĊĠĠĠĠĠĠĠ Ġinfo . add ( mock Resolve Info ) ĊĠĠĠĠĠĠĠ Ġwhenever ( mock PackageManager . query Intent Activities ( any ( Intent :: class . java ), Ġeq ( MATCH _ DEFAULT _ ONLY ))) ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ. thenReturn ( info ) ĊĊĠĠĠĠĠĠĠ Ġval Ġactual Signatures Ġ= ĠarrayOf Null s < Signature >( 1 ) ĊĠĠĠĠĠĠĠ Ġactual Signatures [ 0 ] Ġ= ĠSignature ( PUBLIC _ KEY _ 1 ) ĊĊĠĠĠĠĠĠĠ Ġmock Package Info . signing Info Ġ= Ġmock Signing Info ĊĠĠĠĠĠĠĠ Ġwhenever ( mock Signing Info . has Multiple Sign ers ()). thenReturn ( false ) ĊĠĠĠĠĠĠĠ Ġwhenever ( mock Signing Info . signing Certificate History ). thenReturn ( actual Signatures ) ĊĊĠĠĠĠĠĠĠ Ġwhenever ( mock PackageManager . get Package Info ( eq ( PACKAGE _ NAME 1 ), Ġeq ( GET _ SIGN ING _ CER TIF IC ATES ))) ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ. thenReturn ( mock Package Info ) ĊĊĠĠĠĠĠĠĠ Ġwhenever ( mock Fingerprint Factory . create ( PUBLIC _ KEY _ 1 )). thenReturn ( EXPECTED _ F ING ER PRINT ) ĊĊĠĠĠĠĠĠĠ ĠassertTrue ( package Manager . any Valid Package For ( Uri . EMPTY , Ġpackages )) ĊĊĠĠĠĠĠĠĠ Ġverify ( mock Signing Info ). has Multiple Sign ers () ĊĠĠĠĠĠĠĠ Ġverify ( mock Signing Info ). signing Certificate History ĊĠĠĠĠĠĠĠ Ġverify ( mock PackageManager ). query Intent Activities ( any ( Intent :: class . java ), Ġeq ( MATCH _ DEFAULT _ ONLY )) ĊĠĠĠĠĠĠĠ Ġverify ( mock PackageManager ). get Package Info ( eq ( PACKAGE _ NAME 1 ), Ġeq ( GET _ SIGN ING _ CER TIF IC ATES )) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġshould NotFound Any Valid Package If No Activity Handling Uri () Ġ{ ĊĊĠĠĠĠĠĠĠ Ġval Ġpackages Ġ= Ġmap Of ( PACKAGE _ NAME 1 Ġto Ġarray ListOf < String >()) ĊĊĠĠĠĠĠĠĠ Ġwhenever ( mock PackageManager . query Intent Activities ( any ( Intent :: class . java ), Ġeq ( MATCH _ DEFAULT _ ONLY ))) ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ. thenReturn ( ArrayList ()) ĊĊĠĠĠĠĠĠĠ ĠassertFalse ( package Manager . any Valid Package For ( Uri . EMPTY , Ġpackages )) ĊĊĠĠĠĠĠĠĠ Ġverify ( mock PackageManager ). query Intent Activities ( any ( Intent :: class . java ), Ġeq ( MATCH _ DEFAULT _ ONLY )) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġshould NotFound Any Valid Package If Activity Handling Uri Not Matching PackageName () Ġ{ ĊĊĠĠĠĠĠĠĠ Ġval Ġpackages Ġ= Ġmap Of ( PACKAGE _ NAME 1 Ġto Ġarray ListOf < String >()) ĊĊĠĠĠĠĠĠĠ Ġmock Resolve Info . activity Info Ġ= Ġmock Activity Info ĊĠĠĠĠĠĠĠ Ġmock Activity Info . packageName Ġ= ĠPACK AGE _ NAME 2 ĊĠĠĠĠĠĠĠ Ġval Ġinfo Ġ= ĠArrayList < Resolve Info >() ĊĠĠĠĠĠĠĠ Ġinfo . add ( mock Resolve Info ) ĊĠĠĠĠĠĠĠ Ġwhenever ( mock PackageManager . query Intent Activities ( any ( Intent :: class . java ), Ġeq ( MATCH _ DEFAULT _ ONLY ))) ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ. thenReturn ( info ) ĊĊĠĠĠĠĠĠĠ ĠassertFalse ( package Manager . any Valid Package For ( Uri . EMPTY , Ġpackages )) ĊĊĠĠĠĠĠĠĠ Ġverify ( mock PackageManager ). query Intent Activities ( any ( Intent :: class . java ), Ġeq ( MATCH _ DEFAULT _ ONLY )) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Suppress (" DE PREC ATION ") ĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġ@ Throws ( Name NotFoundException :: class , ĠCertificate Exception :: class ) ĊĠĠĠ Ġ@ Config ( sdk Ġ= Ġ[ Build . VERSION _ CODES . O ]) ĊĠĠĠ Ġfun Ġshould NotFound Any Valid Package Below Android PI f Matching PackageName But Not Matching All Fingerprint s () Ġ{ ĊĊĠĠĠĠĠĠĠ Ġval Ġexpected Fingerprint Ġ= Ġ" EXPECTED _ PACKAGE _ F ING ER PRINT " ĊĠĠĠĠĠĠĠ Ġval Ġexpected Fingerprint s Ġ= ĠArrayList < String >() ĊĠĠĠĠĠĠĠ Ġexpected Fingerprint s . add ( expected Fingerprint ) ĊĠĠĠĠĠĠĠ Ġval Ġpackages Ġ= Ġmap Of ( PACKAGE _ NAME 1 Ġto Ġexpected Fingerprint s ) ĊĊĠĠĠĠĠĠĠ Ġmock Resolve Info . activity Info Ġ= Ġmock Activity Info ĊĠĠĠĠĠĠĠ Ġmock Activity Info . packageName Ġ= ĠPACK AGE _ NAME 1 ĊĠĠĠĠĠĠĠ Ġval Ġinfo Ġ= ĠArrayList < Resolve Info >() ĊĠĠĠĠĠĠĠ Ġinfo . add ( mock Resolve Info ) ĊĠĠĠĠĠĠĠ Ġwhenever ( mock PackageManager . query Intent Activities ( any ( Intent :: class . java ), Ġeq ( MATCH _ DEFAULT _ ONLY ))) ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ. thenReturn ( info ) ĊĊĠĠĠĠĠĠĠ Ġval Ġactual Signatures Ġ= ĠarrayOf Null s < Signature >( 2 ) ĊĠĠĠĠĠĠĠ Ġactual Signatures [ 0 ] Ġ= ĠSignature ( PUBLIC _ KEY _ 1 ) ĊĠĠĠĠĠĠĠ Ġactual Signatures [ 1 ] Ġ= ĠSignature ( PUBLIC _ KEY _ 2 ) ĊĊĠĠĠĠĠĠĠ Ġmock Package Info . signatures Ġ= Ġactual Signatures ĊĊĠĠĠĠĠĠĠ Ġwhenever ( mock PackageManager . get Package Info ( eq ( PACKAGE _ NAME 1 ), Ġeq ( GET _ SIGNATURE S ))) ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ. thenReturn ( mock Package Info ) ĊĊĠĠĠĠĠĠĠ Ġwhenever ( mock Fingerprint Factory . create ( PUBLIC _ KEY _ 1 )). thenReturn ( expected Fingerprint ) ĊĠĠĠĠĠĠĠ Ġwhenever ( mock Fingerprint Factory . create ( PUBLIC _ KEY _ 2 )). thenReturn (" ANY ") ĊĊĠĠĠĠĠĠĠ ĠassertFalse ( package Manager . any Valid Package For ( Uri . EMPTY , Ġpackages )) ĊĊĠĠĠĠĠĠĠ Ġverify ( mock PackageManager ). query Intent Activities ( any ( Intent :: class . java ), Ġeq ( MATCH _ DEFAULT _ ONLY )) ĊĠĠĠĠĠĠĠ Ġverify ( mock PackageManager ). get Package Info ( eq ( PACKAGE _ NAME 1 ), Ġeq ( GET _ SIGNATURE S )) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġ@ Throws ( Name NotFoundException :: class , ĠCertificate Exception :: class ) ĊĠĠĠ Ġ@ Config ( sdk Ġ= Ġ[ Build . VERSION _ CODES . P ]) ĊĠĠĠ Ġfun Ġshould NotFound Any Valid Package Above Android P With Multiple Sign ers If Matching PackageName But Not Matching All Fingerprint s () Ġ{ ĊĊĠĠĠĠĠĠĠ Ġval Ġexpected Fingerprint Ġ= Ġ" EXPECTED _ PACKAGE _ F ING ER PRINT " ĊĠĠĠĠĠĠĠ Ġval Ġexpected Fingerprint s Ġ= ĠArrayList < String >() ĊĠĠĠĠĠĠĠ Ġexpected Fingerprint s . add ( expected Fingerprint ) ĊĠĠĠĠĠĠĠ Ġval Ġpackages Ġ= Ġmap Of ( PACKAGE _ NAME 1 Ġto Ġexpected Fingerprint s ) ĊĊĠĠĠĠĠĠĠ Ġmock Resolve Info . activity Info Ġ= Ġmock Activity Info ĊĠĠĠĠĠĠĠ Ġmock Activity Info . packageName Ġ= ĠPACK AGE _ NAME 1 ĊĠĠĠĠĠĠĠ Ġval Ġinfo Ġ= ĠArrayList < Resolve Info >() ĊĠĠĠĠĠĠĠ Ġinfo . add ( mock Resolve Info ) ĊĠĠĠĠĠĠĠ Ġwhenever ( mock PackageManager . query Intent Activities ( any ( Intent :: class . java ), Ġeq ( MATCH _ DEFAULT _ ONLY ))) ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ. thenReturn ( info ) ĊĊĊĠĠĠĠĠĠĠ Ġval Ġactual Signatures Ġ= ĠarrayOf Null s < Signature >( 2 ) ĊĠĠĠĠĠĠĠ Ġactual Signatures [ 0 ] Ġ= ĠSignature ( PUBLIC _ KEY _ 1 ) ĊĠĠĠĠĠĠĠ Ġactual Signatures [ 1 ] Ġ= ĠSignature ( PUBLIC _ KEY _ 2 ) ĊĊĠĠĠĠĠĠĠ Ġmock Package Info . signing Info Ġ= Ġmock Signing Info ĊĠĠĠĠĠĠĠ Ġwhenever ( mock Signing Info . has Multiple Sign ers ()). thenReturn ( true ) ĊĠĠĠĠĠĠĠ Ġwhenever ( mock Signing Info . apk Contents Sign ers ). thenReturn ( actual Signatures ) ĊĊĠĠĠĠĠĠĠ Ġwhenever ( mock PackageManager . get Package Info ( eq ( PACKAGE _ NAME 1 ), Ġeq ( GET _ SIGN ING _ CER TIF IC ATES ))) ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ. thenReturn ( mock Package Info ) ĊĊĠĠĠĠĠĠĠ Ġwhenever ( mock Fingerprint Factory . create ( PUBLIC _ KEY _ 1 )). thenReturn ( expected Fingerprint ) ĊĠĠĠĠĠĠĠ Ġwhenever ( mock Fingerprint Factory . create ( PUBLIC _ KEY _ 2 )). thenReturn (" ANY ") ĊĊĠĠĠĠĠĠĠ ĠassertFalse ( package Manager . any Valid Package For ( Uri . EMPTY , Ġpackages )) ĊĊĠĠĠĠĠĠĠ Ġverify ( mock PackageManager ). query Intent Activities ( any ( Intent :: class . java ), Ġeq ( MATCH _ DEFAULT _ ONLY )) ĊĠĠĠĠĠĠĠ Ġverify ( mock PackageManager ). get Package Info ( eq ( PACKAGE _ NAME 1 ), Ġeq ( GET _ SIGN ING _ CER TIF IC ATES )) ĊĠĠĠĠĠĠĠ Ġverify ( mock Signing Info ). has Multiple Sign ers () ĊĠĠĠĠĠĠĠ Ġverify ( mock Signing Info ). apk Contents Sign ers ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġ@ Throws ( Name NotFoundException :: class , ĠCertificate Exception :: class ) ĊĠĠĠ Ġ@ Config ( sdk Ġ= Ġ[ Build . VERSION _ CODES . P ]) ĊĠĠĠ Ġfun Ġshould NotFound Any Valid Package Above Android P With Single Signer If Matching PackageName But Not Matching All Fingerprint s () Ġ{ ĊĊĠĠĠĠĠĠĠ Ġval Ġexpected Fingerprint Ġ= Ġ" EXPECTED _ PACKAGE _ F ING ER PRINT " ĊĠĠĠĠĠĠĠ Ġval Ġexpected Fingerprint s Ġ= ĠArrayList < String >() ĊĠĠĠĠĠĠĠ Ġexpected Fingerprint s . add ( expected Fingerprint ) ĊĠĠĠĠĠĠĠ Ġval Ġpackages Ġ= Ġmap Of ( PACKAGE _ NAME 1 Ġto Ġexpected Fingerprint s ) ĊĊĠĠĠĠĠĠĠ Ġmock Resolve Info . activity Info Ġ= Ġmock Activity Info ĊĠĠĠĠĠĠĠ Ġmock Activity Info . packageName Ġ= ĠPACK AGE _ NAME 1 ĊĠĠĠĠĠĠĠ Ġval Ġinfo Ġ= ĠArrayList < Resolve Info >() ĊĠĠĠĠĠĠĠ Ġinfo . add ( mock Resolve Info ) ĊĠĠĠĠĠĠĠ Ġwhenever ( mock PackageManager . query Intent Activities ( any ( Intent :: class . java ), Ġeq ( MATCH _ DEFAULT _ ONLY ))) ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ. thenReturn ( info ) ĊĊĊĠĠĠĠĠĠĠ Ġval Ġactual Signatures Ġ= ĠarrayOf Null s < Signature >( 2 ) ĊĠĠĠĠĠĠĠ Ġactual Signatures [ 0 ] Ġ= ĠSignature ( PUBLIC _ KEY _ 1 ) ĊĠĠĠĠĠĠĠ Ġactual Signatures [ 1 ] Ġ= ĠSignature ( PUBLIC _ KEY _ 2 ) ĊĊĠĠĠĠĠĠĠ Ġmock Package Info . signing Info Ġ= Ġmock Signing Info ĊĠĠĠĠĠĠĠ Ġwhenever ( mock Signing Info . has Multiple Sign ers ()). thenReturn ( false ) ĊĠĠĠĠĠĠĠ Ġwhenever ( mock Signing Info . signing Certificate History ). thenReturn ( actual Signatures ) ĊĊĠĠĠĠĠĠĠ Ġwhenever ( mock PackageManager . get Package Info ( eq ( PACKAGE _ NAME 1 ), Ġeq ( GET _ SIGN ING _ CER TIF IC ATES ))) ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ. thenReturn ( mock Package Info ) ĊĊĠĠĠĠĠĠĠ Ġwhenever ( mock Fingerprint Factory . create ( PUBLIC _ KEY _ 1 )). thenReturn ( expected Fingerprint ) ĊĠĠĠĠĠĠĠ Ġwhenever ( mock Fingerprint Factory . create ( PUBLIC _ KEY _ 2 )). thenReturn (" ANY ") ĊĊĠĠĠĠĠĠĠ ĠassertFalse ( package Manager . any Valid Package For ( Uri . EMPTY , Ġpackages )) ĊĊĠĠĠĠĠĠĠ Ġverify ( mock PackageManager ). query Intent Activities ( any ( Intent :: class . java ), Ġeq ( MATCH _ DEFAULT _ ONLY )) ĊĠĠĠĠĠĠĠ Ġverify ( mock PackageManager ). get Package Info ( eq ( PACKAGE _ NAME 1 ), Ġeq ( GET _ SIGN ING _ CER TIF IC ATES )) ĊĠĠĠĠĠĠĠ Ġverify ( mock Signing Info ). has Multiple Sign ers () ĊĠĠĠĠĠĠĠ Ġverify ( mock Signing Info ). signing Certificate History ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Suppress (" DE PREC ATION ") ĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġ@ Throws ( Certificate Exception :: class , ĠName NotFoundException :: class ) ĊĠĠĠ Ġ@ Config ( sdk Ġ= Ġ[ Build . VERSION _ CODES . O ]) ĊĠĠĠ Ġfun Ġshould Catch Certificate Exception And Ignore Certificate Below Android P () Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġsignatures Ġ= ĠarrayOf Null s < Signature >( 1 ) ĊĠĠĠĠĠĠĠ Ġval ĠbyteArray Ġ= ĠByteArray ( 0 ) ĊĠĠĠĠĠĠĠ Ġsignatures [ 0 ] Ġ= Ġmock Signature ĊĠĠĠĠĠĠĠ Ġmock Package Info . signatures Ġ= Ġsignatures ĊĠĠĠĠĠĠĠ Ġwhenever ( mock PackageManager . get Package Info ( eq ( PACKAGE _ NAME 1 ), Ġeq ( GET _ SIGNATURE S ))) ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ. thenReturn ( mock Package Info ) ĊĊĠĠĠĠĠĠĠ Ġwhenever ( mock Signature . toByteArray ()). thenReturn ( byteArray ) ĊĠĠĠĠĠĠĠ Ġwhenever ( mock Fingerprint Factory . create ( byteArray )). then Throw ( Certificate Exception :: class . java ) ĊĊĠĠĠĠĠĠĠ Ġval Ġfingerprint s Ġ= Ġpackage Manager . get Certificate Fingerprint s ( PACKAGE _ NAME 1 ) ĊĊĠĠĠĠĠĠĠ ĠassertTrue ( fingerprint s . isEmpty ()) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġ@ Throws ( Certificate Exception :: class , ĠName NotFoundException :: class ) ĊĠĠĠ Ġ@ Config ( sdk Ġ= Ġ[ Build . VERSION _ CODES . P ]) ĊĠĠĠ Ġfun Ġshould Catch Certificate Exception And Ignore Certificate Above Android P With Multiple Sign ers () Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġsignatures Ġ= ĠarrayOf Null s < Signature >( 1 ) ĊĠĠĠĠĠĠĠ Ġval ĠbyteArray Ġ= ĠByteArray ( 0 ) ĊĠĠĠĠĠĠĠ Ġsignatures [ 0 ] Ġ= Ġmock Signature ĊĊĠĠĠĠĠĠĠ Ġmock Package Info . signing Info Ġ= Ġmock Signing Info ĊĠĠĠĠĠĠĠ Ġwhenever ( mock Signing Info . has Multiple Sign ers ()). thenReturn ( true ) ĊĠĠĠĠĠĠĠ Ġwhenever ( mock Signing Info . apk Contents Sign ers ). thenReturn ( signatures ) ĊĊĠĠĠĠĠĠĠ Ġwhenever ( mock PackageManager . get Package Info ( eq ( PACKAGE _ NAME 1 ), Ġeq ( GET _ SIGN ING _ CER TIF IC ATES ))) ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ. thenReturn ( mock Package Info ) ĊĊĠĠĠĠĠĠĠ Ġwhenever ( mock Signature . toByteArray ()). thenReturn ( byteArray ) ĊĠĠĠĠĠĠĠ Ġwhenever ( mock Fingerprint Factory . create ( byteArray )). then Throw ( Certificate Exception :: class . java ) ĊĊĠĠĠĠĠĠĠ Ġval Ġfingerprint s Ġ= Ġpackage Manager . get Certificate Fingerprint s ( PACKAGE _ NAME 1 ) ĊĊĠĠĠĠĠĠĠ ĠassertTrue ( fingerprint s . isEmpty ()) ĊĠĠĠĠĠĠĠ Ġverify ( mock Signing Info ). has Multiple Sign ers () ĊĠĠĠĠĠĠĠ Ġverify ( mock Signing Info ). apk Contents Sign ers ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġ@ Throws ( Certificate Exception :: class , ĠName NotFoundException :: class ) ĊĠĠĠ Ġ@ Config ( sdk Ġ= Ġ[ Build . VERSION _ CODES . P ]) ĊĠĠĠ Ġfun Ġshould Catch Certificate Exception And Ignore Certificate Above Android P With Single Signer () Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġsignatures Ġ= ĠarrayOf Null s < Signature >( 1 ) ĊĠĠĠĠĠĠĠ Ġval ĠbyteArray Ġ= ĠByteArray ( 0 ) ĊĠĠĠĠĠĠĠ Ġsignatures [ 0 ] Ġ= Ġmock Signature ĊĊĠĠĠĠĠĠĠ Ġmock Package Info . signing Info Ġ= Ġmock Signing Info ĊĠĠĠĠĠĠĠ Ġwhenever ( mock Signing Info . has Multiple Sign ers ()). thenReturn ( false ) ĊĠĠĠĠĠĠĠ Ġwhenever ( mock Signing Info . signing Certificate History ). thenReturn ( signatures ) ĊĊĠĠĠĠĠĠĠ Ġwhenever ( mock PackageManager . get Package Info ( eq ( PACKAGE _ NAME 1 ), Ġeq ( GET _ SIGN ING _ CER TIF IC ATES ))) ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ. thenReturn ( mock Package Info ) ĊĊĠĠĠĠĠĠĠ Ġwhenever ( mock Signature . toByteArray ()). thenReturn ( byteArray ) ĊĠĠĠĠĠĠĠ Ġwhenever ( mock Fingerprint Factory . create ( byteArray )). then Throw ( Certificate Exception :: class . java ) ĊĊĠĠĠĠĠĠĠ Ġval Ġfingerprint s Ġ= Ġpackage Manager . get Certificate Fingerprint s ( PACKAGE _ NAME 1 ) ĊĊĠĠĠĠĠĠĠ ĠassertTrue ( fingerprint s . isEmpty ()) ĊĠĠĠĠĠĠĠ Ġverify ( mock Signing Info ). has Multiple Sign ers () ĊĠĠĠĠĠĠĠ Ġverify ( mock Signing Info ). signing Certificate History ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġcompanion Ġobject Ġ{ ĊĠĠĠĠĠĠĠ Ġprivate Ġconst Ġval ĠPACK AGE _ NAME 1 Ġ= Ġ" PACKAGE _ NAME 1 " ĊĠĠĠĠĠĠĠ Ġprivate Ġconst Ġval ĠPACK AGE _ NAME 2 Ġ= Ġ" PACKAGE _ NAME 2 " ĊĠĠĠĠĠĠĠ Ġprivate Ġconst Ġval ĠF ING ER PRINT Ġ= Ġ" F ING ER PRINT " ĊĊĠĠĠĠĠĠĠ Ġprivate Ġconst Ġval ĠF ING ER PRINT 1 Ġ= Ġ" F ING ER PRINT 1 " ĊĠĠĠĠĠĠĠ Ġprivate Ġconst Ġval ĠF ING ER PRINT 2 Ġ= Ġ" F ING ER PRINT 2 " ĊĊĠĠĠĠĠĠĠ Ġprivate Ġval ĠPUBLIC _ KEY _ 1 Ġ= Ġ" PUBLIC _ KEY 1 ". toByteArray () ĊĠĠĠĠĠĠĠ Ġprivate Ġval ĠPUBLIC _ KEY _ 2 Ġ= Ġ" PUBLIC _ KEY 2 ". toByteArray () ĊĊĠĠĠĠĠĠĠ Ġconst Ġval ĠEXPECT ED _ F ING ER PRINT Ġ= Ġ" EXPECTED _ F ING ER PRINT " ĊĠĠĠĠĠĠĠ Ġval ĠEXPECT ED _ F ING ER PRINT S Ġ= ĠlistOf ( EXPECTED _ F ING ER PRINT ) ĊĠĠĠ Ġ} Ċ } Ċ