use of org.ballerinalang.docgen.model.Page in project ballerina by ballerina-lang.
the class HtmlDocTest method testConnectors.
@Test(description = "Connectors in a package should be shown in the constructs", enabled = false)
public void testConnectors() throws Exception {
BLangPackage bLangPackage = createPackage("package x.y; " + "public connector HttpClient (string uri, int n){}" + "public connector Http2Client (string uri, int n){}");
Page page = generatePage(bLangPackage);
Assert.assertEquals(page.constructs.size(), 2);
Assert.assertEquals(page.constructs.get(0).name, "HttpClient");
Assert.assertEquals(page.constructs.get(1).name, "Http2Client");
}
use of org.ballerinalang.docgen.model.Page in project ballerina by ballerina-lang.
the class HtmlDocTest method testStructs.
@Test(description = "Structs in a package should be shown in the constructs")
public void testStructs() throws Exception {
BLangPackage bLangPackage = createPackage("package x.y; public struct Message {}");
Page page = generatePage(bLangPackage);
Assert.assertEquals(page.constructs.size(), 1);
Assert.assertEquals(page.constructs.get(0).name, "Message");
}
use of org.ballerinalang.docgen.model.Page in project ballerina by ballerina-lang.
the class HtmlDocTest method testEnums.
@Test(description = "Enums in a package should be shown in the constructs")
public void testEnums() throws Exception {
BLangPackage bLangPackage = createPackage("package x.y; " + "public enum Direction {IN,OUT}" + "public enum Money {USD,LKR}");
Page page = generatePage(bLangPackage);
Assert.assertEquals(page.constructs.size(), 2);
Assert.assertEquals(page.constructs.get(0).name, "Direction");
Assert.assertTrue(page.constructs.get(0) instanceof EnumDoc, "Invalid documentable type.");
Assert.assertEquals(((EnumDoc) page.constructs.get(0)).enumerators.get(0).toString(), "IN", "Invalid enum val");
Assert.assertEquals(((EnumDoc) page.constructs.get(0)).enumerators.get(1).toString(), "OUT", "Invalid enum val");
Assert.assertEquals(page.constructs.get(1).name, "Money");
}
use of org.ballerinalang.docgen.model.Page in project ballerina by ballerina-lang.
the class WriterTest method testWriterWithInvalidPath.
@Test(description = "Test writer with invalid output path.")
public void testWriterWithInvalidPath() {
URL location = Writer.class.getProtectionDomain().getCodeSource().getLocation();
String outputPath = location.getPath();
Writer.writeHtmlDocument(new Page(new StaticCaption(""), new ArrayList<>(), new ArrayList<>()), "page", outputPath);
Assert.assertTrue(outContent.toString().contains("docerina: could not write HTML file"), "An error was expected");
}
use of org.ballerinalang.docgen.model.Page in project ballerina by ballerina-lang.
the class WriterTest method testWriter.
@Test(description = "Test if writer class is working.")
public void testWriter() {
URL location = Writer.class.getProtectionDomain().getCodeSource().getLocation();
String outputPath = location.getPath() + File.separator + "sample.html";
Writer.writeHtmlDocument(new Page(new StaticCaption(""), new ArrayList<>(), new ArrayList<>()), "page", outputPath);
}
Aggregations