package Ġorg . yal ab . beef tracker Ċ Ċ import Ġorg . js oup . Connection Ċ import Ġorg . js oup . helper . Http Connection Ċ import Ġorg . js oup . J soup Ċ import Ġorg . junit . Assert .* Ċ import Ġorg . junit . Before Ċ import Ġorg . junit . Test Ċ import Ġorg . mockito . Mockito Ċ import Ġorg . mockito . Mockito . mock Ċ import Ġorg . mockito . Mockito . mock Static Ċ import Ġorg . mockito . junit . Mockito JUnit Runner Ċ import Ġjava . io . File Ċ import Ġjava . io . IOException Ċ Ċ class ĠN LB CT est Ġ{ ĊĠĠĠ Ġlateinit Ġvar Ġnl bc : ĠNL BC ĊĊĠĠĠ Ġ@ Before ĊĠĠĠ Ġfun ĠsetUp () Ġ{ ĊĠĠĠĠĠĠĠ Ġnl bc Ġ= ĠNL BC () ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġ@ Throws ( IOException :: class ) ĊĠĠĠ Ġfun Ġfetch Test () Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġmock Ġ= ĠMockito . mock Static ( J soup :: class . java ) ĊĠĠĠĠĠĠĠ Ġmock J soup ( NL BC . AG REE MENT _ URL , Ġ" agreement . html ") ĊĠĠĠĠĠĠĠ Ġmock J soup ( NL BC . ACTION _ URL , Ġ" action . html ") ĊĠĠĠĠĠĠĠ Ġmock J soup ( NL BC . SEARCH _ URL , Ġ" search . html ") ĊĠĠĠĠĠĠĠ Ġnl bc . fetch (" 1 4 9 0 9 1 5 4 6 1 ") ĊĠĠĠĠĠĠĠ Ġval Ġc attle Ġ= Ġnl bc . cat tle ĊĠĠĠĠĠĠĠ ĠassertEquals (" 1 4 9 0 9 1 5 4 6 1 ", Ġc attle . tracking Number ) ĊĠĠĠĠĠĠĠ ĠassertEquals (" 2 0 1 9 . 1 1 . 2 0 ", Ġc attle . birth Day ) ĊĠĠĠĠĠĠĠ ĠassertEquals (" åİ» åĭ ¢ ï¼Ī éĽ Ħ ï¼ī ", Ġc attle . gender ) ĊĠĠĠĠĠĠĠ ĠassertEquals (" 1 4 7 4 1 1 3 5 7 9 ", Ġc attle . mother Tracking Number ) ĊĠĠĠĠĠĠĠ ĠassertEquals (" ãĥ Ľ ãĥ« ãĤ¹ãĤ¿ ãĤ¤ãĥ³ ç¨® ", Ġc attle . bre ed ) ĊĠĠĠĠĠĠĠ Ġmock . close () ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġ@ Throws ( IOException :: class ) ĊĠĠĠ Ġfun Ġnot Found Test () Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġmock Ġ= ĠMockito . mock Static ( J soup :: class . java ) ĊĠĠĠĠĠĠĠ Ġmock J soup ( NL BC . AG REE MENT _ URL , Ġ" agreement . html ") ĊĠĠĠĠĠĠĠ Ġmock J soup ( NL BC . ACTION _ URL , Ġ" action . html ") ĊĠĠĠĠĠĠĠ Ġmock J soup ( NL BC . SEARCH _ URL , Ġ" not found . html ") ĊĠĠĠĠĠĠĠ Ġnl bc . fetch (" 0 0 0 0 0 0 0 0 0 0 ") ĊĠĠĠĠĠĠĠ Ġval Ġc attle Ġ= Ġnl bc . cat tle ĊĠĠĠĠĠĠĠ ĠassertEquals (" 0 0 0 0 0 0 0 0 0 0 ", Ġc attle . tracking Number ) ĊĠĠĠĠĠĠĠ ĠassertEquals (" è© ² å½ĵ ãģĻãĤĭ çī Ľ ãģ® æĥħåł± ãģ¯ ", Ġc attle . birth Day ) ĊĠĠĠĠĠĠĠ ĠassertEquals (" ãģĤãĤĬ ãģ¾ãģĽãĤĵ ãĢĤ ", Ġc attle . gender ) ĊĠĠĠĠĠĠĠ Ġmock . close () ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġprivate Ġfun Ġmock J soup ( url : ĠString , Ġresource Name : ĠString ) Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġfake Action Ġ= ĠMockito . spy ( Http Connection ()) ĊĠĠĠĠĠĠĠ Ġfake Action . url (" https :// www . google . com /") ĊĠĠĠĠĠĠĠ Ġval Ġfake Action Response Ġ= ĠMockito . mock ( Connection . Response :: class . java ) ĊĠĠĠĠĠĠĠ Ġval Ġtext Ġ= ĠFile ( java Class . class Loader . getResource ( resourceName ). path ). read Text () ĊĠĠĠĠĠĠĠ ĠMockito .` when `( fake Action Response . body ()). thenReturn ( text ) ĊĠĠĠĠĠĠĠ ĠMockito .` when `( fake Action . execute ()). thenReturn ( fake Action Response ) ĊĠĠĠĠĠĠĠ ĠMockito .` when `( J soup . connect ( url )). thenReturn ( fake Action ) ĊĠĠĠĠĠĠĠ ĠMockito .` when `( fake Action . cookies ( Mockito . any Map ())). thenReturn ( fake Action ) ĊĠĠĠĠĠĠĠ ĠMockito .` when `( J soup . parse ( Mockito . any String ())). then Call Real Method () ĊĠĠĠ Ġ} Ċ } Ċ