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

TestUnsignedInt

public class TestUnsignedInt extends TestCase
Test validation of types.UnsignedInt

Fields Summary
Constructors Summary
public TestUnsignedInt(String name)

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

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

        UnsignedInt oUnsignedInt = null;
        try {
            oUnsignedInt = new UnsignedInt(value);
        }
        catch (Exception e) { // catch the validation exception
        }
        assertEquals("unsigned int not equal" +
                String.valueOf(value), oUnsignedInt.toString(), String.valueOf(value));
    
public voidtestMaxInclusive()
Test that a number at MaxInclusive succeeds

       runPassTest(4294967295L);
    
public voidtestMaxOver()
Test that a number over MaxInclusive fails

       runFailTest(4294967296L);
    
public voidtestMinExclusive()
Test that a number at MinInclusive succeeds

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

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

        runPassTest(100);