FileDocCategorySizeDatePackage
TestNonNegativeInteger.javaAPI DocApache Axis 1.42558Sat Apr 22 18:57:28 BST 2006test.types

TestNonNegativeInteger

public class TestNonNegativeInteger extends TestCase
Test validation of types.NonNegativeInteger

Fields Summary
Constructors Summary
public TestNonNegativeInteger(String name)

        super(name);
    
Methods Summary
private voidrunFailTest(java.lang.String value)
Run a failure test. value should be invalid.

        NonNegativeInteger oNonNegativeInteger = null;
        try {
            oNonNegativeInteger = new NonNegativeInteger(value);
        }
        catch (Exception e) { // catch the validation exception
        }
        // object is not iNstantiated on bad data value
        assertNull("validation restriction failed [" +
                value + "]. did not restrict bad value.", oNonNegativeInteger);
    
private voidrunPassTest(java.lang.String value)
Run a successful test. value should be valid.

        NonNegativeInteger oNonNegativeInteger = null;
        try {
            oNonNegativeInteger = new NonNegativeInteger(value);
        }
        catch (Exception e) { // catch the validation exception
        }
        assertEquals("unsigned int not equal" +
                value, oNonNegativeInteger.toString(), value);
    
public voidtestBelowMinExclusive()
Test that a number below MinInclusive fails

       runFailTest("-1");
    
public voidtestMinExclusive()
Test that a number at MinInclusive succeeds

       runPassTest("0");
    
public voidtestNegativeValue()
Test that a negative number fails

        runFailTest("-123");
    
public voidtestPositiveValue()
Test that a positive value succeeeds

        runPassTest("12345678901234567890");