Index: modules/jndi/src/test/java/org/apache/harmony/jndi/tests/javax/naming/ldap/LdapNameTest.java =================================================================== --- modules/jndi/src/test/java/org/apache/harmony/jndi/tests/javax/naming/ldap/LdapNameTest.java (revision 548599) +++ modules/jndi/src/test/java/org/apache/harmony/jndi/tests/javax/naming/ldap/LdapNameTest.java (working copy) @@ -28,11 +28,14 @@ import java.util.Iterator; import java.util.LinkedList; import java.util.List; + import javax.naming.InvalidNameException; +import javax.naming.directory.BasicAttributes; import javax.naming.ldap.LdapName; import javax.naming.ldap.Rdn; import junit.framework.TestCase; + import org.apache.harmony.testframework.serialization.SerializationTest; /** @@ -280,6 +283,21 @@ *
* Test method for 'javax.naming.ldap.LdapName(String)' *
+ */ + public void testLdapNameString002() throws Exception { + String str = "t=\\20\\ te\\ s\\20t\\20\\20 + t2 = test1\\20\\ "; + LdapName ln = new LdapName(str); + assertEquals(ln.toString(), str); + ln.get(0); + assertEquals(ln.toString(), str); + ln.add("t=test"); + assertEquals(ln.toString(), "t=test,t=\\ \\ te s t\\ +t2=test1\\ \\ "); + } + + /** + *+ * Test method for 'javax.naming.ldap.LdapName(String)' + *
** Here we are testing the constructor method, this method should recive a * non-null String, this string must be a valid string like @@ -760,6 +778,35 @@ /** *
+ * Test method for 'javax.naming.ldap.LdapName.LdapName(List
+ * Here we are testing the constructor method of LdapName reciving a list of + * valid names. + *
+ *+ * The expected result is an instance of an object of LdapName, and also + * that the indexing is made like the other way around. + *
+ */ + public void testLdapNameListOfRdn006() throws Exception { + try { + BasicAttributes bas = new BasicAttributes(); + bas.put("test2", "test2"); + bas.put("test1", "test1"); + bas.put("test3", "test3"); + Rdn rdn1 = new Rdn(bas); + LinkedList* Test method for 'javax.naming.ldap.LdapName.hashCode()' *
*@@ -1030,7 +1077,7 @@ *
*/ public void testToString004() throws Exception { - LdapName ln = new LdapName("t=\\4c\\4c"); + LdapName ln = new LdapName("t=ll"); assertEquals("T=LL", ln.toString().toUpperCase()); } Index: modules/jndi/src/main/java/javax/naming/ldap/LdapName.java =================================================================== --- modules/jndi/src/main/java/javax/naming/ldap/LdapName.java (revision 548599) +++ modules/jndi/src/main/java/javax/naming/ldap/LdapName.java (working copy) @@ -42,6 +42,8 @@ private static final long serialVersionUID = -1595520034788997356L; private transient List