Package org.mojavemvc.views

Examples of org.mojavemvc.views.XML


    @Action("xml")
    public XML sendXML() {

        String xml = "<?xml version=\"1.0\" encoding=\"UTF-8\"?><Test><hello/></Test>";

        return new XML(xml);
    }
View Full Code Here


*/
public class TestXML {

    @Test
    public void returnsCorrectContentType() {
        XML xml = new XML("");
        assertEquals("application/xml", xml.getContentType());
    }
View Full Code Here

        assertEquals("application/xml", xml.getContentType());
    }
   
    @Test
    public void toStringAfterObjectConstructorReturnsXML() {
        XML xml = new XML(new SimplePojo("test"));
        assertEquals("<SimplePojo><val>test</val></SimplePojo>", xml.toString());
    }
View Full Code Here

    private static class TestValidActionController1 {

        @Action("someAction")
        public XML someAction() {

            return new XML("<test/>");
        }
View Full Code Here

    private static class TestValidActionController2 {

        @DefaultAction
        public XML defaultAction() {

            return new XML("<test/>");
        }
View Full Code Here

       
        XMLEntityMarshaller m = new XMLEntityMarshaller();
        SimplePojo entity = new SimplePojo("test");
        View v = m.marshall(entity);
        assertTrue(v instanceof XML);
        assertEquals(new XML(entity).toString(), ((XML)v).toString());
    }
View Full Code Here

        SimplePojo entity = new SimplePojo("test");
        MarshallablePojo<SimplePojo> marshallable =
                new MarshallablePojo<SimplePojo>(entity);
        View v = m.marshall(marshallable);
        assertTrue(v instanceof XML);
        assertEquals(new XML(entity).toString(), ((XML)v).toString());
    }
View Full Code Here

        XMLEntityMarshaller m = new XMLEntityMarshaller();
        SimplePojo entity = new SimplePojo("test");
        AnnotatedPojo marshallable = new AnnotatedPojo(entity);
        View v = m.marshall(marshallable);
        assertTrue(v instanceof XML);
        assertEquals(new XML(entity).toString(), ((XML)v).toString());
    }
View Full Code Here

    private final EntityResolver entityResolver = new EntityResolver();
   
    @Override
    public View marshall(Object entity) {
        entity = entityResolver.resolve(entity);
        return new XML(entity);
    }
View Full Code Here

TOP

Related Classes of org.mojavemvc.views.XML

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.