Java Code Examples for com.bazaarvoice.jolt.JsonUtils#cloneJson()

The following examples show how to use com.bazaarvoice.jolt.JsonUtils#cloneJson() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: SimpleTraversalTest.java    From jolt with Apache License 2.0 5 votes vote down vote up
@Test( dataProvider = "inAndOutTestCases")
public void getTests( String testDescription, SimpleTraversal simpleTraversal, Object ignoredForTest, Object input, String expected ) throws IOException {

    Object original = JsonUtils.cloneJson( input );
    Object tree = JsonUtils.cloneJson( input );

    Optional actual = simpleTraversal.get( tree );

    Assert.assertEquals( expected, actual.get() );
    JoltTestUtil.runDiffy( "Get should not have modified the input", original, tree );
}
 
Example 2
Source File: DeepCopySubstitution.java    From camel-quarkus with Apache License 2.0 4 votes vote down vote up
@Substitute
public static Object simpleDeepCopy(Object toCopy) {
    return JsonUtils.cloneJson(toCopy);
}
 
Example 3
Source File: SimpleTraversalTest.java    From jolt with Apache License 2.0 3 votes vote down vote up
@Test( dataProvider = "inAndOutTestCases")
public void setTests( String testDescription, SimpleTraversal simpleTraversal, Object start, Object expected, String toSet ) {

    Object actual = JsonUtils.cloneJson( start );

    Assert.assertEquals( toSet, simpleTraversal.set( actual, toSet ).get() ); // set should be successful

    Assert.assertEquals( expected, actual );
}