本文整理匯總了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.
}
}
示例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();
}
示例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
}
}
示例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
}
}
示例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();
}