@Test(dataProvider = "getTestCaseNames") public void runTestCases(String testCaseName) throws IOException { String testPath = "/json/removr/" + testCaseName; Map<String, Object> testUnit = JsonUtils.classpathToMap( testPath + ".json" ); Object input = testUnit.get( "input" ); Object spec = testUnit.get( "spec" ); Object expected = testUnit.get( "expected" ); Removr removr = new Removr( spec ); Object actual = removr.transform( input ); JoltTestUtil.runDiffy( "failed case " + testPath, expected, actual ); }
@Override public Object transform( Object input ) { Map<String,Object> wrappedMap = new HashMap<>(); wrappedMap.put(ROOT_KEY, input); rootSpec.applyToMap( wrappedMap ); return input; }
Removr implements SpecDriven, Transform { @Override public Object transform( Object input ) { Map<String,Object> wrappedMap = new HashMap<>(); wrappedMap.put(ROOT_KEY, input); rootSpec.applyToMap( wrappedMap ); return input; } }
Removr implements SpecDriven, Transform { @Override public Object transform( Object input ) { Map<String,Object> wrappedMap = new HashMap<>(); wrappedMap.put(ROOT_KEY, input); rootSpec.applyToMap( wrappedMap ); return input; } @Inject  Removr( Object spec ); }
Removr implements SpecDriven, Transform { @Override public Object transform( Object input ) { Map<String,Object> wrappedMap = new HashMap<>(); wrappedMap.put(ROOT_KEY, input); rootSpec.applyToMap( wrappedMap ); return input; } @Inject  Removr( Object spec ); @Override Object transform( Object input ); }
Removr implements SpecDriven, Transform { @Override public Object transform( Object input ) { Map<String,Object> wrappedMap = new HashMap<>(); wrappedMap.put(ROOT_KEY, input); rootSpec.applyToMap( wrappedMap ); return input; } @Inject  Removr( Object spec ); @Override Object transform( Object input );  }