Package br.com.objectos.way.ui.form

Examples of br.com.objectos.way.ui.form.FormResponse


*/
@Test
public class FormResponseBuilderTest {

  public void default_response() {
    FormResponse res = new FormResponseBuilder()
        .get();

    assertThat(res.isValid(), equalTo(true));

    List<Error> errors = res.getErrors();
    assertThat(errors.size(), equalTo(0));

    assertThat(res.getRedirectUrl(), nullValue());
  }
View Full Code Here


    assertThat(res.getRedirectUrl(), nullValue());
  }

  public void invalid_response() {
    FormResponse res = new FormResponseBuilder()

        .addMessage("a").toField("f")

        .get();

    assertThat(res.isValid(), equalTo(false));

    List<Error> errors = res.getErrors();
    assertThat(errors.size(), equalTo(1));

    Error e0 = errors.get(0);
    assertThat(e0.getName(), equalTo("f"));
    assertThat(e0.getMessage(), equalTo("a"));

    assertThat(res.getRedirectUrl(), nullValue());
  }
View Full Code Here

    assertThat(res.getRedirectUrl(), nullValue());
  }

  public void redirect_url() {
    FormResponse res = new FormResponseBuilder()

        .redirectTo("http://localhost/whatever")

        .get();

    assertThat(res.getRedirectUrl(), equalTo("http://localhost/whatever"));
  }
View Full Code Here

    assertThat(res.getRedirectUrl(), equalTo("http://localhost/whatever"));
  }

  public void form_message() {
    FormResponse res = new FormResponseBuilder()

        .addMessage("a").toForm()

        .get();

    assertThat(res.isValid(), equalTo(false));

    List<Error> errors = res.getErrors();
    assertThat(errors.size(), equalTo(1));

    Error e0 = errors.get(0);
    assertThat(e0.getName(), nullValue());
    assertThat(e0.getMessage(), equalTo("a"));
View Full Code Here

    assertThat(e0.getName(), nullValue());
    assertThat(e0.getMessage(), equalTo("a"));
  }

  public void form_message_template() {
    FormResponse res = new FormResponseBuilder()

        .addMessage("%s:%d", "a", Integer.valueOf(1)).toField("f")

        .get();

    assertThat(res.isValid(), equalTo(false));

    List<Error> errors = res.getErrors();
    assertThat(errors.size(), equalTo(1));

    Error e0 = errors.get(0);
    assertThat(e0.getName(), equalTo("f"));
    assertThat(e0.getMessage(), equalTo("a:1"));
View Full Code Here

TOP

Related Classes of br.com.objectos.way.ui.form.FormResponse

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.