FileDocCategorySizeDatePackage
HurlStackTest.javaAPI DocAndroid 5.1 API6391Thu Mar 12 22:22:56 GMT 2015com.android.volley.toolbox

HurlStackTest

public class HurlStackTest extends android.test.AndroidTestCase

Fields Summary
private com.android.volley.mock.MockHttpURLConnection
mMockConnection
Constructors Summary
Methods Summary
protected voidsetUp()

        super.setUp();
        mContext = getContext();
        mMockConnection = new MockHttpURLConnection();
    
public voidtestConnectionForDeleteRequest()

        TestRequest.Delete request = new TestRequest.Delete();
        assertEquals(request.getMethod(), Method.DELETE);

        HurlStack.setConnectionParametersForRequest(mMockConnection, request);
        assertEquals("DELETE", mMockConnection.getRequestMethod());
        assertFalse(mMockConnection.getDoOutput());
    
public voidtestConnectionForDeprecatedGetRequest()

        TestRequest.DeprecatedGet request = new TestRequest.DeprecatedGet();
        assertEquals(request.getMethod(), Method.DEPRECATED_GET_OR_POST);

        HurlStack.setConnectionParametersForRequest(mMockConnection, request);
        assertEquals("GET", mMockConnection.getRequestMethod());
        assertFalse(mMockConnection.getDoOutput());
    
public voidtestConnectionForDeprecatedPostRequest()

        TestRequest.DeprecatedPost request = new TestRequest.DeprecatedPost();
        assertEquals(request.getMethod(), Method.DEPRECATED_GET_OR_POST);

        HurlStack.setConnectionParametersForRequest(mMockConnection, request);
        assertEquals("POST", mMockConnection.getRequestMethod());
        assertTrue(mMockConnection.getDoOutput());
    
public voidtestConnectionForGetRequest()

        TestRequest.Get request = new TestRequest.Get();
        assertEquals(request.getMethod(), Method.GET);

        HurlStack.setConnectionParametersForRequest(mMockConnection, request);
        assertEquals("GET", mMockConnection.getRequestMethod());
        assertFalse(mMockConnection.getDoOutput());
    
public voidtestConnectionForHeadRequest()

        TestRequest.Head request = new TestRequest.Head();
        assertEquals(request.getMethod(), Method.HEAD);

        HurlStack.setConnectionParametersForRequest(mMockConnection, request);
        assertEquals("HEAD", mMockConnection.getRequestMethod());
        assertFalse(mMockConnection.getDoOutput());
    
public voidtestConnectionForOptionsRequest()

        TestRequest.Options request = new TestRequest.Options();
        assertEquals(request.getMethod(), Method.OPTIONS);

        HurlStack.setConnectionParametersForRequest(mMockConnection, request);
        assertEquals("OPTIONS", mMockConnection.getRequestMethod());
        assertFalse(mMockConnection.getDoOutput());
    
public voidtestConnectionForPatchRequest()

        TestRequest.Patch request = new TestRequest.Patch();
        assertEquals(request.getMethod(), Method.PATCH);

        HurlStack.setConnectionParametersForRequest(mMockConnection, request);
        assertEquals("PATCH", mMockConnection.getRequestMethod());
        assertFalse(mMockConnection.getDoOutput());
    
public voidtestConnectionForPatchWithBodyRequest()

        TestRequest.PatchWithBody request = new TestRequest.PatchWithBody();
        assertEquals(request.getMethod(), Method.PATCH);

        HurlStack.setConnectionParametersForRequest(mMockConnection, request);
        assertEquals("PATCH", mMockConnection.getRequestMethod());
        assertTrue(mMockConnection.getDoOutput());
    
public voidtestConnectionForPostRequest()

        TestRequest.Post request = new TestRequest.Post();
        assertEquals(request.getMethod(), Method.POST);

        HurlStack.setConnectionParametersForRequest(mMockConnection, request);
        assertEquals("POST", mMockConnection.getRequestMethod());
        assertFalse(mMockConnection.getDoOutput());
    
public voidtestConnectionForPostWithBodyRequest()

        TestRequest.PostWithBody request = new TestRequest.PostWithBody();
        assertEquals(request.getMethod(), Method.POST);

        HurlStack.setConnectionParametersForRequest(mMockConnection, request);
        assertEquals("POST", mMockConnection.getRequestMethod());
        assertTrue(mMockConnection.getDoOutput());
    
public voidtestConnectionForPutRequest()

        TestRequest.Put request = new TestRequest.Put();
        assertEquals(request.getMethod(), Method.PUT);

        HurlStack.setConnectionParametersForRequest(mMockConnection, request);
        assertEquals("PUT", mMockConnection.getRequestMethod());
        assertFalse(mMockConnection.getDoOutput());
    
public voidtestConnectionForPutWithBodyRequest()

        TestRequest.PutWithBody request = new TestRequest.PutWithBody();
        assertEquals(request.getMethod(), Method.PUT);

        HurlStack.setConnectionParametersForRequest(mMockConnection, request);
        assertEquals("PUT", mMockConnection.getRequestMethod());
        assertTrue(mMockConnection.getDoOutput());
    
public voidtestConnectionForTraceRequest()

        TestRequest.Trace request = new TestRequest.Trace();
        assertEquals(request.getMethod(), Method.TRACE);

        HurlStack.setConnectionParametersForRequest(mMockConnection, request);
        assertEquals("TRACE", mMockConnection.getRequestMethod());
        assertFalse(mMockConnection.getDoOutput());