package Ġcom . bot ig oc ont igo . alf red . google Ċ Ċ import Ġcom . bot ig oc ont igo . alf red . utils . Networking Adapter Ċ import Ġorg . junit . Test Ċ import Ġorg . junit . runner . RunWith Ċ import Ġorg . mockito . Mock Ċ import Ġorg . mockito . Mockito Ċ import Ġorg . mockito . runners . Mockito JUnit Runner Ċ Ċ @ RunWith ( Mockito JUnit Runner :: class ) Ċ class ĠGoogle Search Service Test Ġ{ ĊĊĠĠĠ Ġ@ Mock ĊĠĠĠ Ġprivate Ġlateinit Ġvar Ġadapter : ĠNetwork ing Adapter ĊĊĠĠĠ Ġ@ Mock ĊĠĠĠ Ġprivate Ġlateinit Ġvar Ġcallbacks : ĠGoogle Search Callbacks ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġsearch Test () Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġcredentials Ġ= ĠCredentials (" my key ", Ġ" my cx ") ĊĠĠĠĠĠĠĠ Ġval Ġapi Ġ= ĠGoogle Api ( adapter , Ġcredentials ) ĊĠĠĠĠĠĠĠ Ġval Ġservice Ġ= ĠGoogle Search Service ( api ) ĊĠĠĠĠĠĠĠ Ġval Ġq Ġ= Ġ" this + is + a + test " ĊĠĠĠĠĠĠĠ Ġservice . search (" this Ġis Ġa Ġtest ", Ġcallbacks ) ĊĠĠĠĠĠĠĠ Ġval Ġexpected Queue Ġ= Ġ" google - api " ĊĠĠĠĠĠĠĠ Ġval Ġexpected Method Ġ= Ġ" get " ĊĠĠĠĠĠĠĠ Ġval Ġexpected Url Ġ= Ġ" https :// www . googleapis . com / custom search / v 1 / s iter est rict ? q = this + is + a + test & cx = my cx & key = my key " ĊĠĠĠĠĠĠĠ ĠMockito . verify ( adapter , ĠMockito . times ( 1 )). enqueue ( expected Queue , Ġexpected Method , Ġexpected Url , Ġcallbacks ) ĊĠĠĠ Ġ} Ċ Ċ }