SimplePlantUMLParser { public PlantUMLModel parse(String text) { PlantUMLModel model = new PlantUMLModel(); String[] lines = text.split("\n"); int lineNr = 1; for (String line: lines) { inspectLine(line, lineNr++,model); } return model; }  PlantUMLModel parse(String text);  }
@Test public void a_local_include_is_found_by_parser() { String plantUml="@startuml context\n" + "!include C4_Context.puml\n" + "\n" + "Person(administrator, \"Administrator\")\n" + "System(jenkins, \"Jenkins\")\n" + "Rel(administrator, jenkins, \"Administrates Jenkins\", \"SSH\")\n" + "\n" + "@enduml"; PlantUMLModel model = parserToTest.parse(plantUml); List<PlantUMLInclude> includes = model.getIncludes(); assertEquals(1,includes.size()); PlantUMLInclude include = includes.get(0); assertEquals("C4_Context.puml", include.getLocation()); assertEquals(2, include.getLineNumber()); }
@Test public void a_url_include_is_found_by_parser() { String plantUml="@startuml context\n" + "!includeurl https: "\n" + "Person(administrator, \"Administrator\")\n" + "System(jenkins, \"Jenkins\")\n" + "Rel(administrator, jenkins, \"Administrates Jenkins\", \"SSH\")\n" + "\n" + "@enduml"; PlantUMLModel model = parserToTest.parse(plantUml); List<PlantUMLInclude> includes = model.getIncludes(); assertEquals(1,includes.size()); PlantUMLInclude include = includes.get(0); assertEquals("https: assertEquals(2, include.getLineNumber()); }