package Ġcom . dom nik l . fore ns ics . loc Ċ Ċ import Ġcom . dom nik l . fore ns ics . shell . Shell Command Ċ import Ġcom . n ha ar man . mockito _ kotlin . any Ċ import Ġcom . n ha ar man . mockito _ kotlin . mock Ċ import Ġcom . n ha ar man . mockito _ kotlin . wh enever Ċ import Ġorg . junit . Test Ċ import Ġjava . io . BufferedReader Ċ import Ġjava . io . File Ċ import Ġjava . io . String Reader Ċ Ċ internal Ġclass ĠFactory Test Ġ{ ĊĠĠĠ Ġ@ Test ( expected Ġ= ĠNotImplementedError :: class ) ĊĠĠĠ Ġfun Ġthrows NotImplemented Error For Tools Other Than C loc () Ġ{ ĊĠĠĠĠĠĠĠ ĠFactory (). build (" foobar ", ĠShell Command ( File (" c loc "))) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ( expected Ġ= ĠIllegalArgumentException :: class ) ĊĠĠĠ Ġfun Ġthrows IllegalArgumentException When Shell Command IsNot Executable () Ġ{ ĊĠĠĠĠĠĠĠ ĠFactory (). build ( Factory . TOOL _ C LOC , ĠShell Command ( File (" foobar "))) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġcan Build C loc () Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġreader Ġ= ĠBufferedReader ( String Reader (" 1 . 0 ")) ĊĠĠĠĠĠĠĠ Ġval Ġmock Ġ= Ġmock < Shell Command >() ĊĠĠĠĠĠĠĠ Ġwhenever ( mock . execute ( any (), Ġany ())). thenReturn ( reader ) ĊĊĠĠĠĠĠĠĠ Ġval Ġc loc Ġ= ĠFactory (). build ( Factory . TOOL _ C LOC , Ġmock ) ĊĊĠĠĠĠĠĠĠ Ġassert ( c loc Ġis ĠC loc ) ĊĠĠĠ Ġ} Ċ } Ċ