|
|
Author: elecharny
Date: Tue Jun 13 16:54:30 2006
New Revision: 414007
URL: http://svn.apache.org/viewvc?rev=414007&view=rev
Log:
- Added tests for bad hexString values
- Added tests for quoted values
Modified:
directory/branches/shared/optimization/ldap/src/test/java/org/apache/directory/shared/ldap/name/LdapDNTest.java
Modified:
directory/branches/shared/optimization/ldap/src/test/java/org/apache/directory/shared/ldap/name/LdapDNTest.java
URL:
http://svn.apache.org/viewvc/directory/branches/shared/optimization/ldap/src/test/java/org/apache/directory/shared/ldap/name/LdapDNTest.java?rev=414007&r1=414006&r2=414007&view=diff
==============================================================================
---
directory/branches/shared/optimization/ldap/src/test/java/org/apache/directory/shared/ldap/name/LdapDNTest.java
(original)
+++
directory/branches/shared/optimization/ldap/src/test/java/org/apache/directory/shared/ldap/name/LdapDNTest.java
Tue Jun 13 16:54:30 2006
@@ -218,15 +218,56 @@
Assert.assertEquals( "a = #0010A0AAFF", dn.getUpName() );
}
+ /**
+ * test a simple DN with a wrong hexString attribute value : a =
#0010Z0AAFF
+ */
+ public void testLdapDNWrongHexStringAttributeValue() throws
InvalidNameException
+ {
+ try
+ {
+ new LdapDN( "a = #0010Z0AAFF" );
+ fail();
+ }
+ catch ( InvalidNameException ine )
+ {
+ Assert.assertTrue( true );
+ }
+ }
+
+ /**
+ * test a simple DN with a wrong hexString attribute value : a = #AABBCCDD3
+ */
+ public void testLdapDNWrongHexStringAttributeValue2() throws
InvalidNameException
+ {
+ try
+ {
+ new LdapDN( "a = #AABBCCDD3" );
+ fail();
+ }
+ catch ( InvalidNameException ine )
+ {
+ Assert.assertTrue( true );
+ }
+ }
+
+ /**
+ * test a simple DN with a quote in attribute value : a = quoted \"value\"
+ */
+ public void testLdapDNQuoteInAttributeValue() throws InvalidNameException
+ {
+ LdapDN dn = new LdapDN( "a = quoted \\\"value\\\"" );
+ Assert.assertEquals( "a=quoted \\\"value\\\"", dn.toString() );
+ Assert.assertEquals( "a = quoted \\\"value\\\"", dn.getUpName() );
+ }
/**
- * test a simple DN with quoted attribute value : a = "quoted \"value"
+ * test a simple DN with quoted attribute value : a = \" quoted value \"
*/
public void testLdapDNQuotedAttributeValue() throws InvalidNameException
{
- LdapDN dn = new LdapDN( "a = quoted \\\"value" );
- Assert.assertEquals( "a=quoted \\\"value", dn.toString() );
- Assert.assertEquals( "a = quoted \\\"value", dn.getUpName() );
+ LdapDN dn = new LdapDN( "a = \\\" quoted value \\\"" );
+ Assert.assertEquals( "a=\\\" quoted value \\\"", dn.toString() );
+ Assert.assertEquals( "a = \\\" quoted value \\\"", dn.getUpName() );
}
|
|