use of org.ballerinalang.model.values.BString in project ballerina by ballerina-lang.
the class StringTest method testToLowerCase.
@Test
public void testToLowerCase() {
BValue[] args = { new BString("COMPANY") };
BValue[] returns = BRunUtil.invoke(result, "toLowerCase", args);
Assert.assertTrue(returns[0] instanceof BString);
Assert.assertEquals(returns[0].stringValue(), "company");
}
use of org.ballerinalang.model.values.BString in project ballerina by ballerina-lang.
the class StringTest method testFloatValueOf.
@Test
public void testFloatValueOf() {
BValue[] args = { new BFloat(1.345f) };
BValue[] returns = BRunUtil.invoke(result, "floatValueOf", args);
Assert.assertTrue(returns[0] instanceof BString);
final String expected = "1.345";
Assert.assertEquals(returns[0].stringValue().substring(0, 5), expected);
}
use of org.ballerinalang.model.values.BString in project ballerina by ballerina-lang.
the class StringTest method testJsonValueOf.
@Test
public void testJsonValueOf() {
BValue[] args = { new BJSON("{\"name\":\"chanaka\"}") };
BValue[] returns = BRunUtil.invoke(result, "jsonValueOf", args);
Assert.assertTrue(returns[0] instanceof BString);
final String expected = "{\"name\":\"chanaka\"}";
Assert.assertEquals(returns[0].stringValue(), expected);
}
use of org.ballerinalang.model.values.BString in project ballerina by ballerina-lang.
the class StringTest method testHasSuffix.
@Test
public void testHasSuffix() {
BValue[] args = { new BString("One Two"), new BString("Two") };
BRunUtil.invoke(result, "hasSuffix", args);
}
use of org.ballerinalang.model.values.BString in project ballerina by ballerina-lang.
the class StringTest method testReplaceFirstByNull.
@Test(expectedExceptions = { BLangRuntimeException.class }, expectedExceptionsMessageRegExp = ".*error:.*NullReferenceException.*")
public void testReplaceFirstByNull() {
BValue[] args = { new BString("abc is not abc as abc anymore"), new BString("abc"), new BString(null) };
BRunUtil.invoke(result, "replaceFirst", args);
}
Aggregations