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

TestToken

public class TestToken extends TestCase
Test validation of encoding.Token

Fields Summary
Constructors Summary
public TestToken(String name)

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

        Token oToken = null;
        try {
            oToken = new Token(value);
        }
        catch (Exception e) { // catch the validation exception
        }
        assertNull(
                "Token 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.

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

        runPassTest("a carriage return\r string\r");
    
public voidtestDoubleSpace()
this is to differentiate from normalized string which cannot accept double spaces.

        runFailTest("a   B"); // note: \r fails
    
public voidtestEmptyString()
Test an empty string

        runPassTest(""); 
    
public voidtestLineFeed()
this is to differentiate from normalized string which cannot accept a \n

        runFailTest("line one\n line two");
    
public voidtestNull()
Test an empty string

        runPassTest(null); 
    
public voidtestSimpleString()
Test a simple string.

        runPassTest("a simple string");
    
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  ");