use of org.ballerinalang.model.values.BValue in project ballerina by ballerina-lang.
the class BJSONValueTest method testJsonStringToJson.
@Test
public void testJsonStringToJson() {
BValue[] returns = BRunUtil.invoke(compileResult, "testJsonStringToJson");
Assert.assertTrue(returns[0] instanceof BJSON);
BJSON json = ((BJSON) returns[0]);
Assert.assertEquals(json.toString(), "{\"name\", \"supun\"}");
}
use of org.ballerinalang.model.values.BValue in project ballerina by ballerina-lang.
the class BJSONValueTest method testUpdateBooleanInArray.
@Test
public void testUpdateBooleanInArray() {
BValue[] returns = BRunUtil.invoke(compileResult, "testUpdateBooleanInArray");
Assert.assertTrue(returns[0] instanceof BJSON);
BJSON json = ((BJSON) returns[0]);
Assert.assertEquals(json.toString(), "[\"a\",true,\"c\"]");
}
use of org.ballerinalang.model.values.BValue in project ballerina by ballerina-lang.
the class BJSONValueTest method testUpdateFloatInArray.
@Test
public void testUpdateFloatInArray() {
BValue[] returns = BRunUtil.invoke(compileResult, "testUpdateFloatInArray");
Assert.assertTrue(returns[0] instanceof BJSON);
BJSON json = ((BJSON) returns[0]);
Assert.assertEquals(json.toString(), "[\"a\",4.72,\"c\"]");
}
use of org.ballerinalang.model.values.BValue in project ballerina by ballerina-lang.
the class BJSONValueTest method testUpdateJsonInArray.
@Test
public void testUpdateJsonInArray() {
BValue[] returns = BRunUtil.invoke(compileResult, "testUpdateJsonInArray");
Assert.assertTrue(returns[0] instanceof BJSON);
BJSON json = ((BJSON) returns[0]);
Assert.assertEquals(json.toString(), "[\"a\",{\"country\":\"SriLanka\"},\"c\"]");
}
use of org.ballerinalang.model.values.BValue in project ballerina by ballerina-lang.
the class BJSONValueTest method testUpdateString.
@Test
public void testUpdateString() {
BValue[] returns = BRunUtil.invoke(compileResult, "testUpdateString");
Assert.assertTrue(returns[0] instanceof BJSON);
BJSON json = ((BJSON) returns[0]);
Assert.assertEquals(json.toString(), "{\"fname\":\"Supun\",\"lname\":\"Setunga\"}");
}
Aggregations