commits@directory.apache.org
[Top] [All Lists]

svn commit: r414007 - /directory/branches/shared/optimization/ldap/src/t

Subject: svn commit: r414007 - /directory/branches/shared/optimization/ldap/src/test/java/org/apache/directory/shared/ldap/name/LdapDNTest.java
From:
Date: Tue, 13 Jun 2006 23:54:30 -0000
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() );
     }
 
 


<Prev in Thread] Current Thread [Next in Thread>
  • svn commit: r414007 - /directory/branches/shared/optimization/ldap/src/test/java/org/apache/directory/shared/ldap/name/LdapDNTest.java, elecharny <=