From 9da903942b84e736cc8b1b9a08ef6f3ed09cb483 Mon Sep 17 00:00:00 2001 From: Mattias Arthursson Date: Sun, 17 Jun 2007 13:59:56 +0000 Subject: [PATCH] Added test cases for issue on forums. --- .../ldap/core/DistinguishedNameTest.java | 33 +++++++++++++++++-- 1 file changed, 31 insertions(+), 2 deletions(-) diff --git a/spring-ldap/src/test/java/org/springframework/ldap/core/DistinguishedNameTest.java b/spring-ldap/src/test/java/org/springframework/ldap/core/DistinguishedNameTest.java index 29067851..39422022 100644 --- a/spring-ldap/src/test/java/org/springframework/ldap/core/DistinguishedNameTest.java +++ b/spring-ldap/src/test/java/org/springframework/ldap/core/DistinguishedNameTest.java @@ -22,6 +22,7 @@ import javax.naming.CompositeName; import javax.naming.InvalidNameException; import javax.naming.Name; +import org.springframework.ldap.BadLdapGrammarException; import org.springframework.ldap.core.DistinguishedName; import junit.framework.TestCase; @@ -448,9 +449,37 @@ public class DistinguishedNameTest extends TestCase { } public void test_longDN() throws InvalidNameException { - DistinguishedName name = new DistinguishedName( - ""); + DistinguishedName name = new DistinguishedName(""); assertNotNull(name); } + /** + * Test case to verify correct parsing for issue on forums. + */ + public void testParseAtSign() { + DistinguishedName name = new DistinguishedName( + "cn=testname@example.com"); + assertNotNull(name); + } + + /** + * Test case to verify correct parsing for issue on forums. + */ + public void testParseAtSign2() { + DistinguishedName name = new DistinguishedName( + "cn=te\\+stname@example.com"); + assertNotNull(name); + } + + /** + * Test case to verify correct parsing for issue on forums. + */ + public void testParseInvalidPlus() { + try { + new DistinguishedName("cn=te+stname@example.com"); + fail("BadLdapGrammarException expected"); + } catch (BadLdapGrammarException expected) { + assertTrue(true); + } + } } \ No newline at end of file