summaryrefslogtreecommitdiffstats
path: root/jdisc_http_service/src/test/java/com/yahoo/jdisc/http/client/EmptyResponseTestCase.java
blob: 62b9612e59b3d1f7e19854ecb707e542546e2e3a (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
// Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.jdisc.http.client;

import org.testng.annotations.Test;

import java.io.IOException;

import static org.testng.Assert.assertEquals;
import static org.testng.Assert.assertNull;
import static org.testng.Assert.assertFalse;

/**
 * @author <a href="mailto:vikasp@yahoo-inc.com">Vikas Panwar</a>
 */
public class EmptyResponseTestCase {
    @Test(enabled = false)
    public void testGetterSetters() throws IOException {
        EmptyResponse underTest = EmptyResponse.INSTANCE;

        assertEquals(0, underTest.getStatusCode());
        assertNull(underTest.getStatusText());
        assertEquals(0, underTest.getResponseBodyAsByteBuffer().remaining());
        assertEquals(0, underTest.getResponseBodyAsBytes().length);
        assertNull(underTest.getResponseBodyAsStream());
        assertNull(underTest.getResponseBody());
        assertNull(underTest.getResponseBodyExcerpt(10, ""));
        assertNull(underTest.getResponseBodyExcerpt(10));
        assertNull(underTest.getResponseBody());
        assertNull(underTest.getUri());
        assertNull(underTest.getContentType());
        assertNull(underTest.getHeader(""));
        assertNull(underTest.getHeaders(""));
        assertNull(underTest.getHeaders());
        assertFalse(underTest.isRedirected());
        assertNull(underTest.getCookies());
        assertFalse(underTest.hasResponseStatus());
        assertFalse(underTest.hasResponseHeaders());
        assertFalse(underTest.hasResponseBody());
    }
}