### Question:
FileGenerator { void generateServiceDispatcher(Writer output) throws IOException, TemplateException { configuration.getTemplate("ServiceDispatcherTemplate.ftl").process(dispatcherContext, output); } FileGenerator(List<AnalysisResult> results, String outputPath); void generate();  }### Answer:
@Test public void testServiceDispatcher() throws IOException, TemplateException { AnalysisResult result = buildResult(); List<AnalysisResult> results = new LinkedList<>(); results.add(result); FileGenerator fileGenerator = new FileGenerator(results, "."); StringWriter writer = new StringWriter(); fileGenerator.generateServiceDispatcher(writer); Assert.assertEquals(readExpectedFile("ServiceDispatcherExpected.java"), writer.toString()); }