Package org.apache.myfaces.trinidad.validator

Examples of org.apache.myfaces.trinidad.validator.RegExpValidator.validate()


    UIComponent component = (UIComponent) mock.proxy();

    try
    {
      RegExpValidator validator = new RegExpValidator();
      validator.validate(facesContext, component, "someValue");
      // test fails if it is here

      fail("Expected Null pointer exception");
    }
    catch (NullPointerException npe)
View Full Code Here


    Mock mock = mock(UIComponent.class);
    UIComponent component = (UIComponent) mock.proxy();

    RegExpValidator validator = new RegExpValidator();
    validator.setPattern("[1-9]|[1-9][0-9]|[1-9][0-9][0-9]");
    validator.validate(facesContext, component, "15");

    mock.verify();
  }

  /**
 
View Full Code Here

    try
    {
      RegExpValidator validator = new RegExpValidator();
      String value = "999999";
      validator.setPattern("");
      validator.validate(facesContext, component, value);
      fail("Expected ValidatorException");
    }
    catch (ValidatorException ve)
    {
      // if exception then fine.
View Full Code Here

    validator.setMessageDetailNoMatch("\"{0}\" in \"{1}\" failed!! {4}");
    //some very basic sanity test

    try
    {
      validator.validate(facesContext, component, "9123456");
    }
    catch (ValidatorException ve)
    {
      String msg = ve.getFacesMessage().getDetail();
      assertEquals(msg, "\"four\" in \"label\" failed!! [0-9]*");
 
View Full Code Here

    UIComponent component = (UIComponent) mock.proxy();

    try
    {
      RegExpValidator validator = new RegExpValidator();
      validator.validate(facesContext, component, "someValue");
      // test fails if it is here

      fail("Expected Null pointer exception");
    }
    catch (NullPointerException npe)
View Full Code Here

    try
    {
      RegExpValidator validator = new RegExpValidator();
      String value = "999999";
      validator.setPattern("");
      validator.validate(facesContext, component, value);
      fail("Expected ValidatorException");
    }
    catch (ValidatorException ve)
    {
      // if exception then fine.
View Full Code Here

    validator.setMessageDetailNoMatch("\"{0}\" in \"{1}\" failed!! {4}");
    //some very basic sanity test

    try
    {
      validator.validate(facesContext, component, "9123456");
    }
    catch (ValidatorException ve)
    {
      String msg = ve.getFacesMessage().getDetail();
      assertEquals(msg, "\"four\" in \"label\" failed!! [0-9]*");
 
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.