Package flexjson.transformer

Examples of flexjson.transformer.HtmlEncoderTransformer


        assertAttributeMissing("birthdate", json);
    }

    @Test
    public void testHtmlTransformation() {
        String json = new JSONSerializer().transform(new HtmlEncoderTransformer(), "").serialize("Marker & Thompson");
        assertEquals("Assert that the & was replaced with &", "\"Marker & Thompson\"", json);

        Map<String, String> map = new HashMap<String, String>();
        map.put("Chuck D", "Chuck D <chuckd@publicenemy.com>");
        map.put("Run", "Run <run@rundmc.com>");
        json = new JSONSerializer().transform(new HtmlEncoderTransformer(), String.class).serialize(map);
        assertStringValue("Chuck D &lt;chuckd@publicenemy.com&gt;", json);
        assertStringValue("Run &lt;run@rundmc.com&gt;", json);

        Person xeno = new Person("><eno", "h&d", new Date(), new Address("1092 Hemphill", "Atlanta", "GA", new Zipcode("30319")), new Address("333 \"Diddle & Town\"", "Atlanta", "30329", new Zipcode("30320")));

        json = new JSONSerializer().transform(new HtmlEncoderTransformer(), "firstname", "lastname").exclude("*.class").serialize(xeno);

        assertStringValue("&gt;&lt;eno", json);
        assertStringValue("h&amp;d", json);
        assertStringValue("333 \\u0022Diddle \\u0026 Town\\u0022", json);
        assertStringValueMissing("333 &quot;Diddle &amp; Town&quot;", json);
View Full Code Here

TOP

Related Classes of flexjson.transformer.HtmlEncoderTransformer

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.