Package org.mojavemvc.marshalling

Examples of org.mojavemvc.marshalling.PlainTextEntityMarshaller


    }
   
    @Test
    public void plainTextEntityMarshallerSupportsPlainTextContentType() {
       
        PlainTextEntityMarshaller m = new PlainTextEntityMarshaller();
        String[] contentTypes = m.contentTypesHandled();
        assertEquals(1, contentTypes.length);       
        assertEquals("text/plain", contentTypes[0]);
    }
View Full Code Here


    }
   
    @Test
    public void plainTextEntityMarshallerReturnsView() {
       
        PlainTextEntityMarshaller m = new PlainTextEntityMarshaller();
        SimplePojo entity = new SimplePojo("test");
        View v = m.marshall(entity);
        assertTrue(v instanceof PlainText);
        assertEquals(new PlainText(entity).toString(), ((PlainText)v).toString());
    }
View Full Code Here

    }
   
    @Test
    public void plainTextEntityMarshallerUnmarshallsString() {
       
        PlainTextEntityMarshaller m = new PlainTextEntityMarshaller();
        String text = "test";
        ByteArrayInputStream in = new ByteArrayInputStream(text.getBytes());
        String entity = m.unmarshall(in, String.class);
        assertNotNull(entity);
        assertEquals("test", entity);
    }
View Full Code Here

    }
   
    @Test
    public void plainTextEntityMarshallerUnmarshallsSimplePojo() {
       
        PlainTextEntityMarshaller m = new PlainTextEntityMarshaller();
        String text = "test";
        ByteArrayInputStream in = new ByteArrayInputStream(text.getBytes());
        SimplePojo entity = m.unmarshall(in, SimplePojo.class);
        assertNotNull(entity);
        assertEquals("test", entity.getVal());
    }
View Full Code Here

    }
   
    @Test
    public void plainTextEntityMarshallerHandlesMarshallable() {
       
        PlainTextEntityMarshaller m = new PlainTextEntityMarshaller();
        SimplePojo entity = new SimplePojo("test");
        MarshallablePojo<SimplePojo> marshallable =
                new MarshallablePojo<SimplePojo>(entity);
        View v = m.marshall(marshallable);
        assertTrue(v instanceof PlainText);
        assertEquals(new PlainText(entity).toString(), ((PlainText)v).toString());
    }
View Full Code Here

    }
   
    @Test
    public void plainTextEntityMarshallerHandlesMarshallAnnotation() {
       
        PlainTextEntityMarshaller m = new PlainTextEntityMarshaller();
        SimplePojo entity = new SimplePojo("test");
        AnnotatedPojo marshallable = new AnnotatedPojo(entity);
        View v = m.marshall(marshallable);
        assertTrue(v instanceof PlainText);
        assertEquals(new PlainText(entity).toString(), ((PlainText)v).toString());
    }
View Full Code Here

       
        Map<String, EntityMarshaller> marshallerMap = new HashMap<String, EntityMarshaller>();
       
        /* place the framework marshallers in the map first so that they
         * can be overridden by user's marshallers */
        addToEntityMarshallerMap(new PlainTextEntityMarshaller(), marshallerMap);
        addToEntityMarshallerMap(new JSONEntityMarshaller(), marshallerMap);
        addToEntityMarshallerMap(new XMLEntityMarshaller(), marshallerMap);
       
        String marshallersNamespaces = config.getInitParameter(ENTITY_MARSHALLERS);
        if (!isEmpty(marshallersNamespaces)) {
View Full Code Here

TOP

Related Classes of org.mojavemvc.marshalling.PlainTextEntityMarshaller

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.