modules/ballerina-native/src/test/java/org/ballerinalang/nativeimpl/functions/JSONTest.java
/*
     * Test Add-to-arrays Functions
     */
Test Add-to-arrays Functions
Test Add - to - arrays Functions
@Test(description = "Add a string to a valid json arrays")
    public void testAddStringToArray() {
        BValue[] args = {new BJSON(jsonStringArray), new BString("$.users"), new BString("Jos")};
        BValue[] returns = BLangFunctions.invoke(bLangProgram, "addStringToArray", args);
        final String expected = "{\"users\":[\"Jack\",\"Peter\",\"Jos\"]}";
        Assert.assertEquals(getJsonAsString(returns[0]), expected);
    }
@ Test ( description = "Add a string to a valid json arrays" ) public void testAddStringToArray ( ) { BValue [ ] args = { new BJSON ( jsonStringArray ) , new BString ( "$.users" ) , new BString ( "Jos" ) } ; BValue [ ] returns = BLangFunctions . invoke ( bLangProgram , "addStringToArray" , args ) ; final String expected = "{\"users\":[\"Jack\",\"Peter\",\"Jos\"]}" ; Assert . assertEquals ( getJsonAsString ( returns [ 0 ] ) , expected ) ; }
Test Add-to-arrays Functions
Test Add - to - arrays Functions