Package com.google.greaze.rest.client.fixtures

Examples of com.google.greaze.rest.client.fixtures.HttpUrlConnectionMock


    RequestBodySpec requestBodySpec = new RequestBodySpec.Builder()
      .setSimpleBody(String.class)
      .build();
    RequestBody requestBody = new RequestBody.Builder(requestBodySpec).build();
    for (HttpMethod method : new HttpMethod[]{HttpMethod.GET, HttpMethod.DELETE}) {
      HttpUrlConnectionMock conn = new HttpUrlConnectionMock();
      sender.send(conn, new WebServiceRequest(method, requestHeaders, null, requestBody, null, false));
      assertNull(conn.getHeaders().get("Content-Type"));
    }
  }
View Full Code Here


      .build();
    RequestBody requestBody = new RequestBody.Builder(requestBodySpec)
      .setSimpleBody("hello world")
      .build();
    for (HttpMethod method : new HttpMethod[]{HttpMethod.POST, HttpMethod.PUT}) {
      HttpUrlConnectionMock conn = new HttpUrlConnectionMock();
      sender.send(conn, new WebServiceRequest(method, requestHeaders, null, requestBody, null, false));
      assertEquals(ContentBodySpec.JSON_CONTENT_TYPE, conn.getHeaders().get("Content-Type"));
      assertEquals("hello world", conn.getBodyAsString());
    }
  }
View Full Code Here

    UrlParams urlParams = null;
    RequestBody requestBody = null;
    RequestSpec requestSpec = null;
    WebServiceRequest request = new WebServiceRequest(
        HttpMethod.GET, requestHeaders, urlParams, requestBody, requestSpec, false);
    HttpUrlConnectionMock conn = new HttpUrlConnectionMock();
    sender.send(conn, request);
    assertEquals("bob", conn.getHeaders().get("X-Name"));
    assertEquals("10000", conn.getHeaders().get("X-Salary"));
  }
View Full Code Here

    UrlParams urlParams = null;
    RequestBody requestBody = null;
    RequestSpec requestSpec = null;
    WebServiceRequest request = new WebServiceRequest(
        HttpMethod.GET, requestHeaders, urlParams, requestBody, requestSpec, false);
    HttpUrlConnectionMock conn = new HttpUrlConnectionMock();
    sender.send(conn, request);
    assertEquals("{\"real\":10,\"imaginary\":3}", conn.getHeaders().get("X-Number"));
  }
View Full Code Here

TOP

Related Classes of com.google.greaze.rest.client.fixtures.HttpUrlConnectionMock

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.