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

TestNMToken

public class TestNMToken extends TestCase
Test validation of types.NMToken

Fields Summary
Constructors Summary
public TestNMToken(String name)

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

        NMToken oToken = null;
        try {
            oToken = new NMToken(value);
        }
        catch (Exception e) { // catch the validation exception
        }
        assertNull(
                "NMToken validation restriction failed. did not restrict bad value [" +
                   value + "] did not restrict bad value", oToken);
    
private voidrunPassTest(java.lang.String value)
Run a successful test. value should be valid.

        NMToken oToken = null;
        try {
            oToken = new NMToken(value);
        }
        catch (Exception e) { // catch the validation exception
        }
        assertEquals("NMToken strings not equal. orig value:" + value, oToken.toString(), value);
    
public voidtestDoubleSpace()
this is to differentiate from normalized string which cannot accept double spaces.

        runFailTest("a   B"); // note: \r fails
    
public voidtestLineFeed()
this is to differentiate from normalized string which cannot accept a \n

        runFailTest("line one\n line two");
    
public voidtestPunctuationString()
Test a simple string.

        runPassTest("Atlanta.-_:");
    
public voidtestSimpleString()
Test a simple string.

        runPassTest("Atlanta1234567890");
    
public voidtestStringWithLeadingAndTrailingSpaces()
this is to differentiate from normalized string which cannot accept leading and trailing spaces.

        runFailTest("          centered          ");
    
public voidtestStringWithLeadingSpaces()
this is to differentiate from normalized string which cannot accept leading spaces.

        runFailTest("  a failure case");
    
public voidtestStringWithTabs()
this is to differentiate from normalized string which cannot accept a \t

        runFailTest("this has \t a tab");
    
public voidtestStringWithTrailingSpaces()
this is to differentiate from normalized string which cannot accept trailing spaces.

        runFailTest("this is a  ");