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

TestUnsignedByte

public class TestUnsignedByte extends TestCase
Test validation of types.UnsignedByte

Fields Summary
Constructors Summary
public TestUnsignedByte(String name)

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

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

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

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

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