com.android.volley.mock.TestRequest Java Examples

The following examples show how to use com.android.volley.mock.TestRequest. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: HttpClientStackTest.java    From product-emm with Apache License 2.0 5 votes vote down vote up
@Test public void createDeprecatedGetRequest() throws Exception {
    TestRequest.DeprecatedGet request = new TestRequest.DeprecatedGet();
    assertEquals(request.getMethod(), Method.DEPRECATED_GET_OR_POST);

    HttpUriRequest httpRequest = HttpClientStack.createHttpRequest(request, null);
    assertTrue(httpRequest instanceof HttpGet);
}
 
Example #2
Source File: HurlStackTest.java    From android-project-wo2b with Apache License 2.0 5 votes vote down vote up
public void testConnectionForDeleteRequest() throws Exception {
    TestRequest.Delete request = new TestRequest.Delete();
    assertEquals(request.getMethod(), Method.DELETE);

    HurlStack.setConnectionParametersForRequest(mMockConnection, request);
    assertEquals("DELETE", mMockConnection.getRequestMethod());
    assertFalse(mMockConnection.getDoOutput());
}
 
Example #3
Source File: HttpClientStackTest.java    From CrossBow with Apache License 2.0 5 votes vote down vote up
@Test public void createGetRequest() throws Exception {
    TestRequest.Get request = new TestRequest.Get();
    assertEquals(request.getMethod(), Method.GET);

    HttpUriRequest httpRequest = HttpClientStack.createHttpRequest(request, null);
    assertTrue(httpRequest instanceof HttpGet);
}
 
Example #4
Source File: HurlStackTest.java    From product-emm with Apache License 2.0 5 votes vote down vote up
@Test public void connectionForDeprecatedPostRequest() throws Exception {
    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());
}
 
Example #5
Source File: HttpClientStackTest.java    From SaveVolley with Apache License 2.0 5 votes vote down vote up
@Test public void createOptionsRequest() throws Exception {
    TestRequest.Options request = new TestRequest.Options();
    assertEquals(request.getMethod(), Method.OPTIONS);

    HttpUriRequest httpRequest = HttpClientStack.createHttpRequest(request, null);
    assertTrue(httpRequest instanceof HttpOptions);
}
 
Example #6
Source File: HurlStackTest.java    From product-emm with Apache License 2.0 5 votes vote down vote up
@Test public void connectionForPutWithBodyRequest() throws Exception {
    TestRequest.PutWithBody request = new TestRequest.PutWithBody();
    assertEquals(request.getMethod(), Method.PUT);

    HurlStack.setConnectionParametersForRequest(mMockConnection, request);
    assertEquals("PUT", mMockConnection.getRequestMethod());
    assertTrue(mMockConnection.getDoOutput());
}
 
Example #7
Source File: HurlStackTest.java    From product-emm with Apache License 2.0 5 votes vote down vote up
@Test public void connectionForPostWithBodyRequest() throws Exception {
    TestRequest.PostWithBody request = new TestRequest.PostWithBody();
    assertEquals(request.getMethod(), Method.POST);

    HurlStack.setConnectionParametersForRequest(mMockConnection, request);
    assertEquals("POST", mMockConnection.getRequestMethod());
    assertTrue(mMockConnection.getDoOutput());
}
 
Example #8
Source File: HttpClientStackTest.java    From android-project-wo2b with Apache License 2.0 5 votes vote down vote up
public void testCreatePostRequest() throws Exception {
    TestRequest.Post request = new TestRequest.Post();
    assertEquals(request.getMethod(), Method.POST);

    HttpUriRequest httpRequest = HttpClientStack.createHttpRequest(request, null);
    assertTrue(httpRequest instanceof HttpPost);
}
 
Example #9
Source File: HurlStackTest.java    From android-discourse with Apache License 2.0 5 votes vote down vote up
public void testConnectionForDeprecatedPostRequest() throws Exception {
    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());
}
 
Example #10
Source File: HttpClientStackTest.java    From android-discourse with Apache License 2.0 5 votes vote down vote up
public void testCreateDeprecatedGetRequest() throws Exception {
    TestRequest.DeprecatedGet request = new TestRequest.DeprecatedGet();
    assertEquals(request.getMethod(), Method.DEPRECATED_GET_OR_POST);

    HttpUriRequest httpRequest = HttpClientStack.createHttpRequest(request, null);
    assertTrue(httpRequest instanceof HttpGet);
}
 
Example #11
Source File: HttpClientStackTest.java    From SaveVolley with Apache License 2.0 5 votes vote down vote up
@Test public void createPutRequest() throws Exception {
    TestRequest.Put request = new TestRequest.Put();
    assertEquals(request.getMethod(), Method.PUT);

    HttpUriRequest httpRequest = HttpClientStack.createHttpRequest(request, null);
    assertTrue(httpRequest instanceof HttpPut);
}
 
Example #12
Source File: HurlStackTest.java    From SaveVolley with Apache License 2.0 5 votes vote down vote up
@Test public void connectionForGetRequest() throws Exception {
    TestRequest.Get request = new TestRequest.Get();
    assertEquals(request.getMethod(), Method.GET);

    HurlStack.setConnectionParametersForRequest(mMockConnection, request);
    assertEquals("GET", mMockConnection.getRequestMethod());
    assertFalse(mMockConnection.getDoOutput());
}
 
Example #13
Source File: HttpClientStackTest.java    From product-emm with Apache License 2.0 5 votes vote down vote up
@Test public void createPatchRequest() throws Exception {
    TestRequest.Patch request = new TestRequest.Patch();
    assertEquals(request.getMethod(), Method.PATCH);

    HttpUriRequest httpRequest = HttpClientStack.createHttpRequest(request, null);
    assertTrue(httpRequest instanceof HttpPatch);
}
 
Example #14
Source File: HttpClientStackTest.java    From product-emm with Apache License 2.0 5 votes vote down vote up
@Test public void createHeadRequest() throws Exception {
    TestRequest.Head request = new TestRequest.Head();
    assertEquals(request.getMethod(), Method.HEAD);

    HttpUriRequest httpRequest = HttpClientStack.createHttpRequest(request, null);
    assertTrue(httpRequest instanceof HttpHead);
}
 
Example #15
Source File: HurlStackTest.java    From product-emm with Apache License 2.0 5 votes vote down vote up
@Test public void connectionForOptionsRequest() throws Exception {
    TestRequest.Options request = new TestRequest.Options();
    assertEquals(request.getMethod(), Method.OPTIONS);

    HurlStack.setConnectionParametersForRequest(mMockConnection, request);
    assertEquals("OPTIONS", mMockConnection.getRequestMethod());
    assertFalse(mMockConnection.getDoOutput());
}
 
Example #16
Source File: HttpClientStackTest.java    From android-discourse with Apache License 2.0 5 votes vote down vote up
public void testCreatePostRequestWithBody() throws Exception {
    TestRequest.PostWithBody request = new TestRequest.PostWithBody();
    assertEquals(request.getMethod(), Method.POST);

    HttpUriRequest httpRequest = HttpClientStack.createHttpRequest(request, null);
    assertTrue(httpRequest instanceof HttpPost);
}
 
Example #17
Source File: HttpClientStackTest.java    From device-database with Apache License 2.0 5 votes vote down vote up
@Test public void createTraceRequest() throws Exception {
    TestRequest.Trace request = new TestRequest.Trace();
    assertEquals(request.getMethod(), Method.TRACE);

    HttpUriRequest httpRequest = HttpClientStack.createHttpRequest(request, null);
    assertTrue(httpRequest instanceof HttpTrace);
}
 
Example #18
Source File: HttpClientStackTest.java    From CrossBow with Apache License 2.0 5 votes vote down vote up
@Test public void createPatchRequestWithBody() throws Exception {
    TestRequest.PatchWithBody request = new TestRequest.PatchWithBody();
    assertEquals(request.getMethod(), Method.PATCH);

    HttpUriRequest httpRequest = HttpClientStack.createHttpRequest(request, null);
    assertTrue(httpRequest instanceof HttpPatch);
}
 
Example #19
Source File: HurlStackTest.java    From product-emm with Apache License 2.0 5 votes vote down vote up
@Test public void connectionForOptionsRequest() throws Exception {
    TestRequest.Options request = new TestRequest.Options();
    assertEquals(request.getMethod(), Method.OPTIONS);

    HurlStack.setConnectionParametersForRequest(mMockConnection, request);
    assertEquals("OPTIONS", mMockConnection.getRequestMethod());
    assertFalse(mMockConnection.getDoOutput());
}
 
Example #20
Source File: HttpClientStackTest.java    From device-database with Apache License 2.0 5 votes vote down vote up
@Test public void createDeleteRequest() throws Exception {
    TestRequest.Delete request = new TestRequest.Delete();
    assertEquals(request.getMethod(), Method.DELETE);

    HttpUriRequest httpRequest = HttpClientStack.createHttpRequest(request, null);
    assertTrue(httpRequest instanceof HttpDelete);
}
 
Example #21
Source File: HttpClientStackTest.java    From device-database with Apache License 2.0 5 votes vote down vote up
@Test public void createPutRequestWithBody() throws Exception {
    TestRequest.PutWithBody request = new TestRequest.PutWithBody();
    assertEquals(request.getMethod(), Method.PUT);

    HttpUriRequest httpRequest = HttpClientStack.createHttpRequest(request, null);
    assertTrue(httpRequest instanceof HttpPut);
}
 
Example #22
Source File: HttpClientStackTest.java    From CrossBow with Apache License 2.0 5 votes vote down vote up
@Test public void createDeprecatedPostRequest() throws Exception {
    TestRequest.DeprecatedPost request = new TestRequest.DeprecatedPost();
    assertEquals(request.getMethod(), Method.DEPRECATED_GET_OR_POST);

    HttpUriRequest httpRequest = HttpClientStack.createHttpRequest(request, null);
    assertTrue(httpRequest instanceof HttpPost);
}
 
Example #23
Source File: HurlStackTest.java    From product-emm with Apache License 2.0 5 votes vote down vote up
@Test public void connectionForPatchWithBodyRequest() throws Exception {
    TestRequest.PatchWithBody request = new TestRequest.PatchWithBody();
    assertEquals(request.getMethod(), Method.PATCH);

    HurlStack.setConnectionParametersForRequest(mMockConnection, request);
    assertEquals("PATCH", mMockConnection.getRequestMethod());
    assertTrue(mMockConnection.getDoOutput());
}
 
Example #24
Source File: HurlStackTest.java    From product-emm with Apache License 2.0 5 votes vote down vote up
@Test public void connectionForPostRequest() throws Exception {
    TestRequest.Post request = new TestRequest.Post();
    assertEquals(request.getMethod(), Method.POST);

    HurlStack.setConnectionParametersForRequest(mMockConnection, request);
    assertEquals("POST", mMockConnection.getRequestMethod());
    assertFalse(mMockConnection.getDoOutput());
}
 
Example #25
Source File: HttpClientStackTest.java    From device-database with Apache License 2.0 5 votes vote down vote up
@Test public void createGetRequest() throws Exception {
    TestRequest.Get request = new TestRequest.Get();
    assertEquals(request.getMethod(), Method.GET);

    HttpUriRequest httpRequest = HttpClientStack.createHttpRequest(request, null);
    assertTrue(httpRequest instanceof HttpGet);
}
 
Example #26
Source File: HttpClientStackTest.java    From device-database with Apache License 2.0 5 votes vote down vote up
@Test public void createDeprecatedPostRequest() throws Exception {
    TestRequest.DeprecatedPost request = new TestRequest.DeprecatedPost();
    assertEquals(request.getMethod(), Method.DEPRECATED_GET_OR_POST);

    HttpUriRequest httpRequest = HttpClientStack.createHttpRequest(request, null);
    assertTrue(httpRequest instanceof HttpPost);
}
 
Example #27
Source File: HurlStackTest.java    From android-project-wo2b with Apache License 2.0 5 votes vote down vote up
public void testConnectionForPutRequest() throws Exception {
    TestRequest.Put request = new TestRequest.Put();
    assertEquals(request.getMethod(), Method.PUT);

    HurlStack.setConnectionParametersForRequest(mMockConnection, request);
    assertEquals("PUT", mMockConnection.getRequestMethod());
    assertFalse(mMockConnection.getDoOutput());
}
 
Example #28
Source File: HurlStackTest.java    From device-database with Apache License 2.0 5 votes vote down vote up
@Test public void connectionForPatchWithBodyRequest() throws Exception {
    TestRequest.PatchWithBody request = new TestRequest.PatchWithBody();
    assertEquals(request.getMethod(), Method.PATCH);

    HurlStack.setConnectionParametersForRequest(mMockConnection, request);
    assertEquals("PATCH", mMockConnection.getRequestMethod());
    assertTrue(mMockConnection.getDoOutput());
}
 
Example #29
Source File: HurlStackTest.java    From device-database with Apache License 2.0 5 votes vote down vote up
@Test public void connectionForPatchRequest() throws Exception {
    TestRequest.Patch request = new TestRequest.Patch();
    assertEquals(request.getMethod(), Method.PATCH);

    HurlStack.setConnectionParametersForRequest(mMockConnection, request);
    assertEquals("PATCH", mMockConnection.getRequestMethod());
    assertFalse(mMockConnection.getDoOutput());
}
 
Example #30
Source File: HurlStackTest.java    From android-project-wo2b with Apache License 2.0 5 votes vote down vote up
public void testConnectionForTraceRequest() throws Exception {
    TestRequest.Trace request = new TestRequest.Trace();
    assertEquals(request.getMethod(), Method.TRACE);

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