### Question:
Cli { public void run(String[] args, Writer out) { try { doRun(args, out); } catch (Exception e) { e.printStackTrace(); } }  void run(String[] args, Writer out); static void main(String[] args);  }### Answer:
@Test public void testUsage() throws Exception { assertThat(run()).contains("usage:"); assertThat(run("komponent")).contains("usage:"); assertThat(run("c", "org.qbert.X")).doesNotContain("usage:"); }
@Test public void testComponentNoPackage() throws Exception { run("c", "Person"); assertThat(cwd.toFile() .listFiles()).hasSize(3); }
@Test public void testComponentPackage() throws Exception { run("c", "org.qbert.Person"); Path packFolder = cwd.resolve("org/qbert"); assertThat(packFolder.toFile() .listFiles()).hasSize(3); }
@Test public void testPipeSrcFolder() throws Exception { Path mainJava = cwd.resolve("src/main/java"); Files.createDirectories(mainJava); run("pi", "org.qbert.Person"); Path packFolder = cwd.resolve("src/main/java/org/qbert"); assertThat(packFolder.toFile() .listFiles()).hasSize(1); }
@Test public void testPipeSrcFolderParam() throws Exception { run("pi", "org.qbert.Person", "-t", "abc/def"); Path packFolder = cwd.resolve("abc/def/org/qbert"); assertThat(packFolder.toFile() .listFiles()).hasSize(1); }