org.apache.myfaces.trinidad.validator
Class ValidatorTestCase

java.lang.Object
  extended by junit.framework.Assert
      extended by junit.framework.TestCase
          extended by org.jmock.core.VerifyingTestCase
              extended by org.jmock.core.MockObjectSupportTestCase
                  extended by org.jmock.MockObjectTestCase
                      extended by org.jmock.cglib.MockObjectTestCase
                          extended by org.apache.shale.test.jmock.AbstractJmockJsfTestCase
                              extended by org.apache.myfaces.trinidadbuild.test.AbstractBaseTestCase
                                  extended by org.apache.myfaces.trinidad.validator.ValidatorTestCase
All Implemented Interfaces:
junit.framework.Test
Direct Known Subclasses:
ByteLengthValidatorTest, DateRestrictionValidatorTest, DateTimeRangeValidatorTest, DoubleRangeValidatorTest, LengthValidatorTest, LongRangeValidatorTest, RegExpValidatorTest

public abstract class ValidatorTestCase
extends AbstractBaseTestCase

Base class for unit tests for Validators


Field Summary
 
Fields inherited from class org.apache.shale.test.jmock.AbstractJmockJsfTestCase
application, config, externalContext, facesContext, facesContextFactory, lifecycle, lifecycleFactory, renderKit, request, response, servletContext, session
 
Fields inherited from class org.jmock.core.MockObjectSupportTestCase
ANYTHING, NOT_NULL, NULL
 
Constructor Summary
ValidatorTestCase(String testName)
           
 
Method Summary
protected  void doTestEquals(javax.faces.validator.Validator thisValidator, javax.faces.validator.Validator otherValidator, boolean isEqual)
          Test for equality or mismatch of Validators
 void doTestIsNotString(javax.faces.validator.Validator validator)
           
protected  void doTestNull(org.apache.shale.test.mock.MockFacesContext context, MockUIComponentWrapper wrapper, javax.faces.validator.Validator validator)
          Tests that null returns immediately.
protected  void doTestNullComponent(org.apache.shale.test.mock.MockFacesContext context, javax.faces.validator.Validator validator)
          if contex or component = null then should throw NullPointerException
protected  void doTestNullContext(MockUIComponentWrapper wrapper, javax.faces.validator.Validator validator)
          if contex or component = null then should throw NullPointerException
protected  void doTestStateHolderSaveRestore(javax.faces.validator.Validator thisValidator, javax.faces.validator.Validator otherValidator, org.apache.shale.test.mock.MockFacesContext context, MockUIComponentWrapper wrapper)
          Test to check for Validators which implements the StateHolder interface
protected  void doTestValidate(javax.faces.validator.Validator validator, org.apache.shale.test.mock.MockFacesContext context, MockUIComponentWrapper wrapper, Object value)
          Test the validate action on validators.
protected  void setMockLabelForComponent(MockUIComponentWrapper wrapper)
           
 
Methods inherited from class org.apache.myfaces.trinidadbuild.test.AbstractBaseTestCase
buildMockUIComponent, buildMockUIComponent, buildMockUIComponent, setFacesContext, setUp, tearDown
 
Methods inherited from class org.jmock.cglib.MockObjectTestCase
mock, mock, newCoreMock, newCoreMock
 
Methods inherited from class org.jmock.MockObjectTestCase
atLeastOnce, atMostOnce, defaultMockNameForType, doAll, doAll, doAll, doAll, exactly, mock, mock, never, never, newDummy, newDummy, newDummy, once, onConsecutiveCalls, onConsecutiveCalls, onConsecutiveCalls, onConsecutiveCalls, returnIterator, returnIterator, returnValue, returnValue, returnValue, returnValue, returnValue, returnValue, returnValue, returnValue, returnValue, throwException
 
Methods inherited from class org.jmock.core.MockObjectSupportTestCase
and, arrayContaining, arrayContaining, arrayContaining, arrayContaining, arrayContaining, arrayContaining, arrayContaining, arrayContaining, arrayContaining, arrayContaining, assertThat, assertThat, assertThat, assertThat, assertThat, assertThat, assertThat, assertThat, assertThat, collectionContaining, collectionContaining, compatibleType, contains, endsWith, eq, eq, eq, eq, eq, eq, eq, eq, eq, eq, hasProperty, hasProperty, isA, isIn, isIn, mapContaining, mapContaining, mapWithKey, mapWithKey, mapWithValue, mapWithValue, not, or, same, startsWith, stringContains, toString
 
Methods inherited from class org.jmock.core.VerifyingTestCase
registerToVerify, runBare, unregisterToVerify, verify
 
Methods inherited from class junit.framework.TestCase
countTestCases, createResult, getName, run, run, runTest, setName, toString
 
Methods inherited from class junit.framework.Assert
assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertFalse, assertFalse, assertNotNull, assertNotNull, assertNotSame, assertNotSame, assertNull, assertNull, assertSame, assertSame, assertTrue, assertTrue, fail, fail, failNotEquals, failNotSame, failSame, format
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ValidatorTestCase

public ValidatorTestCase(String testName)
Method Detail

setMockLabelForComponent

protected void setMockLabelForComponent(MockUIComponentWrapper wrapper)

doTestNull

protected void doTestNull(org.apache.shale.test.mock.MockFacesContext context,
                          MockUIComponentWrapper wrapper,
                          javax.faces.validator.Validator validator)
                   throws javax.faces.validator.ValidatorException
Tests that null returns immediately.

Throws:
javax.faces.validator.ValidatorException - when test fails

doTestNullContext

protected void doTestNullContext(MockUIComponentWrapper wrapper,
                                 javax.faces.validator.Validator validator)
                          throws NullPointerException
if contex or component = null then should throw NullPointerException

Throws:
NullPointerException

doTestNullComponent

protected void doTestNullComponent(org.apache.shale.test.mock.MockFacesContext context,
                                   javax.faces.validator.Validator validator)
                            throws NullPointerException
if contex or component = null then should throw NullPointerException

Throws:
NullPointerException

doTestValidate

protected void doTestValidate(javax.faces.validator.Validator validator,
                              org.apache.shale.test.mock.MockFacesContext context,
                              MockUIComponentWrapper wrapper,
                              Object value)
                       throws javax.faces.validator.ValidatorException
Test the validate action on validators.

Parameters:
validator - validator on which validate action is to be tested
context - MockFaces context
component - MockFaces component
Throws:
javax.faces.validator.ValidatorException

doTestEquals

protected void doTestEquals(javax.faces.validator.Validator thisValidator,
                            javax.faces.validator.Validator otherValidator,
                            boolean isEqual)
Test for equality or mismatch of Validators

Parameters:
thisValidator -
otherValidator -
isEqual - - Identifies whether the comparison for equality of validators or mismatch of valiadtors

doTestStateHolderSaveRestore

protected void doTestStateHolderSaveRestore(javax.faces.validator.Validator thisValidator,
                                            javax.faces.validator.Validator otherValidator,
                                            org.apache.shale.test.mock.MockFacesContext context,
                                            MockUIComponentWrapper wrapper)
Test to check for Validators which implements the StateHolder interface

Parameters:
thisValidator - Source validator
otherValidator - The validator in which the state will be restored to
context - MockFaces context
component - MockFaces Component

doTestIsNotString

public void doTestIsNotString(javax.faces.validator.Validator validator)


Copyright © 2001-2012 The Apache Software Foundation. All Rights Reserved.