예제 #1
0
  public void test_CDATA(String config) throws IOException, SAXException {
    Smooks smooks = new Smooks(getClass().getResourceAsStream(config));
    StringResult result = new StringResult();

    smooks.filterSource(new StreamSource(getClass().getResourceAsStream("in-message.xml")), result);
    assertTrue(
        StreamUtils.compareCharStreams(
            new InputStreamReader(getClass().getResourceAsStream("in-message.xml")),
            new StringReader(result.getResult())));
  }
  public void test_indent() throws IOException, SAXException {
    Smooks smooks = new Smooks(getClass().getResourceAsStream("indent-config.xml"));
    StringResult result = new StringResult();

    smooks.filterSource(
        new StreamSource(getClass().getResourceAsStream("input-message.jsn")), result);

    assertTrue(
        XMLUnit.compareXML(
                StreamUtils.readStreamAsString(
                    getClass().getResourceAsStream("indent-expected.xml")),
                result.toString())
            .identical());
  }