Search in sources :

Example 1 with InputNode

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) {
            ;
        }
    }
}
Also used : InputNode(org.omg.dmn.tck.marshaller._20160719.TestCases.TestCase.InputNode) TestCase(org.omg.dmn.tck.marshaller._20160719.TestCases.TestCase) InputStream(java.io.InputStream) JAXBElement(javax.xml.bind.JAXBElement) Element(org.w3c.dom.Element) File(java.io.File) JAXBException(javax.xml.bind.JAXBException) Test(org.junit.Test)

Aggregations

File (java.io.File)1 InputStream (java.io.InputStream)1 JAXBElement (javax.xml.bind.JAXBElement)1 JAXBException (javax.xml.bind.JAXBException)1 Test (org.junit.Test)1 TestCase (org.omg.dmn.tck.marshaller._20160719.TestCases.TestCase)1 InputNode (org.omg.dmn.tck.marshaller._20160719.TestCases.TestCase.InputNode)1 Element (org.w3c.dom.Element)1