Package com.bazaarvoice.jolt

Examples of com.bazaarvoice.jolt.Chainr.transform()


    }

    @Test(dataProvider = "badTransforms", expectedExceptions = TransformException.class )
    public void testBadTransforms(Object chainrSpec) {
        Chainr unit = Chainr.fromSpec( chainrSpec );
        unit.transform( new HashMap(), null );// should fail here
        AssertJUnit.fail( "Should not have gotten here" );
    }

    @DataProvider
    public Object[][] passingTestCases() throws IOException {
View Full Code Here


    @Test(dataProvider = "passingTestCases" )
    public void testPassing(Object input, Object spec) {
        Chainr unit = Chainr.fromSpec( spec );
        TransformTestResult actual = null;
        actual = (TransformTestResult) unit.transform( input, null );

        AssertJUnit.assertEquals( input, actual.input );
        AssertJUnit.assertNotNull( actual.spec );
    }
View Full Code Here

    public void testChainrIncrementsFromTo( Object chainrSpec, int start, int end ) throws IOException {
        Chainr chainr = Chainr.fromSpec( chainrSpec );

        Object expected = JsonUtils.classpathToObject( "/json/chainr/increments/" + start + "-" + end + ".json" );

        Object actual = chainr.transform( start, end, new HashMap() );

        JoltTestUtil.runDiffy( "failed incremental From-To Chainr", expected, actual );
    }

View Full Code Here

        Chainr chainr = Chainr.fromSpec( chainrSpec );

        Object expected = JsonUtils.classpathToObject( "/json/chainr/increments/0-" + end + ".json" );

        Object actual = chainr.transform( end, new HashMap() );

        JoltTestUtil.runDiffy( "failed incremental To Chainr", expected, actual );
    }

    @DataProvider
View Full Code Here

    }

    @Test( dataProvider = "failTests", expectedExceptions = TransformException.class)
    public void testFails( Object chainrSpec, int start, int end  ) throws IOException {
        Chainr chainr = Chainr.fromSpec( chainrSpec );
        chainr.transform( start, end, new HashMap());
    }
}
View Full Code Here

        Chainr unit = Chainr.fromSpec( spec, new GuiceChainrInstantiator( parentModule ) );

        Assert.assertFalse( unit.hasContextualTransforms() );
        Assert.assertEquals( unit.getContextualTransforms().size(), 0 );

        Object actual = unit.transform( input, null );

        JoltTestUtil.runDiffy( "failed case " + testPath, expected, actual );
    }

View Full Code Here

        List chainrSpecJSON = JsonUtils.classpathToList( "/json/sample/spec.json" );
        Chainr chainr = Chainr.fromSpec( chainrSpecJSON );

        Object inputJSON = JsonUtils.classpathToObject( "/json/sample/input.json" );

        Object transformedOutput = chainr.transform( inputJSON );
        System.out.println( JsonUtils.toJsonString( transformedOutput ) );
    }
}
View Full Code Here

        Chainr unit = Chainr.fromSpec( spec, new GuiceChainrInstantiator( parentModule ) );

        Assert.assertTrue( unit.hasContextualTransforms() );
        Assert.assertEquals( unit.getContextualTransforms().size(), 2 );

        Object actual = unit.transform( input, context );

        JoltTestUtil.runDiffy( "failed case " + testCaseName, expected, actual );
    }
}
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.