Package com.google.sitebricks.client

Examples of com.google.sitebricks.client.WebResponse


    String url = res.getRedirectUrl();
    assertThat(url, endsWith("/pojo/1234"));
  }

  public void jsr303_single_validation_failed() {
    WebResponse response = post("");
    assertThat(response.status(), equalTo(HttpServletResponse.SC_OK));

    FormResponseJson res = response.to(FormResponseJson.class).using(Json.class);
    assertThat(res.isValid(), equalTo(false));

    List<FieldErrorJson> errors = res.getErrors();
    assertThat(errors.size(), equalTo(1));
View Full Code Here


    String url = res.getRedirectUrl();
    assertThat(url, is(nullValue()));
  }

  public void jsr303_multiple_validation_failed() {
    WebResponse response = post("?positive=-5");
    assertThat(response.status(), equalTo(HttpServletResponse.SC_OK));

    FormResponseJson res = response.to(FormResponseJson.class).using(Json.class);
    assertThat(res.isValid(), equalTo(false));

    List<FieldErrorJson> errors = res.getErrors();
    Collections.sort(errors);
    assertThat(errors.size(), equalTo(2));
View Full Code Here

    String url = res.getRedirectUrl();
    assertThat(url, is(nullValue()));
  }

  public void custom_validation_should_fail() {
    WebResponse response = post("?notNull=abc&positive=5&fail=true");
    assertThat(response.status(), equalTo(HttpServletResponse.SC_OK));

    FormResponseJson res = response.to(FormResponseJson.class).using(Json.class);
    assertThat(res.isValid(), equalTo(false));

    List<FieldErrorJson> errors = res.getErrors();
    assertThat(errors.size(), equalTo(1));
View Full Code Here

  }

  protected Map<String, String> login(String login, String senha) {
    String url = String.format("api/login?login=%s&senha=%s", login, senha);

    WebResponse response = webClientOf(url).post("");
    Map<String, String> headers = response.getHeaders();
    String cookie = headers.get("Set-Cookie");
    Map<String, String> cookies = ImmutableMap.of("Cookie", cookie);

    return cookies;
  }
View Full Code Here

*/
@Test(suiteName = AcceptanceTest.SUITE)
public class RestfuWebServiceWithSubpathsAcceptanceTest {

  public void shouldServiceTopLevelPath() {
    WebResponse response = createInjector()
        .getInstance(Web.class)
        .clientOf(AcceptanceTest.BASE_URL + "/superpath")
        .transports(String.class)
        .over(Json.class)
        .get();

    assert RestfulWebServiceWithSubpaths.TOPLEVEL.equals(response.toString());
  }
View Full Code Here

    assert RestfulWebServiceWithSubpaths.TOPLEVEL.equals(response.toString());
  }

  public void shouldServiceFirstSubPath() {
    WebResponse response = createInjector()
        .getInstance(Web.class)
        .clientOf(AcceptanceTest.BASE_URL + "/superpath/subpath1")
        .transports(String.class)
        .over(Json.class)
        .post("");

    assert RestfulWebServiceWithSubpaths.PATH_1.equals(response.toString()) : response.toString();
  }
View Full Code Here

    assert RestfulWebServiceWithSubpaths.PATH_1.equals(response.toString()) : response.toString();
  }

  public void shouldServiceSecondSubPath() {
    WebResponse response = createInjector()
        .getInstance(Web.class)
        .clientOf(AcceptanceTest.BASE_URL + "/superpath/subpath2")
        .transports(String.class)
        .over(Json.class)
        .post("");

    assert RestfulWebServiceWithSubpaths.PATH_2.equals(response.toString()) : response.toString();
  }
View Full Code Here

    assert RestfulWebServiceWithSubpaths.PATH_2.equals(response.toString()) : response.toString();
  }

  public void shouldServiceThirdSubPath() {
    WebResponse response = createInjector()
        .getInstance(Web.class)
        .clientOf(AcceptanceTest.BASE_URL + "/superpath/subpath3")
        .transports(String.class)
        .over(Json.class)
        .post("");

    assert RestfulWebServiceWithSubpaths.PATH_3.equals(response.toString()) : response.toString();
  }
View Full Code Here

    assert RestfulWebServiceWithSubpaths.PATH_3.equals(response.toString()) : response.toString();
  }

  public void shouldServiceVariableTwoLevelSubPath() {
    WebResponse response = createInjector()
        .getInstance(Web.class)
        .clientOf(AcceptanceTest.BASE_URL + "/superpath/subpath1/a_thing")
        .transports(String.class)
        .over(Json.class)
        .post("");

    assert "a_thing".equals(response.toString()) : response.toString();
  }
View Full Code Here

    assert "a_thing".equals(response.toString()) : response.toString();
  }

  public void shouldServiceVariableThreeLevelSubPath() {
    WebResponse response = createInjector()
        .getInstance(Web.class)
        .clientOf(AcceptanceTest.BASE_URL + "/superpath/subpath1/a_thing/another_thing")
        .transports(String.class)
        .over(Json.class)
        .post("");

    assert "a_thing_another_thing".equals(response.toString()) : response.toString();
  }
View Full Code Here

TOP

Related Classes of com.google.sitebricks.client.WebResponse

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.