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

TestUnsignedShort

public class TestUnsignedShort extends TestCase
Test validation of types.UnsignedShort

Fields Summary
Constructors Summary
public TestUnsignedShort(String name)

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

        UnsignedShort oUnsignedShort = null;
        try {
            oUnsignedShort = new UnsignedShort(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.", oUnsignedShort);
    
private voidrunPassTest(long value)
Run a successful test. value should be valid.

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

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

      runFailTest(65536);
    
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);