Package org.mojavemvc.views

Examples of org.mojavemvc.views.JSON


    @Action("json")
    public JSON sendJSON() {

        String json = "{\"Test\":{\"hello\": 1}}";

        return new JSON(json);
    }
View Full Code Here


       
        JSONEntityMarshaller m = new JSONEntityMarshaller();
        SimplePojo entity = new SimplePojo("test");
        View v = m.marshall(entity);
        assertTrue(v instanceof JSON);
        assertEquals(new JSON(entity).toString(), ((JSON)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 JSON);
        assertEquals(new JSON(entity).toString(), ((JSON)v).toString());
    }
View Full Code Here

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

*/
public class TestJSON {

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

        assertEquals("application/json", json.getContentType());
    }
   
    @Test
    public void toStringAfterObjectConstructorReturnsJSON() {
        JSON json = new JSON(new SimplePojo("test"));
        assertEquals("{\"val\":\"test\"}", json.toString());
    }
View Full Code Here

    private final EntityResolver entityResolver = new EntityResolver();

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

TOP

Related Classes of org.mojavemvc.views.JSON

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.