Search in sources :

Example 76 with BString

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

the class StringTest method testNullToLowerCase.

@Test(expectedExceptions = { BLangRuntimeException.class }, expectedExceptionsMessageRegExp = ".*error:.*NullReferenceException.*")
public void testNullToLowerCase() {
    BValue[] args = { new BString(null) };
    BRunUtil.invoke(result, "toLowerCase", args);
}
Also used : BValue(org.ballerinalang.model.values.BValue) BString(org.ballerinalang.model.values.BString) Test(org.testng.annotations.Test)

Example 77 with BString

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

the class StringTest method testNullToUpperCase.

@Test(expectedExceptions = { BLangRuntimeException.class }, expectedExceptionsMessageRegExp = ".*error:.*NullReferenceException.*")
public void testNullToUpperCase() {
    BValue[] args = { new BString(null) };
    BRunUtil.invoke(result, "toUpperCase", args);
}
Also used : BValue(org.ballerinalang.model.values.BValue) BString(org.ballerinalang.model.values.BString) Test(org.testng.annotations.Test)

Example 78 with BString

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

the class StringTest method testReplaceFirst.

@Test
public void testReplaceFirst() {
    BValue[] args = { new BString("abc is not abc as abc anymore"), new BString("abc"), new BString("xyz") };
    BValue[] returns = BRunUtil.invoke(result, "replaceFirst", args);
    Assert.assertTrue(returns[0] instanceof BString);
    Assert.assertEquals(returns[0].stringValue(), "xyz is not abc as abc anymore");
}
Also used : BValue(org.ballerinalang.model.values.BValue) BString(org.ballerinalang.model.values.BString) Test(org.testng.annotations.Test)

Example 79 with BString

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

the class StringTest method testReplaceFirstNull.

@Test(expectedExceptions = { BLangRuntimeException.class }, expectedExceptionsMessageRegExp = ".*error:.*NullReferenceException.*")
public void testReplaceFirstNull() {
    BValue[] args = { new BString("abc is not abc as abc anymore"), new BString(null), new BString("xyz") };
    BRunUtil.invoke(result, "replaceFirst", args);
}
Also used : BValue(org.ballerinalang.model.values.BValue) BString(org.ballerinalang.model.values.BString) Test(org.testng.annotations.Test)

Example 80 with BString

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

the class StringTest method testLastIndexOf.

@Test
public void testLastIndexOf() {
    BValue[] args = { new BString("test x value x is x 18"), new BString("x") };
    BRunUtil.invoke(result, "lastIndexOf", args);
}
Also used : BValue(org.ballerinalang.model.values.BValue) BString(org.ballerinalang.model.values.BString) Test(org.testng.annotations.Test)

Aggregations

BString (org.ballerinalang.model.values.BString)418 BValue (org.ballerinalang.model.values.BValue)339 Test (org.testng.annotations.Test)321 BInteger (org.ballerinalang.model.values.BInteger)77 BStruct (org.ballerinalang.model.values.BStruct)76 BMap (org.ballerinalang.model.values.BMap)37 BBoolean (org.ballerinalang.model.values.BBoolean)36 BFloat (org.ballerinalang.model.values.BFloat)34 BJSON (org.ballerinalang.model.values.BJSON)28 BallerinaException (org.ballerinalang.util.exceptions.BallerinaException)21 BRefValueArray (org.ballerinalang.model.values.BRefValueArray)18 DefaultHttpHeaders (io.netty.handler.codec.http.DefaultHttpHeaders)11 HttpHeaders (io.netty.handler.codec.http.HttpHeaders)11 CompileResult (org.ballerinalang.launcher.util.CompileResult)11 BBlob (org.ballerinalang.model.values.BBlob)11 BStringArray (org.ballerinalang.model.values.BStringArray)11 BType (org.ballerinalang.model.types.BType)10 BIntArray (org.ballerinalang.model.values.BIntArray)9 BRefType (org.ballerinalang.model.values.BRefType)9 UnsupportedEncodingException (java.io.UnsupportedEncodingException)7