FileDocCategorySizeDatePackage
TestUnsignedLong.javaAPI DocApache Axis 1.42933Sat Apr 22 18:57:26 BST 2006test.types

TestUnsignedLong

public class TestUnsignedLong extends TestCase
Test validation of types.UnsignedLong

Fields Summary
Constructors Summary
public TestUnsignedLong(String name)

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

        UnsignedLong oUnsignedLong = null;
        try {
            oUnsignedLong = new UnsignedLong(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.",
                oUnsignedLong);
    
private voidrunPassTest(java.math.BigInteger value, java.lang.String strValue)
Run a successful test. value should be valid. String should come out as expected.

        UnsignedLong oUnsignedLong = null;
        try {
            oUnsignedLong = new UnsignedLong(value);
        } catch (Exception e) { // catch the validation exception
            // error!
            assertTrue("validation error thrown and it shouldn't be", false);
        }
        assertEquals("unsigned long not equal: " +
                String.valueOf(value), strValue, oUnsignedLong.toString());
    
public voidtestMaxInclusive()
Test Max unsigned long

        runPassTest(new BigInteger("18446744073709551615"),
                "18446744073709551615");
    
public voidtestMinExclusive()
Test that a number at MinInclusive succeeds

        runPassTest(BigInteger.ZERO, "0");
    
public voidtestNegativeValue()
Test that a negative number fails

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

        runPassTest(new BigInteger("100"), "100");
    
public voidtestTooLarge()

        runFailTest(new BigInteger("184467440737095516152"));