Methods Summary |
---|
public void | attemptInvalidName(java.lang.String name)
try
{
final DottedName dottedName = new DottedName( name );
fail( "expected dotted name to fail: \"" + name + "\"");
}
catch( Exception e )
{
// good, we expected to get here
}
|
public void | testBadSyntax()
attemptInvalidName( "." );
attemptInvalidName( ".." );
attemptInvalidName( "..." );
attemptInvalidName( ".x.." );
attemptInvalidName( "x.x.x." );
|
public void | testDomainAndScopeOnly()
new DottedName( "mydomain:domain" );
|
public void | testDomainOnly()
attemptInvalidName( "mydomain:" );
|
public void | testEmptyName()
attemptInvalidName( "" );
|
public void | testEscapedDot()
final String name = "test" + BACKSLASH + ".1.part" + BACKSLASH + ".1";
final DottedName dn = new DottedName( name );
assertEquals( "test.1", dn.getScope() );
assertEquals( "part.1", dn.getParts().get( 0 ) );
|
public void | testEscapedEscapeChar()
try
{
DottedName dn = new DottedName( "test" + BACKSLASH + "Name" );
assert( false );
}
catch( IllegalArgumentException e )
{
// good
}
final DottedName dn = new DottedName( "test" + BACKSLASH + BACKSLASH + "Name" );
assertEquals( "test" + BACKSLASH + BACKSLASH + "Name", dn.toString() );
|
public void | testEscapedName()
final DottedName dn = new DottedName( "domain.server\\.1.port" );
assertEquals( dn.getScope(), "domain" );
assertEquals( dn.getParts().get( 0 ), "server.1" );
assertEquals( dn.getParts().get( 1 ), "port" );
|
public void | testIllegalChars()
for( int i = 0; i < ILLEGAL_CHARS.length(); ++i )
{
final char theChar = ILLEGAL_CHARS.charAt( i );
attemptInvalidName( "" + theChar );
attemptInvalidName( "domain." + theChar + "y" );
}
|
public void | testLegalChars()
for( int i = 0; i < LEGAL_CHARS.length(); ++i )
{
final char theChar = LEGAL_CHARS.charAt( i );
final String escapedChar = DottedName.escapePart( "" + theChar );
new DottedName( "domain." + escapedChar );
}
|
public void | testLongName()
final DottedName dn = new DottedName( "mydomain:scope.b.c.d.e.f.g.h.i.j.k.l.m.n.o.p" );
assertEquals( dn.getDomain(), "mydomain" );
assertEquals( dn.getScope(), "scope" );
assertEquals( dn.getParts().size(), 15 );
assertEquals( dn.getParts().get( 14 ), "p" );
|
public void | testMissingValue()
attemptInvalidName( "domain." );
|
public void | testNameWithPartOfDot()
new DottedName( "domain." + DottedName.escapePart( "" + '." ) );
|
public void | testScopeOnly()
new DottedName( "domain" );
|
public void | testThatToStringMatchesOrig()
final String TEST = "domain.server\\.1.port";
final DottedName dn = new DottedName( TEST );
assertEquals( dn.toString(), TEST );
|
public void | testWithDomain()
new DottedName( "mydomain:domain.locale" );
new DottedName( "mydomain:domain.a.b.c.foo" );
|