use of org.ballerinalang.model.values.BBoolean in project carbon-apimgt by wso2.
the class MapPutAndGetTestCase method testMapOperations.
@Test
public void testMapOperations() {
// Create arguments to initiate map put
BValue[] args = { new BString("testMapEntry"), new BString("testMapValue") };
// Test ballerina map put and get for BString
BValue[] returns = BLangFunctions.invokeNew(bLangProgram, "testMapPutAndGet", args);
// Assert if map entry is BValue
Assert.assertTrue(returns[0] instanceof BValue);
final String expected = "testMapValue";
// Assert if return entry matched with exact entry we put there
Assert.assertEquals(returns[0].stringValue(), expected);
// Test ballerina Boolean values.
BValue[] argsBoolean = { new BString("testMapEntry"), new BBoolean(false) };
BValue[] returnsBoolean = BLangFunctions.invokeNew(bLangProgram, "testMapPutAndGet", argsBoolean);
Assert.assertTrue(returnsBoolean[0] instanceof BBoolean);
// Test ballerina JSON values.
BValue[] argsJSON = { new BString("testMapEntry"), new BJSON("{}") };
BValue[] returnsJSON = BLangFunctions.invokeNew(bLangProgram, "testMapPutAndGet", argsJSON);
Assert.assertTrue(returnsJSON[0] instanceof BJSON);
}
Aggregations