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

TestNormalizedString

public class TestNormalizedString extends TestCase
Test validation of encoding.NormalizedString

Fields Summary
Constructors Summary
public TestNormalizedString(String name)

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

        NormalizedString oNormalizedString = null;
        try {
            oNormalizedString = new NormalizedString(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.", oNormalizedString);
    
private voidrunPassTest(java.lang.String value)
Run a successful test. value should be valid.

        NormalizedString oNormalizedString = null;
        try {
            oNormalizedString = new NormalizedString(value);
        }
        catch (Exception e) { // catch the validation exception
        }
        assertEquals("normalized string not equal" +
                value, oNormalizedString.toString(), value);
    
public voidtestNsCarriageReturn()
Test that "this has \r carriage return" fails.

        runFailTest("this has \r carriage return");
    
public voidtestNsDoubleSpace()

        runPassTest("a   B"); // note: \r fails
    
public voidtestNsLineFeed()
Test that "this has \n line feed" fails.

        runFailTest("this has \n line feed");
    
public voidtestNsSimpleString()
Test that "a simple string" succeeds.

        runPassTest("a simple string");
    
public voidtestNsStringWithLeadingAndTrailingSpaces()

        runPassTest("          centered          ");
    
public voidtestNsStringWithLeadingSpaces()
differentiate from xsd:token

        runPassTest("  a failure case");
    
public voidtestNsStringWithTabs()
Test that "this has \t a tab" fails.

        runFailTest("this has \t a tab");
    
public voidtestNsStringWithTrailingSpaces()

        runPassTest("this is a  ");