@Test(expectedExceptions = SpecException.class) public void testSpecExceptions() throws IOException { String testPath = "/json/cardinality/failCardinalityType"; Map<String, Object> testUnit = JsonUtils.classpathToMap(testPath + ".json"); Object spec = testUnit.get("spec"); // Should throw exception new CardinalityTransform(spec); }
@Test(dataProvider = "getTestCaseUnits") public void runTestUnits(String testCaseName) throws IOException { String testPath = "/json/cardinality/" + testCaseName; Map<String, Object> testUnit = JsonUtils.classpathToMap(testPath + ".json"); Object input = testUnit.get("input"); Object spec = testUnit.get("spec"); Object expected = testUnit.get("expected"); CardinalityTransform cardinalityTransform = new CardinalityTransform(spec); Object actual = cardinalityTransform.transform(input); JoltTestUtil.runDiffy("failed case " + testPath, expected, actual); }