Code example for BasicHttpRequest

Methods: getFirstHeader

0
        assertEquals("whatever", header.getValue());
    } 
 
    public void testRequestUserAgentMissingUserAgent() throws Exception { 
        HttpContext context = new BasicHttpContext(null);
        BasicHttpRequest request = new BasicHttpRequest("GET", "/");
        RequestUserAgent interceptor = new RequestUserAgent();
        interceptor.process(request, context);
        Header header = request.getFirstHeader(HTTP.USER_AGENT);
        assertNull(header);
    } 
 
    public void testRequestUserAgentInvalidInput() throws Exception { 
        RequestUserAgent interceptor = new RequestUserAgent();
        try { 
            interceptor.process(null, null);
            fail("IllegalArgumentException should have been thrown");
        } catch (IllegalArgumentException ex) {
            // expected 
        } 
Connect your IDE to all the code out there  Get Codota for Java