@Test public void testWrite() throws IOException { when(options.get(Documentor.DOC_OUTPUT_PROPERTY_NAME)).thenReturn(FILE_PATH); Documentor documentor = new Documentor(processingEnv); documentor.write(getElements()); String actual = Files.toString(new File(FILE_PATH), Charsets.UTF_8); String expected = "airbnb: + "n|##|\\nairbnb: assertEquals(expected, actual); }
void write(final List<DeepLinkAnnotatedElement> elements) { if (file == null) { messager.printMessage(Diagnostic.Kind.NOTE, "Output file is null, DeepLink doc not generated."); return; } if (elements == null || elements.isEmpty()) { messager.printMessage(Diagnostic.Kind.NOTE, "No deep link, DeepLink doc not generated."); return; } try (PrintWriter writer = new PrintWriter(new FileWriter(file), true)) { final String fileName = file.getName(); final int extIndex = fileName.lastIndexOf("."); DocumetationWriter docWriter; if (extIndex >= 0 && extIndex < fileName.length() && fileName.substring(extIndex + 1).equalsIgnoreCase("md")) { docWriter = new MarkdownWriter(); } else { docWriter = new GenericWriter(); } docWriter.write(processingEnv, writer, elements); } catch (IOException e) { messager.printMessage(Diagnostic.Kind.ERROR, "DeepLink doc not generated: " + e.getMessage()); } messager.printMessage(Diagnostic.Kind.NOTE, "DeepLink doc generated at: " + file.getPath()); }
Documentor { void write(final List<DeepLinkAnnotatedElement> elements) { if (file == null) { messager.printMessage(Diagnostic.Kind.NOTE, "Output file is null, DeepLink doc not generated."); return; } if (elements == null || elements.isEmpty()) { messager.printMessage(Diagnostic.Kind.NOTE, "No deep link, DeepLink doc not generated."); return; } try (PrintWriter writer = new PrintWriter(new FileWriter(file), true)) { final String fileName = file.getName(); final int extIndex = fileName.lastIndexOf("."); DocumetationWriter docWriter; if (extIndex >= 0 && extIndex < fileName.length() && fileName.substring(extIndex + 1).equalsIgnoreCase("md")) { docWriter = new MarkdownWriter(); } else { docWriter = new GenericWriter(); } docWriter.write(processingEnv, writer, elements); } catch (IOException e) { messager.printMessage(Diagnostic.Kind.ERROR, "DeepLink doc not generated: " + e.getMessage()); } messager.printMessage(Diagnostic.Kind.NOTE, "DeepLink doc generated at: " + file.getPath()); } }
Documentor { void write(final List<DeepLinkAnnotatedElement> elements) { if (file == null) { messager.printMessage(Diagnostic.Kind.NOTE, "Output file is null, DeepLink doc not generated."); return; } if (elements == null || elements.isEmpty()) { messager.printMessage(Diagnostic.Kind.NOTE, "No deep link, DeepLink doc not generated."); return; } try (PrintWriter writer = new PrintWriter(new FileWriter(file), true)) { final String fileName = file.getName(); final int extIndex = fileName.lastIndexOf("."); DocumetationWriter docWriter; if (extIndex >= 0 && extIndex < fileName.length() && fileName.substring(extIndex + 1).equalsIgnoreCase("md")) { docWriter = new MarkdownWriter(); } else { docWriter = new GenericWriter(); } docWriter.write(processingEnv, writer, elements); } catch (IOException e) { messager.printMessage(Diagnostic.Kind.ERROR, "DeepLink doc not generated: " + e.getMessage()); } messager.printMessage(Diagnostic.Kind.NOTE, "DeepLink doc generated at: " + file.getPath()); } Documentor(final ProcessingEnvironment processingEnv); }
Documentor { void write(final List<DeepLinkAnnotatedElement> elements) { if (file == null) { messager.printMessage(Diagnostic.Kind.NOTE, "Output file is null, DeepLink doc not generated."); return; } if (elements == null || elements.isEmpty()) { messager.printMessage(Diagnostic.Kind.NOTE, "No deep link, DeepLink doc not generated."); return; } try (PrintWriter writer = new PrintWriter(new FileWriter(file), true)) { final String fileName = file.getName(); final int extIndex = fileName.lastIndexOf("."); DocumetationWriter docWriter; if (extIndex >= 0 && extIndex < fileName.length() && fileName.substring(extIndex + 1).equalsIgnoreCase("md")) { docWriter = new MarkdownWriter(); } else { docWriter = new GenericWriter(); } docWriter.write(processingEnv, writer, elements); } catch (IOException e) { messager.printMessage(Diagnostic.Kind.ERROR, "DeepLink doc not generated: " + e.getMessage()); } messager.printMessage(Diagnostic.Kind.NOTE, "DeepLink doc generated at: " + file.getPath()); } Documentor(final ProcessingEnvironment processingEnv);  }
Documentor { void write(final List<DeepLinkAnnotatedElement> elements) { if (file == null) { messager.printMessage(Diagnostic.Kind.NOTE, "Output file is null, DeepLink doc not generated."); return; } if (elements == null || elements.isEmpty()) { messager.printMessage(Diagnostic.Kind.NOTE, "No deep link, DeepLink doc not generated."); return; } try (PrintWriter writer = new PrintWriter(new FileWriter(file), true)) { final String fileName = file.getName(); final int extIndex = fileName.lastIndexOf("."); DocumetationWriter docWriter; if (extIndex >= 0 && extIndex < fileName.length() && fileName.substring(extIndex + 1).equalsIgnoreCase("md")) { docWriter = new MarkdownWriter(); } else { docWriter = new GenericWriter(); } docWriter.write(processingEnv, writer, elements); } catch (IOException e) { messager.printMessage(Diagnostic.Kind.ERROR, "DeepLink doc not generated: " + e.getMessage()); } messager.printMessage(Diagnostic.Kind.NOTE, "DeepLink doc generated at: " + file.getPath()); } Documentor(final ProcessingEnvironment processingEnv);   }