use of org.wso2.carbon.registry.api.Collection in project ballerina by ballerina-lang.
the class BallerinaFunctionDocGenTest method testABalWithNativeFunction.
@Test(description = "Test a Bal file with a native function")
public void testABalWithNativeFunction() {
try {
Map<String, BLangPackage> docsMap = BallerinaDocGenerator.generatePackageDocsFromBallerina(sourceRoot, "natives.bal", "", true);
Assert.assertNotNull(docsMap);
Assert.assertEquals(docsMap.size(), 1);
BallerinaDocGenTestUtils.printDocMap(docsMap);
BLangPackage doc = docsMap.get(".");
Collection<BLangFunction> functions = doc.getFunctions();
Assert.assertEquals(functions.size(), 1);
BLangFunction function = functions.iterator().next();
Assert.assertEquals(function.getParameters().size(), 1);
Assert.assertEquals(function.getReturnParameters().size(), 1);
Assert.assertEquals(function.getAnnotationAttachments().size(), 2);
} catch (IOException e) {
Assert.fail();
} finally {
BallerinaDocGenTestUtils.cleanUp();
}
}
use of org.wso2.carbon.registry.api.Collection in project ballerina by ballerina-lang.
the class BallerinaFunctionDocGenTest method testABalWithOneFunction.
@Test(description = "Test a Bal file with one Function")
public void testABalWithOneFunction() {
try {
Map<String, BLangPackage> docsMap = BallerinaDocGenerator.generatePackageDocsFromBallerina(sourceRoot, "helloWorld.bal");
Assert.assertNotNull(docsMap);
Assert.assertEquals(docsMap.size(), 1);
BallerinaDocGenTestUtils.printDocMap(docsMap);
BLangPackage doc = docsMap.get(".");
Collection<BLangFunction> functions = doc.getFunctions();
Assert.assertEquals(functions.size(), 1);
BLangFunction function = functions.iterator().next();
Assert.assertEquals(function.getParameters().size(), 1);
Assert.assertEquals(function.getReturnParameters().size(), 1);
} catch (IOException e) {
Assert.fail();
} finally {
BallerinaDocGenTestUtils.cleanUp();
}
}
Aggregations