AsciiDocStringUtils { public static String resolveFilenameOfDiagramMacroOrNull(String potentialInclude) { if (potentialInclude == null) { return null; } String fileName = resolveFilenameOfMacroOrNull(potentialInclude, "ditaa"); if (fileName != null) { return fileName; } return resolveFilenameOfMacroOrNull(potentialInclude, "plantuml"); }  static String resolveFilenameOfDiagramMacroOrNull(String potentialInclude); static String resolveFilenameOfMacroOrNull(String potentialInclude, String macroName); static String resolveFilenameOfImageOrNull(String potentialImage); static String resolveFilenameOfIncludeOrNull(String potentialInclude); static LinkTextData resolveTextFromStartToBracketsEnd(String line, int offset, int offsetInLine); static String readUTF8FileToString(File fileToRead); static File writeTextToUTF8File(String transformed, File newTempFile);  }
@Test public void resolveDitaDiagramname_has_name() throws Exception { assertEquals("diagrams/diagram_kubernetes_deployment_architecture.ditaa",resolveFilenameOfDiagramMacroOrNull("ditaa::diagrams/diagram_kubernetes_deployment_architecture.ditaa[format=png, alt=\"Diagram about kubernetes deployment architecture\"]")); }
@Test public void resolvePlantUMLDiagramname_has_name() throws Exception { assertEquals("diagrams/diagram_target_architecture.plantuml",resolveFilenameOfDiagramMacroOrNull("plantuml::diagrams/diagram_target_architecture.plantuml[format=svg, alt=\"Class diagram of target and install setup architecture\", width=1024]")); }