Package com.google.sitebricks.client

Examples of com.google.sitebricks.client.WebResponse.status()


            .clientOf(AcceptanceTest.baseUrl() + "/serviceWithGenerics")
            .transports(new TypeLiteral<List<Person>>() { })
            .over(Json.class)
            .post(personList);

    assert HttpServletResponse.SC_OK == response.status();

    List<Person> result = response.to(new TypeLiteral<List<Person>>() {}).using(Json.class);
    assert result.size() == 1;
    assert "John Smith".equals(result.get(0).getName());
  }
View Full Code Here


@Test
public class FormTest extends AbstractJettyTest {

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

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

    String url = res.getRedirectUrl();
View Full Code Here

    assertThat(url, equalTo("http://localhost:4000/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();
View Full Code Here

    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();
View Full Code Here

    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();
View Full Code Here

@Test
public class FormTest extends AbstractJettyTest {

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

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

    String url = res.getRedirectUrl();
View Full Code Here

    assertThat(url, equalTo("http://localhost:4000/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();
View Full Code Here

    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();
View Full Code Here

    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();
View Full Code Here

@Test
public class FormTest extends AbstractJettyTest {

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

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

    String url = res.getRedirectUrl();
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.