Package org.apache.http.mockup

Examples of org.apache.http.mockup.HttpEntityMockup


    public static Test suite() {
        return new TestSuite(TestAbstractHttpEntity.class);
    }

    public void testContentType() throws Exception {
      HttpEntityMockup httpentity = new HttpEntityMockup();
        httpentity.setContentType(new BasicHeader(HTTP.CONTENT_TYPE, HTTP.PLAIN_TEXT_TYPE));
        assertEquals(HTTP.CONTENT_TYPE, httpentity.getContentType().getName());
        assertEquals(HTTP.PLAIN_TEXT_TYPE, httpentity.getContentType().getValue());

        httpentity.setContentType(HTTP.PLAIN_TEXT_TYPE);
        assertEquals(HTTP.CONTENT_TYPE, httpentity.getContentType().getName());
        assertEquals(HTTP.PLAIN_TEXT_TYPE, httpentity.getContentType().getValue());

        httpentity.setContentType((Header)null);
        assertNull(httpentity.getContentType());
        httpentity.setContentType((String)null);
        assertNull(httpentity.getContentType());
    }
View Full Code Here


        httpentity.setContentType((String)null);
        assertNull(httpentity.getContentType());
    }

    public void testContentEncoding() throws Exception {
        HttpEntityMockup httpentity = new HttpEntityMockup();
        httpentity.setContentEncoding(new BasicHeader(HTTP.CONTENT_ENCODING, "gzip"));
        assertEquals(HTTP.CONTENT_ENCODING, httpentity.getContentEncoding().getName());
        assertEquals("gzip", httpentity.getContentEncoding().getValue());

        httpentity.setContentEncoding("gzip");
        assertEquals(HTTP.CONTENT_ENCODING, httpentity.getContentEncoding().getName());
        assertEquals("gzip", httpentity.getContentEncoding().getValue());

        httpentity.setContentEncoding((Header)null);
        assertNull(httpentity.getContentEncoding());
        httpentity.setContentEncoding((String)null);
        assertNull(httpentity.getContentEncoding());
    }
View Full Code Here

        httpentity.setContentEncoding((String)null);
        assertNull(httpentity.getContentEncoding());
    }

    public void testChunkingFlag() throws Exception {
        HttpEntityMockup httpentity = new HttpEntityMockup();
        assertFalse(httpentity.isChunked());
        httpentity.setChunked(true);
        assertTrue(httpentity.isChunked());
    }
View Full Code Here

        httpentity.setChunked(true);
        assertTrue(httpentity.isChunked());
    }
   
    public void testConsumeContent() throws Exception {
        HttpEntityMockup httpentity = new HttpEntityMockup();
        httpentity.setStreaming(true);
        try {
            httpentity.consumeContent();
        } catch (UnsupportedOperationException ex) {
            // expected
        }
        httpentity.setStreaming(false);
        httpentity.consumeContent();
    }
View Full Code Here

    public static Test suite() {
        return new TestSuite(TestAbstractHttpEntity.class);
    }

    public void testContentType() throws Exception {
      HttpEntityMockup httpentity = new HttpEntityMockup();
        httpentity.setContentType(new BasicHeader(HTTP.CONTENT_TYPE, HTTP.PLAIN_TEXT_TYPE));
        assertEquals(HTTP.CONTENT_TYPE, httpentity.getContentType().getName());
        assertEquals(HTTP.PLAIN_TEXT_TYPE, httpentity.getContentType().getValue());

        httpentity.setContentType(HTTP.PLAIN_TEXT_TYPE);
        assertEquals(HTTP.CONTENT_TYPE, httpentity.getContentType().getName());
        assertEquals(HTTP.PLAIN_TEXT_TYPE, httpentity.getContentType().getValue());

        httpentity.setContentType((Header)null);
        assertNull(httpentity.getContentType());
        httpentity.setContentType((String)null);
        assertNull(httpentity.getContentType());
    }
View Full Code Here

        httpentity.setContentType((String)null);
        assertNull(httpentity.getContentType());
    }

    public void testContentEncoding() throws Exception {
        HttpEntityMockup httpentity = new HttpEntityMockup();
        httpentity.setContentEncoding(new BasicHeader(HTTP.CONTENT_ENCODING, "gzip"));
        assertEquals(HTTP.CONTENT_ENCODING, httpentity.getContentEncoding().getName());
        assertEquals("gzip", httpentity.getContentEncoding().getValue());

        httpentity.setContentEncoding("gzip");
        assertEquals(HTTP.CONTENT_ENCODING, httpentity.getContentEncoding().getName());
        assertEquals("gzip", httpentity.getContentEncoding().getValue());

        httpentity.setContentEncoding((Header)null);
        assertNull(httpentity.getContentEncoding());
        httpentity.setContentEncoding((String)null);
        assertNull(httpentity.getContentEncoding());
    }
View Full Code Here

        httpentity.setContentEncoding((String)null);
        assertNull(httpentity.getContentEncoding());
    }

    public void testChunkingFlag() throws Exception {
        HttpEntityMockup httpentity = new HttpEntityMockup();
        assertFalse(httpentity.isChunked());
        httpentity.setChunked(true);
        assertTrue(httpentity.isChunked());
    }
View Full Code Here

        httpentity.setChunked(true);
        assertTrue(httpentity.isChunked());
    }
   
    public void testConsumeContent() throws Exception {
        HttpEntityMockup httpentity = new HttpEntityMockup();
        httpentity.setStreaming(true);
        try {
            httpentity.consumeContent();
        } catch (UnsupportedOperationException ex) {
            // expected
        }
        httpentity.setStreaming(false);
        httpentity.consumeContent();
    }
View Full Code Here

    public static Test suite() {
        return new TestSuite(TestAbstractHttpEntity.class);
    }

    public void testContentType() throws Exception {
      HttpEntityMockup httpentity = new HttpEntityMockup();
        httpentity.setContentType(new BasicHeader(HTTP.CONTENT_TYPE, HTTP.PLAIN_TEXT_TYPE));
        assertEquals(HTTP.CONTENT_TYPE, httpentity.getContentType().getName());
        assertEquals(HTTP.PLAIN_TEXT_TYPE, httpentity.getContentType().getValue());

        httpentity.setContentType(HTTP.PLAIN_TEXT_TYPE);
        assertEquals(HTTP.CONTENT_TYPE, httpentity.getContentType().getName());
        assertEquals(HTTP.PLAIN_TEXT_TYPE, httpentity.getContentType().getValue());

        httpentity.setContentType((Header)null);
        assertNull(httpentity.getContentType());
        httpentity.setContentType((String)null);
        assertNull(httpentity.getContentType());
    }
View Full Code Here

        httpentity.setContentType((String)null);
        assertNull(httpentity.getContentType());
    }

    public void testContentEncoding() throws Exception {
        HttpEntityMockup httpentity = new HttpEntityMockup();
        httpentity.setContentEncoding(new BasicHeader(HTTP.CONTENT_ENCODING, "gzip"));
        assertEquals(HTTP.CONTENT_ENCODING, httpentity.getContentEncoding().getName());
        assertEquals("gzip", httpentity.getContentEncoding().getValue());

        httpentity.setContentEncoding("gzip");
        assertEquals(HTTP.CONTENT_ENCODING, httpentity.getContentEncoding().getName());
        assertEquals("gzip", httpentity.getContentEncoding().getValue());

        httpentity.setContentEncoding((Header)null);
        assertNull(httpentity.getContentEncoding());
        httpentity.setContentEncoding((String)null);
        assertNull(httpentity.getContentEncoding());
    }
View Full Code Here

TOP

Related Classes of org.apache.http.mockup.HttpEntityMockup

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.