### Question:
PMMLUtils { public static PMML fromString(String pmmlString) throws IOException { try { SAXSource transformed = SAXUtil.createFilteredSource( new ByteArrayInputStream(pmmlString.getBytes(StandardCharsets.UTF_8)), new ImportFilter()); return JAXBUtil.unmarshalPMML(transformed); } catch (JAXBException | SAXException e) { throw new IOException(e); } } private  PMMLUtils(); static PMML buildSkeletonPMML(); static void write(PMML pmml, Path path); static void write(PMML pmml, OutputStream out); static PMML read(Path path); static PMML read(InputStream in); static String toString(PMML pmml); static PMML fromString(String pmmlString); static final String VERSION; }### Answer:
@Test public void testFromString() throws Exception { PMML model = buildDummyModel(); PMML model2 = PMMLUtils.fromString(PMMLUtils.toString(model)); assertEquals(model.getHeader().getApplication().getName(), model2.getHeader().getApplication().getName()); assertEquals(model.getModels().get(0).getMiningFunction(), model2.getModels().get(0).getMiningFunction()); }
@Test public void testPreviousPMMLVersion() throws Exception { String pmml42 = "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n" + "<PMML xmlns=\"http: " <Header>\n" + " <Application name=\"Oryx\"/>\n" + " </Header>\n" + " <TreeModel functionName=\"classification\">\n" + " <Node recordCount=\"123.0\"/>\n" + " </TreeModel>\n" + "</PMML>\n"; PMML model = PMMLUtils.fromString(pmml42); assertEquals(PMMLUtils.VERSION, model.getVersion()); }