package Ġcom . mapbox . navigation . ui . maps . building . api Ċ Ċ import Ġcom . mapbox . bindgen . Expected Ċ import Ġcom . mapbox . bindgen . Expected Factory Ċ import Ġcom . mapbox . geojson . Feature Ċ import Ġcom . mapbox . geojson . Point Ċ import Ġcom . mapbox . maps . Map box Map Ċ import Ġcom . mapbox . maps . Qu er ied Feature Ċ import Ġcom . mapbox . maps . Query Features Callback Ċ import Ġcom . mapbox . maps . Screen Coordinate Ċ import Ġcom . mapbox . navigation . base . trip . model . Route Progress Ċ import Ġcom . mapbox . navigation . testing . FileUtils Ċ import Ġcom . mapbox . navigation . testing . Main Coroutine Rule Ċ import Ġcom . mapbox . navigation . ui . base . util . Map box Navigation Consumer Ċ import Ġcom . mapbox . navigation . ui . maps . building . Building Action Ċ import Ġcom . mapbox . navigation . ui . maps . building . Building Processor Ċ import Ġcom . mapbox . navigation . ui . maps . building . Building Result Ċ import Ġcom . mapbox . navigation . ui . maps . building . model . Building Error Ċ import Ġcom . mapbox . navigation . ui . maps . building . model . Building Value Ċ import Ġcom . mapbox . navigation . utils . internal . Internal Job Control Factory Ċ import Ġcom . mapbox . navigation . utils . internal . Job Control Ċ import Ġio . mock k . co Every Ċ import Ġio . mock k . every Ċ import Ġio . mock k . mock k Ċ import Ġio . mock k . mock k Object Ċ import Ġio . mock k . slot Ċ import Ġio . mock k . un mock k Object Ċ import Ġio . mock k . verify Ċ import Ġkotlinx . coroutines . Comp letable Job Ċ import Ġkotlinx . coroutines . Experimental Cor outines Api Ċ import Ġkotlinx . coroutines . cancel Children Ċ import Ġorg . junit . After Ċ import Ġorg . junit . Assert . assertEquals Ċ import Ġorg . junit . Before Ċ import Ġorg . junit . Rule Ċ import Ġorg . junit . Test Ċ Ċ @ Experimental Cor outines Api Ċ class ĠMap box Build ings Api Test Ġ{ ĊĊĠĠĠ Ġ@ get : Rule ĊĠĠĠ Ġvar Ġcoroutine Rule Ġ= ĠMain Coroutine Rule () ĊĊĠĠĠ Ġprivate Ġval Ġconsumer : ĊĠĠĠĠĠĠĠ ĠMap box Navigation Consumer < Expected < Building Error , ĠBuilding Value >> Ġ= Ġmock k ( relax ed Ġ= Ġtrue ) ĊĊĠĠĠ Ġ@ Before ĊĠĠĠ Ġfun ĠsetUp () Ġ{ ĊĠĠĠĠĠĠĠ Ġmock k Object ( Building Processor ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ After ĊĠĠĠ Ġfun ĠtearDown () Ġ{ ĊĠĠĠĠĠĠĠ Ġun mock k Object ( Building Processor ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġ` map Ġquery Ġrendered Ġfeature Ġfails Ġno Ġop `() Ġ= Ġcoroutine Rule . run Blocking Test Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġqueried Features Expected : ĠExpected < String , ĠList < Qu er ied Feature >> Ġ= Ġmock k Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġevery Ġ{ Ġvalue Ġ} Ġreturns Ġnull ĊĠĠĠĠĠĠĠĠĠĠĠ Ġevery Ġ{ Ġerror Ġ} Ġreturns Ġ" wh atever " ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠĠĠĠĠ Ġval Ġmap box Map : ĠMap box Map Ġ= Ġmock k Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġevery Ġ{ Ġquery Rendered Features ( any < Screen Coordinate >(), Ġany (), Ġany ()) Ġ} Ġanswers Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġthird Arg < Query Features Callback >(). run ( quer ied Features Expected ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ} ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠĠĠĠĠ Ġval Ġmock Point Ġ= ĠPoint . from Lng Lat ( 1 2 3 . 3 4 3 4 , Ġ- 3 7 . 4 5 6 7 ) ĊĠĠĠĠĠĠĠ Ġval Ġmock Action Ġ= ĠBuilding Action . Query Building ( mock Point , Ġmap box Map ) ĊĠĠĠĠĠĠĠ Ġval Ġmock Result Ġ= ĠBuilding Result . Qu er ied Build ings ( ĊĠĠĠĠĠĠĠĠĠĠĠ ĠExpected Factory . create Error ( Building Error ( quer ied Features Expected . error )) ĊĠĠĠĠĠĠĠ Ġ) ĊĠĠĠĠĠĠĠ Ġval Ġmessage Slot Ġ= Ġslot < Expected < Building Error , ĠBuilding Value >>() ĊĠĠĠĠĠĠĠ Ġco Every Ġ{ ĠBuilding Processor . query Building ( mock Action ) Ġ} Ġreturns Ġmock Result ĊĠĠĠĠĠĠĠ Ġval Ġbuild ings Api Ġ= ĠMap box Build ings Api ( mapbox Map ) ĊĊĠĠĠĠĠĠĠ Ġbuild ings Api . query Building To Highlight ( mock Point , Ġconsumer ) ĊĊĠĠĠĠĠĠĠ Ġverify ( exact ly Ġ= Ġ 1 ) Ġ{ Ġconsumer . accept ( capture ( message Slot )) Ġ} ĊĠĠĠĠĠĠĠ ĠassertEquals (" wh atever ", Ġmessage Slot . captured . error ?. errorMessage ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġ` map Ġquery Ġrendered Ġfeature Ġreturns Ġlist Ġof Ġqueried Ġfeatures `() Ġ= ĊĠĠĠĠĠĠĠ Ġcoroutine Rule . run Blocking Test Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġval Ġqueried Features Expected Ġ= Ġmock Success Qu er ied Feature () ĊĠĠĠĠĠĠĠĠĠĠĠ Ġval Ġmap box Map : ĠMap box Map Ġ= Ġmock k Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġevery Ġ{ Ġquery Rendered Features ( any < Screen Coordinate >(), Ġany (), Ġany ()) Ġ} Ġanswers Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġthird Arg < Query Features Callback >(). run ( quer ied Features Expected ) ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ} ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ} ĊĠĠĠĠĠĠĠĠĠĠĠ Ġval Ġmock Point Ġ= ĠPoint . from Lng Lat ( 1 2 3 . 3 4 3 4 , Ġ- 3 7 . 4 5 6 7 ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġval Ġmock Action Ġ= ĠBuilding Action . Query Building ( mock Point , Ġmap box Map ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġval Ġmock Result Ġ= ĠBuilding Result . Qu er ied Build ings ( ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ ĠExpected Factory . create Value ( ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ ĠBuilding Value ( quer ied Features Expected . value Ġ?: Ġempty List ()) ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġval Ġmessage Slot Ġ= Ġslot < Expected < Building Error , ĠBuilding Value >>() ĊĠĠĠĠĠĠĠĠĠĠĠ Ġco Every Ġ{ ĠBuilding Processor . query Building ( mock Action ) Ġ} Ġreturns Ġmock Result ĊĠĠĠĠĠĠĠĠĠĠĠ Ġval Ġbuild ings Api Ġ= ĠMap box Build ings Api ( mapbox Map ) ĊĊĠĠĠĠĠĠĠĠĠĠĠ Ġbuild ings Api . query Building To Highlight ( mock Point , Ġconsumer ) ĊĊĠĠĠĠĠĠĠĠĠĠĠ Ġverify ( exact ly Ġ= Ġ 1 ) Ġ{ Ġconsumer . accept ( capture ( message Slot )) Ġ} ĊĠĠĠĠĠĠĠĠĠĠĠ ĠassertEquals ( quer ied Features Expected . value , Ġmessage Slot . captured . value ?. build ings ) ĊĠĠĠĠĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġ` query Ġbuilding Ġon Ġway point Ġar rival Ġwith Ġnull Ġpoint `() Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġmock Route Progress Ġ= Ġmock k < Route Progress >( relax ed Ġ= Ġtrue ) ĊĠĠĠĠĠĠĠ Ġval Ġmap box Map Ġ= Ġmock k < Map box Map >() ĊĠĠĠĠĠĠĠ Ġval Ġmock Action Ġ= ĠBuilding Action . Query Building On Waypoint ( mock Route Progress ) ĊĠĠĠĠĠĠĠ Ġval Ġmock Result Ġ= ĠBuilding Result . Get Destination ( null ) ĊĠĠĠĠĠĠĠ Ġval Ġmessage Slot Ġ= Ġslot < Expected < Building Error , ĠBuilding Value >>() ĊĠĠĠĠĠĠĠ Ġco Every Ġ{ ĠBuilding Processor . query Building On Waypoint ( mock Action ) Ġ} Ġreturns Ġmock Result ĊĠĠĠĠĠĠĠ Ġval ĠerrorMessage Ġ= Ġ" waypoint Ġinside Ġ$ mock Route Progress Ġis Ġnull " ĊĠĠĠĠĠĠĠ Ġval Ġbuild ings Api Ġ= ĠMap box Build ings Api ( mapbox Map ) ĊĊĠĠĠĠĠĠĠ Ġbuild ings Api . query Building On Waypoint ( mock Route Progress , Ġconsumer ) ĊĊĠĠĠĠĠĠĠ Ġverify ( exact ly Ġ= Ġ 1 ) Ġ{ Ġconsumer . accept ( capture ( message Slot )) Ġ} ĊĠĠĠĠĠĠĠ ĠassertEquals ( errorMessage , Ġmessage Slot . captured . error ?. errorMessage ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġ` query Ġbuilding Ġon Ġway point Ġar rival Ġwith Ġsome Ġvalue `() Ġ= Ġcoroutine Rule . run Blocking Test Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġqueried Features Expected Ġ= Ġmock Success Qu er ied Feature () ĊĠĠĠĠĠĠĠ Ġval Ġmock Point Ġ= ĠPoint . from Lng Lat (- 1 2 3 . 4 5 6 7 , Ġ 3 7 . 8 7 6 5 ) ĊĠĠĠĠĠĠĠ Ġval Ġmock Route Progress Ġ= Ġmock k < Route Progress >( relax ed Ġ= Ġtrue ) ĊĠĠĠĠĠĠĠ Ġval Ġmock Action Ġ= ĠBuilding Action . Query Building On Waypoint ( mock Route Progress ) ĊĠĠĠĠĠĠĠ Ġval Ġmock Result Ġ= ĠBuilding Result . Get Destination ( mock Point ) ĊĠĠĠĠĠĠĠ Ġco Every Ġ{ ĠBuilding Processor . query Building On Waypoint ( mock Action ) Ġ} Ġreturns Ġmock Result ĊĠĠĠĠĠĠĠ Ġval Ġmap box Map : ĠMap box Map Ġ= Ġmock k Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġevery Ġ{ Ġquery Rendered Features ( any < Screen Coordinate >(), Ġany (), Ġany ()) Ġ} Ġanswers Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġthird Arg < Query Features Callback >(). run ( quer ied Features Expected ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ} ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠĠĠĠĠ Ġval Ġmock Point Action Ġ= ĠBuilding Action . Query Building ( mock Point , Ġmap box Map ) ĊĠĠĠĠĠĠĠ Ġval Ġmock Point Result Ġ= ĠBuilding Result . Qu er ied Build ings ( ĊĠĠĠĠĠĠĠĠĠĠĠ ĠExpected Factory . create Value ( ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ ĠBuilding Value ( quer ied Features Expected . value Ġ?: Ġempty List ()) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ) ĊĠĠĠĠĠĠĠ Ġ) ĊĠĠĠĠĠĠĠ Ġco Every Ġ{ ĠBuilding Processor . query Building ( mock Point Action ) Ġ} Ġreturns Ġmock Point Result ĊĠĠĠĠĠĠĠ Ġval Ġmessage Slot Ġ= Ġslot < Expected < Building Error , ĠBuilding Value >>() ĊĠĠĠĠĠĠĠ Ġval Ġbuild ings Api Ġ= ĠMap box Build ings Api ( mapbox Map ) ĊĊĠĠĠĠĠĠĠ Ġbuild ings Api . query Building On Waypoint ( mock Route Progress , Ġconsumer ) ĊĊĠĠĠĠĠĠĠ Ġverify ( exact ly Ġ= Ġ 1 ) Ġ{ Ġconsumer . accept ( capture ( message Slot )) Ġ} ĊĠĠĠĠĠĠĠ ĠassertEquals ( quer ied Features Expected . value , Ġmessage Slot . captured . value ?. build ings ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġ` query Ġbuilding Ġon Ġdestination Ġar rival Ġwith Ġnull Ġpoint `() Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġmock Route Progress Ġ= Ġmock k < Route Progress >( relax ed Ġ= Ġtrue ) ĊĠĠĠĠĠĠĠ Ġval Ġmap box Map Ġ= Ġmock k < Map box Map >() ĊĠĠĠĠĠĠĠ Ġval Ġmock Action Ġ= ĠBuilding Action . Query Building On Final Destination ( mock Route Progress ) ĊĠĠĠĠĠĠĠ Ġval Ġmock Result Ġ= ĠBuilding Result . Get Destination ( null ) ĊĠĠĠĠĠĠĠ Ġval Ġmessage Slot Ġ= Ġslot < Expected < Building Error , ĠBuilding Value >>() ĊĠĠĠĠĠĠĠ Ġco Every Ġ{ ĠBuilding Processor . query Building On Final Destination ( mock Action ) Ġ} Ġreturns Ġmock Result ĊĠĠĠĠĠĠĠ Ġval ĠerrorMessage Ġ= Ġ" final Ġdestination Ġpoint Ġinside Ġ$ mock Route Progress Ġis Ġnull " ĊĠĠĠĠĠĠĠ Ġval Ġbuild ings Api Ġ= ĠMap box Build ings Api ( mapbox Map ) ĊĊĠĠĠĠĠĠĠ Ġbuild ings Api . query Building On Final Destination ( mock Route Progress , Ġconsumer ) ĊĊĠĠĠĠĠĠĠ Ġverify ( exact ly Ġ= Ġ 1 ) Ġ{ Ġconsumer . accept ( capture ( message Slot )) Ġ} ĊĠĠĠĠĠĠĠ ĠassertEquals ( errorMessage , Ġmessage Slot . captured . error ?. errorMessage ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġ` query Ġbuilding Ġon Ġdestination Ġar rival Ġwith Ġsome Ġvalue `() Ġ= Ġcoroutine Rule . run Blocking Test Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġqueried Features Expected Ġ= Ġmock Success Qu er ied Feature () ĊĠĠĠĠĠĠĠ Ġval Ġmock Point Ġ= ĠPoint . from Lng Lat (- 1 2 3 . 4 5 6 7 , Ġ 3 7 . 8 7 6 5 ) ĊĠĠĠĠĠĠĠ Ġval Ġmock Route Progress Ġ= Ġmock k < Route Progress >( relax ed Ġ= Ġtrue ) ĊĠĠĠĠĠĠĠ Ġval Ġmock Action Ġ= ĠBuilding Action . Query Building On Final Destination ( mock Route Progress ) ĊĠĠĠĠĠĠĠ Ġval Ġmock Result Ġ= ĠBuilding Result . Get Destination ( mock Point ) ĊĠĠĠĠĠĠĠ Ġco Every Ġ{ ĠBuilding Processor . query Building On Final Destination ( mock Action ) Ġ} Ġreturns Ġmock Result ĊĠĠĠĠĠĠĠ Ġval Ġmap box Map : ĠMap box Map Ġ= Ġmock k Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġevery Ġ{ Ġquery Rendered Features ( any < Screen Coordinate >(), Ġany (), Ġany ()) Ġ} Ġanswers Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġthird Arg < Query Features Callback >(). run ( quer ied Features Expected ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ} ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠĠĠĠĠ Ġval Ġmock Point Action Ġ= ĠBuilding Action . Query Building ( mock Point , Ġmap box Map ) ĊĠĠĠĠĠĠĠ Ġval Ġmock Point Result Ġ= ĠBuilding Result . Qu er ied Build ings ( ĊĠĠĠĠĠĠĠĠĠĠĠ ĠExpected Factory . create Value ( ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ ĠBuilding Value ( quer ied Features Expected . value Ġ?: Ġempty List ()) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ) ĊĠĠĠĠĠĠĠ Ġ) ĊĠĠĠĠĠĠĠ Ġco Every Ġ{ ĠBuilding Processor . query Building ( mock Point Action ) Ġ} Ġreturns Ġmock Point Result ĊĠĠĠĠĠĠĠ Ġval Ġmessage Slot Ġ= Ġslot < Expected < Building Error , ĠBuilding Value >>() ĊĠĠĠĠĠĠĠ Ġval Ġbuild ings Api Ġ= ĠMap box Build ings Api ( mapbox Map ) ĊĊĠĠĠĠĠĠĠ Ġbuild ings Api . query Building On Final Destination ( mock Route Progress , Ġconsumer ) ĊĊĠĠĠĠĠĠĠ Ġverify ( exact ly Ġ= Ġ 1 ) Ġ{ Ġconsumer . accept ( capture ( message Slot )) Ġ} ĊĠĠĠĠĠĠĠ ĠassertEquals ( quer ied Features Expected . value , Ġmessage Slot . captured . value ?. build ings ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġcancel () Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġmock Parent Job Ġ= Ġmock k < Comp letable Job >( relax ed Ġ= Ġtrue ) ĊĠĠĠĠĠĠĠ Ġval Ġmock Job Control Ġ= Ġmock k < Job Control > Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġevery Ġ{ Ġjob Ġ} Ġreturns Ġmock Parent Job ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠĠĠĠĠ Ġmock k Object ( Internal Job Control Factory ) Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġevery Ġ{ ĠInternal Job Control Factory . create Main Scope Job Control () Ġ} Ġreturns Ġmock Job Control ĊĊĠĠĠĠĠĠĠĠĠĠĠ ĠMap box Build ings Api ( mock k ()). cancel () ĊĊĠĠĠĠĠĠĠĠĠĠĠ Ġverify Ġ{ Ġmock Parent Job . cancel Children () Ġ} ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġprivate Ġfun Ġmock Success Qu er ied Feature () Ġ= Ġmock k < Expected < String , ĠList < Qu er ied Feature >>> Ġ{ ĊĠĠĠĠĠĠĠ Ġmock k Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġevery Ġ{ Ġvalue Ġ} Ġreturns ĠlistOf ( ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġmock k Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġevery Ġ{ Ġsource Ġ} Ġreturns Ġ" composite " ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġevery Ġ{ Ġsource Layer Ġ} Ġreturns Ġ" building " ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġevery Ġ{ Ġfeature Ġ} Ġreturns Ġload Feature () ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ} ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġevery Ġ{ Ġerror Ġ} Ġreturns Ġnull ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġprivate Ġfun Ġload Feature () Ġ= ĠFeature . fromJson ( ĊĠĠĠĠĠĠĠ ĠFileUtils . load Json Fixture (" arrival - highlight - building - feature . json ") ĊĠĠĠ Ġ) Ċ } Ċ