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

Examples of br.com.objectos.way.ui.form.FormResponseBuilder$NoopMessageBuilder


  public Reply<?> onError(List<Exception> exceptions) {
    return onErrorBuilder(exceptions).reply();
  }

  public Reply<?> onSuccess(T pojo) {
    return new FormResponseBuilder()
        .reply();
  }
View Full Code Here


    return new FormResponseBuilder()
        .reply();
  }

  public Reply<?> onSuccess(T pojo, String url) {
    return new FormResponseBuilder()
        .redirectTo(url)
        .reply();
  }
View Full Code Here

        .redirectTo(url)
        .reply();
  }

  private FormResponseBuilder onErrorBuilder(List<Exception> exceptions) {
    FormResponseBuilder builder = new FormResponseBuilder();

    for (Exception exception : exceptions) {
      String message = exception.getMessage();
      builder.addMessage(message);
    }

    return builder;
  }
View Full Code Here

*/
@Test
public class FormResponseBuilderTest {

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

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

    List<Error> errors = res.getErrors();
View Full Code Here

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

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

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

        .get();
View Full Code Here

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

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

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

        .get();
View Full Code Here

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

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

        .addMessage("a").toForm()

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

TOP

Related Classes of br.com.objectos.way.ui.form.FormResponseBuilder$NoopMessageBuilder

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.