DocGenerator { public void generateDoc(PluginDocTree pluginDocTree) { for (String pluginName : pluginDocTree.getPluginNames()) { StringTemplate pluginDocST = getPluginDoc(pluginName, pluginDocTree.getPlugin(pluginName), pluginDocTree.getCommands(pluginName)); docFileWriter.writeDocFile(pluginName, pluginDocST.toString()); } } DocGenerator(DocFileWriter docFileWriter); void generateDoc(PluginDocTree pluginDocTree);  }
@Test public void testGenerator() { docGenerator.generateDoc(pluginDocTree); ArgumentCaptor<String> pluginNameCaptor = ArgumentCaptor.forClass(String.class); ArgumentCaptor<String> docCaptor = ArgumentCaptor.forClass(String.class); verify(writerMock).writeDocFile(pluginNameCaptor.capture(), docCaptor.capture()); assertThat(pluginNameCaptor.getValue(), is("plugin1")); assertThat(docCaptor.getValue().length(), greaterThan(180)); assertThat(docCaptor.getValue().length(), lessThan(300)); assertThat(docCaptor.getValue().contains("\n==== cmd1"), is(true)); assertThat(docCaptor.getValue().contains("\n[cols=\"1a,5a\"]"), is(true)); assertThat(docCaptor.getValue().contains("This is Result 3"), is(true)); }
@Test public void testGeneratorWithTwoPlugins() { pluginDocTree.addPlugin("plugin2", pluginDoc2); docGenerator.generateDoc(pluginDocTree); verify(writerMock, times(2)).writeDocFile(any(String.class), any(String.class)); }