use of org.ballerinalang.util.exceptions.BLangRuntimeException in project ballerina by ballerina-lang.
the class EndpointTest method testEndpointInFunction.
@Test(description = "Test endpoint testEndpoint In Function")
public void testEndpointInFunction() {
CompileResult testEndpointsInFunction = BCompileUtil.compile("test-src/endpoint/testEndpointInFunction.bal");
BValue[] returns = BRunUtil.invoke(testEndpointsInFunction, "test1");
Assert.assertTrue(returns.length == 1);
Assert.assertEquals(returns[0].stringValue(), "init:DummyEndpoint;start:DummyEndpoint;" + "getClient:DummyEndpoint;invoke1:DummyClient;getClient:DummyEndpoint;invoke2:DummyClient;t2");
returns = BRunUtil.invoke(testEndpointsInFunction, "test2");
Assert.assertTrue(returns.length == 1);
Assert.assertEquals(returns[0].stringValue(), "init:DummyEndpoint;start:DummyEndpoint;<test2Caller>" + "getClient:DummyEndpoint;invoke1:DummyClient;getClient:DummyEndpoint;invoke2:DummyClient;t2");
returns = BRunUtil.invoke(testEndpointsInFunction, "test3");
Assert.assertTrue(returns.length == 1);
Assert.assertEquals(returns[0].stringValue(), "<test3>init:DummyEndpoint;start:DummyEndpoint;" + "getClient:DummyEndpoint;invoke1:DummyClient;getClient:DummyEndpoint;invoke2:DummyClient;t2");
try {
BRunUtil.invoke(testEndpointsInFunction, "test4");
} catch (BLangRuntimeException e) {
Assert.fail("NullReferenceException was thrown at test4 of EndpointTest.");
}
}
Aggregations