當前位置: 首頁>>代碼示例>>Java>>正文


Java Validator.validate方法代碼示例

本文整理匯總了Java中javax.faces.validator.Validator.validate方法的典型用法代碼示例。如果您正苦於以下問題:Java Validator.validate方法的具體用法?Java Validator.validate怎麽用?Java Validator.validate使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在javax.faces.validator.Validator的用法示例。


在下文中一共展示了Validator.validate方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: doTestIsNotString

import javax.faces.validator.Validator; //導入方法依賴的package包/類
public void doTestIsNotString(Validator validator)
{
  Mock mock = mock(UIComponent.class);
  UIComponent component = (UIComponent) mock.proxy();
  mock.stubs().method("getId").will(returnValue("test"));
  try
  {
    validator.validate(facesContext, component, new Integer(1));
    // if exception is not thrown - mark it as an failure
    fail("Expected Validator Exception");
  }
  catch (IllegalArgumentException iae)
  {
    // if exception then fine.
  }
}
 
開發者ID:apache,項目名稱:myfaces-trinidad,代碼行數:17,代碼來源:ValidatorTestCase.java

示例2: doTestNull

import javax.faces.validator.Validator; //導入方法依賴的package包/類
/**
 * Tests that null returns immediately.
 *
 * @throws ValidatorException  when test fails
 */
protected void doTestNull(
  MockFacesContext context,
  MockUIComponentWrapper wrapper,
  Validator validator
  ) throws ValidatorException
{
  validator.validate(context, wrapper.getUIComponent(), null);

  wrapper.getMock().verify();
}
 
開發者ID:apache,項目名稱:myfaces-trinidad,代碼行數:16,代碼來源:ValidatorTestCase.java

示例3: doTestNullContext

import javax.faces.validator.Validator; //導入方法依賴的package包/類
/**
 * if contex or component = null then should throw NullPointerException
 */
protected void doTestNullContext(
  MockUIComponentWrapper wrapper,
  Validator validator) throws NullPointerException
{
  try
  {
    validator.validate(null, wrapper.getUIComponent(), "dummy");
    fail("Expected NullpointerException - if context or component is null");
  }
  catch (NullPointerException npe)
  {
    // this is expected
  }
}
 
開發者ID:apache,項目名稱:myfaces-trinidad,代碼行數:18,代碼來源:ValidatorTestCase.java

示例4: doTestNullComponent

import javax.faces.validator.Validator; //導入方法依賴的package包/類
/**
 * if contex or component = null then should throw NullPointerException
 */
protected void doTestNullComponent(MockFacesContext context,
  Validator validator ) throws NullPointerException
{
  try
  {
    validator.validate(context, null, "dummy");
    fail("Expected NullpointerException - if context or component is null");
  }
  catch (NullPointerException npe)
  {
    // this is expected
  }
}
 
開發者ID:apache,項目名稱:myfaces-trinidad,代碼行數:17,代碼來源:ValidatorTestCase.java

示例5: doTestValidate

import javax.faces.validator.Validator; //導入方法依賴的package包/類
/**
 * Test the validate action on validators.
 * @param validator validator on which validate action is to be tested
 * @param context MockFaces context
 * @param component MockFaces component
 * @throws javax.faces.validator.ValidatorException
 */
protected void doTestValidate(
  Validator validator,
  MockFacesContext context,
  MockUIComponentWrapper wrapper,
  Object value
  )  throws ValidatorException
{
  validator.validate(context, wrapper.getUIComponent(), value );
  wrapper.getMock().verify();
}
 
開發者ID:apache,項目名稱:myfaces-trinidad,代碼行數:18,代碼來源:ValidatorTestCase.java


注:本文中的javax.faces.validator.Validator.validate方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。