directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lucasthei...@apache.org
Subject svn commit: r1655751 - /directory/shared/trunk/ldap/client/api/src/test/java/org/apache/directory/ldap/client/api/search/FilterBuilderTest.java
Date Thu, 29 Jan 2015 17:12:50 GMT
Author: lucastheisen
Date: Thu Jan 29 17:12:50 2015
New Revision: 1655751

URL: http://svn.apache.org/r1655751
Log:
added an additional custom() test

Modified:
    directory/shared/trunk/ldap/client/api/src/test/java/org/apache/directory/ldap/client/api/search/FilterBuilderTest.java

Modified: directory/shared/trunk/ldap/client/api/src/test/java/org/apache/directory/ldap/client/api/search/FilterBuilderTest.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/client/api/src/test/java/org/apache/directory/ldap/client/api/search/FilterBuilderTest.java?rev=1655751&r1=1655750&r2=1655751&view=diff
==============================================================================
--- directory/shared/trunk/ldap/client/api/src/test/java/org/apache/directory/ldap/client/api/search/FilterBuilderTest.java
(original)
+++ directory/shared/trunk/ldap/client/api/src/test/java/org/apache/directory/ldap/client/api/search/FilterBuilderTest.java
Thu Jan 29 17:12:50 2015
@@ -31,6 +31,7 @@ import static org.apache.directory.ldap.
 import static org.apache.directory.ldap.client.api.search.FilterBuilder.startsWith;
 import static org.apache.directory.ldap.client.api.search.FilterBuilder.substring;
 import static org.apache.directory.ldap.client.api.search.FilterBuilderTest.EverythingFilter.everything;
+import static org.apache.directory.ldap.client.api.search.FilterBuilderTest.MuppetFilter.muppet;
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.fail;
 
@@ -144,6 +145,8 @@ public class FilterBuilderTest
     public void testCustom()
     {
         assertEquals( "(objectClass=*)", custom( everything() ).toString() );
+        assertEquals( "(&(objectClass=inetOrgPerson)(departmentNumber=muppets))", 
+                custom( muppet() ).toString() );
     }
     
     
@@ -180,4 +183,34 @@ public class FilterBuilderTest
             return new StringBuilder( "(objectClass=*)" );
         }
     }
+    
+    
+    public static class MuppetFilter implements Filter
+    {
+        private static final String filter = and(
+                equal( "objectClass", "inetOrgPerson" ),
+                equal( "departmentNumber", "muppets" ) ).toString();
+
+        private MuppetFilter()
+        {
+        }
+
+
+        public static Filter muppet()
+        {
+            return new MuppetFilter();
+        }
+
+
+        public StringBuilder build()
+        {
+            return build( new StringBuilder() );
+        }
+
+
+        public StringBuilder build( StringBuilder builder )
+        {
+            return builder.append( filter );
+        }
+    }
 }



Mime
View raw message