Search in sources :

Example 16 with BValue

use of org.ballerinalang.model.values.BValue in project ballerina by ballerina-lang.

the class AssertTest method testAssertStringArrayEquals3.

@Test(expectedExceptions = BLangRuntimeException.class, expectedExceptionsMessageRegExp = ".*expected " + "\\[\"A\", \"b\", \"C\"\\] but found \\[\"A\", \"B\", \"C\"\\].*")
public void testAssertStringArrayEquals3() {
    BValue[] args = { new BInteger(3) };
    BTestUtils.invoke(compileResult, "testAssertStringArrayEquals", args);
}
Also used : BValue(org.ballerinalang.model.values.BValue) BInteger(org.ballerinalang.model.values.BInteger) Test(org.testng.annotations.Test)

Example 17 with BValue

use of org.ballerinalang.model.values.BValue in project ballerina by ballerina-lang.

the class AssertTest method testNoAssertFail.

@Test
public void testNoAssertFail() {
    BValue[] args = { new BBoolean(true) };
    BTestUtils.invoke(compileResult, "testAssertFail", args);
}
Also used : BValue(org.ballerinalang.model.values.BValue) BBoolean(org.ballerinalang.model.values.BBoolean) Test(org.testng.annotations.Test)

Example 18 with BValue

use of org.ballerinalang.model.values.BValue in project ballerina by ballerina-lang.

the class AssertTest method testAssertBooleanEqualsFail.

@Test(expectedExceptions = BLangRuntimeException.class, expectedExceptionsMessageRegExp = ".*expected false but found true.*")
public void testAssertBooleanEqualsFail() {
    BValue[] args = { new BBoolean(true), new BBoolean(false) };
    BTestUtils.invoke(compileResult, "testAssertBooleanEquals", args);
}
Also used : BValue(org.ballerinalang.model.values.BValue) BBoolean(org.ballerinalang.model.values.BBoolean) Test(org.testng.annotations.Test)

Example 19 with BValue

use of org.ballerinalang.model.values.BValue in project ballerina by ballerina-lang.

the class ConfigTest method testGetAsStringNegative.

@Test(description = "test get global method with unavailable config")
public void testGetAsStringNegative() throws IOException {
    BString key = new BString("ballerina.wso2");
    BValue[] inputArg = { key };
    registry.initRegistry(new HashMap<>(), null, ballerinaConfPath);
    BValue[] returnVals = BRunUtil.invoke(compileResult, "testGetAsString", inputArg);
    Assert.assertFalse(returnVals == null || returnVals.length == 0, "Invalid Return Values.");
    Assert.assertTrue(returnVals[0] instanceof BString || returnVals[0] == null);
// Assert.assertNull(returnVals[0].stringValue());
}
Also used : BString(org.ballerinalang.model.values.BString) BValue(org.ballerinalang.model.values.BValue) Test(org.testng.annotations.Test)

Example 20 with BValue

use of org.ballerinalang.model.values.BValue in project ballerina by ballerina-lang.

the class ConfigTest method testGetInstanceValuesWithDefaultConfigFile.

@Test(description = "test instance method with default config file properties")
public void testGetInstanceValuesWithDefaultConfigFile() throws IOException {
    BString key = new BString("http1.ballerina.http.port");
    BValue[] inputArg = { key };
    registry.initRegistry(new HashMap<>(), null, ballerinaConfPath);
    BValue[] returnVals = BRunUtil.invoke(compileResult, "testGetAsString", inputArg);
    Assert.assertFalse(returnVals == null || returnVals.length == 0 || returnVals[0] == null, "Invalid Return Values.");
    Assert.assertTrue(returnVals[0] instanceof BString);
    Assert.assertEquals(returnVals[0].stringValue(), "8085");
}
Also used : BString(org.ballerinalang.model.values.BString) BValue(org.ballerinalang.model.values.BValue) Test(org.testng.annotations.Test)

Aggregations

BValue (org.ballerinalang.model.values.BValue)1043 Test (org.testng.annotations.Test)923 BString (org.ballerinalang.model.values.BString)437 BInteger (org.ballerinalang.model.values.BInteger)323 BStruct (org.ballerinalang.model.values.BStruct)188 BFloat (org.ballerinalang.model.values.BFloat)118 BJSON (org.ballerinalang.model.values.BJSON)112 BBoolean (org.ballerinalang.model.values.BBoolean)79 CompileResult (org.ballerinalang.launcher.util.CompileResult)60 BRefValueArray (org.ballerinalang.model.values.BRefValueArray)45 BMap (org.ballerinalang.model.values.BMap)43 BXMLItem (org.ballerinalang.model.values.BXMLItem)42 BXML (org.ballerinalang.model.values.BXML)40 BStringArray (org.ballerinalang.model.values.BStringArray)30 BIntArray (org.ballerinalang.model.values.BIntArray)25 BBlob (org.ballerinalang.model.values.BBlob)23 HttpHeaders (io.netty.handler.codec.http.HttpHeaders)19 BeforeTest (org.testng.annotations.BeforeTest)19 HTTPCarbonMessage (org.wso2.transport.http.netty.message.HTTPCarbonMessage)19 BallerinaException (org.ballerinalang.util.exceptions.BallerinaException)16