package Ġcom . ba ul supp . ok url . services . google Ċ Ċ import Ġcom . ba ul supp . ok social . output . handler . Test Output Handler Ċ import Ġcom . ba ul supp . ok url . credentials . Default Token Ċ import Ġcom . ba ul supp . ok url . util . TestUtil . assume Has Network Ċ import Ġkotlinx . coroutines . run Blocking Ċ import Ġokhttp 3 . Ok HttpClient Ċ import Ġokhttp 3 . Response Ċ import Ġorg . junit . Ignore Ċ import Ġorg . junit . jupiter . api . Disabled Ċ import Ġorg . junit . jupiter . api . Test Ċ import Ġkotlin . test . assertTrue Ċ import Ġkotlin . test . fail Ċ Ċ @ Disabled Ċ class ĠDiscovery Api Doc Presenter Test Ġ{ ĊĠ Ġprivate Ġval Ġoutput Handler Ġ= ĠTest Output Handler < Response >() ĊĠ Ġprivate Ġval Ġclient Ġ= ĠOk HttpClient () ĊĊĠ Ġprivate Ġvar Ġp : ĠDiscovery Api Doc Presenter ? Ġ= ĠDiscovery Api Doc Presenter ( Discovery Registry ( client )) ĊĊĠ Ġ@ Test ĊĠ Ġfun Ġtest Ex pl ains Url () Ġ{ ĊĠĠĠ Ġassume Has Network () ĊĊĠĠĠ Ġrun Blocking Ġ{ ĊĠĠĠĠĠ Ġp !!. explain Api (" https :// people . googleapis . com / v 1 /{ + resourceName }", Ġoutput Handler , Ġclient , ĊĠĠĠĠĠĠĠ ĠDefault Token ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġval Ġes Ġ= ĠlistOf (" name : ĠPeople ĠAPI ", ĊĠĠĠĠĠ Ġ" docs : Ġhttps :// developers . google . com / people /", ĊĠĠĠĠĠ Ġ" url : Ġhttps :// people . googleapis . com / v 1 /{ + resourceName }" ĊĠĠĠ Ġ) ĊĊĠĠĠ Ġ// Ġunsafe Ġtests ĊĠĠĠ Ġ// Ġ" endpoint Ġid : Ġpeople . people . get ", ĊĠĠĠ Ġ// Ġ" scopes : Ġhttps :// www . googleapis . com / auth / contacts , Ġhttps :// www . googleapis . com / auth / contacts . readonly , Ġhttps :// www . googleapis . com / auth / plus . login , Ġhttps :// www . googleapis . com / auth / user . addresses . read , Ġhttps :// www . googleapis . com / auth / user . birthday . read , Ġhttps :// www . googleapis . com / auth / user . emails . read , Ġhttps :// www . googleapis . com / auth / user . phon en umbers . read , Ġhttps :// www . googleapis . com / auth / userinfo . email , Ġhttps :// www . googleapis . com / auth / userinfo . profile " ĊĊĠĠĠ Ġfor Ġ( l Ġin Ġes ) Ġ{ ĊĠĠĠĠĠ ĠassertTrue ( output Handler . stdout . contains ( l ), Ġl ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ// ĠassertTrue ( output Handler . stdout . stream () ĊĠĠĠ Ġ// ĠĠĠ Ġ. any Match ( c Ġ-> Ġc . startsWith (" Provides Ġinformation Ġabout Ġa Ġperson "))); ĊĠ Ġ} ĊĊĠ Ġ@ Test ĊĠ Ġfun Ġtest Ex pl ains Expanded Url () Ġ{ ĊĠĠĠ Ġassert Match (" https :// people . googleapis . com / v 1 / people / me ", ĊĠĠĠĠĠ Ġ" https :// people . googleapis . com / v 1 /{ + resourceName }", Ġ" url ") ĊĠ Ġ} ĊĊĠ Ġ@ Test ĊĠ Ġfun Ġtest Ex pl ains Expanded Url 2 () Ġ{ ĊĠĠĠ Ġassert Match (" https :// people . googleapis . com / v 1 / people : batch Get ? resource Names = me ", ĊĠĠĠĠĠ Ġ" https :// people . googleapis . com / v 1 / people : batch Get ", Ġ" url ") ĊĠ Ġ} ĊĊĠ Ġ@ Test ĊĠ Ġfun Ġtest Ex pl ains Expanded Url 3 () Ġ{ ĊĠĠĠ Ġassert Match (" https :// www . googleapis . com / tasks / v 1 / users /@ me / lists ", ĊĠĠĠĠĠ Ġ" https :// www . googleapis . com / tasks / v 1 / users /@ me / lists ", Ġ" url ") ĊĠ Ġ} ĊĊĠ Ġ@ Test ĊĠ Ġfun Ġtest Ex pl ains Expanded Url 4 () Ġ{ ĊĠĠĠ Ġassert Match (" https :// www . googleapis . com / tasks / v 1 / users /@ me / lists / x ", ĊĠĠĠĠĠ Ġ" https :// www . googleapis . com / tasks / v 1 / users /@ me / lists /{ task list }", Ġ" url ") ĊĠ Ġ} ĊĊĠ Ġ@ Test ĊĠ Ġfun Ġtest Ex pl ains Expanded WW W Before Site Urls () Ġ{ ĊĠĠĠ Ġassert Match (" https :// www . googleapis . com / tasks / v 1 /", ĊĠĠĠĠĠ Ġ" https :// developers . google . com / google - apps / tasks / first app ", Ġ" docs ") ĊĠ Ġ} ĊĊĠ Ġ@ Test ĊĠ Ġfun Ġtest Ex pl ains Expanded WW W After Site Urls () Ġ{ ĊĠĠĠ Ġassert Match (" https :// www . googleapis . com / tasks / v 1 / users /@ me / lists ", ĊĠĠĠĠĠ Ġ" https :// developers . google . com / google - apps / tasks / first app ", Ġ" docs ") ĊĠ Ġ} ĊĊĠ Ġprivate Ġfun Ġassert Match ( requested : ĠString , Ġexpected : ĠString , Ġfield : ĠString ) Ġ{ ĊĠĠĠ Ġassume Has Network () ĊĊĠĠĠ Ġrun Blocking Ġ{ ĊĠĠĠĠĠ Ġp !!. explain Api ( requested , Ġoutput Handler , Ġclient , ĊĠĠĠĠĠĠĠ ĠDefault Token ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġval Ġcontains Ġ= Ġoutput Handler . stdout . contains ("$ field : Ġ$ expected ") ĊĊĠĠĠ Ġif Ġ(! contains ) Ġ{ ĊĠĠĠĠĠ Ġval Ġfound Ġ= Ġoutput Handler . stdout . first OrNull Ġ{ Ġs Ġ-> ĊĠĠĠĠĠĠĠ Ġs . startsWith ("$ field : Ġ") ĊĠĠĠĠĠ Ġ} ĊĊĠĠĠĠĠ Ġfail (" expected Ġ'$ expected ' Ġfound Ġ" Ġ+ Ġ( found ?. substring ( field . length Ġ+ Ġ 2 ) Ġ?: Ġ" nothing ")) ĊĠĠĠ Ġ} ĊĊĠĠĠ ĠassertTrue ( contains ) ĊĠ Ġ} Ċ } Ċ