use of org.omg.dmn.tck.marshaller._20160719.TestCases.TestCase.InputNode in project tck by dmn-tck.
the class TestCasesTest method testRead0001.
@Test
public void testRead0001() throws Exception {
InputStream is = null;
try {
is = getClass().getResourceAsStream("/compliance-level-2/0001-input-data-string/0001-input-data-string-test-01.xml");
TestCases testCases = load(is);
assertNotNull(testCases);
assertEquals(2, testCases.getTestCase().size());
for (TestCase testCase : testCases.getTestCase()) {
for (InputNode inputNode : testCase.getInputNode()) {
if (inputNode.getValue() != null) {
System.out.println("inputNode is simple type with content: " + ((Element) inputNode.getValue().getValue()).getTextContent());
} else {
System.out.println("inputNode is complex: " + inputNode.getComponent());
}
}
}
String json = objectMapper.writeValueAsString(testCases);
// assertions on JSON go here
File testOutputDir = new File(baseOutputDir, "0001-input-data-string");
testOutputDir.mkdirs();
File jsonFile = new File(testOutputDir, "0001-input-data-string-test-01.json");
System.out.println("Writing JSON output to: " + jsonFile.getAbsolutePath());
objectMapper.writerWithDefaultPrettyPrinter().writeValue(jsonFile, testCases);
} finally {
try {
is.close();
} catch (Exception e) {
;
}
}
}
Aggregations