@Test
public void testRemoveInvalidXMLChars() throws Exception {

    SimpleFeatureType ft = DataUtilities.createType("invalidChars",
            "the_geom:Point,data:String");
    SimpleFeature feature = SimpleFeatureBuilder.build(ft,
            new Object[] { new WKTReader().read("POINT(0 0)"),
                    "One " + ((char) 0x7) + " test" }, "123");
    SimpleFeatureCollection fc = DataUtilities.collection(feature);
    FeatureTransformer tx = new FeatureTransformer();
    tx.setIndentation(2);
    tx.getFeatureTypeNamespaces().declareNamespace(ft, "gt", "http://www.geotools.org");
    ByteArrayOutputStream bos = new ByteArrayOutputStream();
    tx.transform(fc, bos);
    String result = bos.toString();
    // System.out.println(result);
    Document dom = XMLUnit.buildControlDocument(result);
    assertXpathEvaluatesTo("1", "count(//wfs:FeatureCollection)", dom);
    assertXpathEvaluatesTo("One  test", "//gt:data", dom);
}