directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r753323 - /directory/shared/branches/shared-replication/ldap/src/test/java/org/apache/directory/shared/ldap/schema/
Date Fri, 13 Mar 2009 17:39:50 GMT
Author: elecharny
Date: Fri Mar 13 17:39:42 2009
New Revision: 753323

URL: http://svn.apache.org/viewvc?rev=753323&view=rev
Log:
Switched to JUnit 4.4

Modified:
    directory/shared/branches/shared-replication/ldap/src/test/java/org/apache/directory/shared/ldap/schema/ByteArrayComparatorTest.java
    directory/shared/branches/shared-replication/ldap/src/test/java/org/apache/directory/shared/ldap/schema/DeepTrimNormalizerTest.java
    directory/shared/branches/shared-replication/ldap/src/test/java/org/apache/directory/shared/ldap/schema/NumericNormalizerTest.java
    directory/shared/branches/shared-replication/ldap/src/test/java/org/apache/directory/shared/ldap/schema/SchemaUtilsTest.java
    directory/shared/branches/shared-replication/ldap/src/test/java/org/apache/directory/shared/ldap/schema/TelephoneNumberNormalizerTest.java
    directory/shared/branches/shared-replication/ldap/src/test/java/org/apache/directory/shared/ldap/schema/UsageEnumTest.java

Modified: directory/shared/branches/shared-replication/ldap/src/test/java/org/apache/directory/shared/ldap/schema/ByteArrayComparatorTest.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-replication/ldap/src/test/java/org/apache/directory/shared/ldap/schema/ByteArrayComparatorTest.java?rev=753323&r1=753322&r2=753323&view=diff
==============================================================================
--- directory/shared/branches/shared-replication/ldap/src/test/java/org/apache/directory/shared/ldap/schema/ByteArrayComparatorTest.java
(original)
+++ directory/shared/branches/shared-replication/ldap/src/test/java/org/apache/directory/shared/ldap/schema/ByteArrayComparatorTest.java
Fri Mar 13 17:39:42 2009
@@ -21,8 +21,8 @@
 
 
 import org.apache.directory.shared.ldap.schema.comparators.ByteArrayComparator;
-
-import junit.framework.TestCase;
+import org.junit.Test;
+import static org.junit.Assert.assertEquals;
 
 
 /**
@@ -31,44 +31,51 @@
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  * @version $Rev$
  */
-public class ByteArrayComparatorTest extends TestCase
+public class ByteArrayComparatorTest
 {
+    @Test
     public void testBothNull()
     {
         assertEquals( 0, ByteArrayComparator.INSTANCE.compare( null, null ) );
     }
 
     
+    @Test
     public void testB2Null()
     {
         assertEquals( 1, ByteArrayComparator.INSTANCE.compare( new byte[0], null ) );
     }
 
     
+    @Test
     public void testB1Null()
     {
         assertEquals( -1, ByteArrayComparator.INSTANCE.compare( null, new byte[0] ) );
     }
 
     
+    @Test
     public void testBothEmpty()
     {
         assertEquals( 0, ByteArrayComparator.INSTANCE.compare( new byte[0], new byte[0] )
);
     }
 
     
+    @Test
     public void testBothEqualLengthOne()
     {
         assertEquals( 0, ByteArrayComparator.INSTANCE.compare( new byte[1], new byte[1] )
);
     }
 
     
+    @Test
     public void testBothEqualLengthTen()
     {
         assertEquals( 0, ByteArrayComparator.INSTANCE.compare( new byte[10], new byte[10]
) );
     }
     
     
+    @Test
     public void testB1PrefixOfB2()
     {
         byte[] b1 = new byte[] { 0, 1, 2 };
@@ -78,6 +85,7 @@
     }
     
     
+    @Test
     public void testB2PrefixOfB1()
     {
         byte[] b1 = new byte[] { 0, 1, 2, 3 };
@@ -87,6 +95,7 @@
     }
     
     
+    @Test
     public void testB1GreaterThanB2() 
     {
         byte[] b1 = new byte[] { 0, 5 };
@@ -96,6 +105,7 @@
     }
 
 
+    @Test
     public void testB1GreaterThanB2SameLength() 
     {
         byte[] b1 = new byte[] { 0, 5 };
@@ -105,6 +115,7 @@
     }
 
 
+    @Test
     public void testB2GreaterThanB1() 
     {
         byte[] b1 = new byte[] { 0, 1, 2 };
@@ -114,6 +125,7 @@
     }
 
 
+    @Test
     public void testB2GreaterThanB1SameLength() 
     {
         byte[] b1 = new byte[] { 0, 1 };

Modified: directory/shared/branches/shared-replication/ldap/src/test/java/org/apache/directory/shared/ldap/schema/DeepTrimNormalizerTest.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-replication/ldap/src/test/java/org/apache/directory/shared/ldap/schema/DeepTrimNormalizerTest.java?rev=753323&r1=753322&r2=753323&view=diff
==============================================================================
--- directory/shared/branches/shared-replication/ldap/src/test/java/org/apache/directory/shared/ldap/schema/DeepTrimNormalizerTest.java
(original)
+++ directory/shared/branches/shared-replication/ldap/src/test/java/org/apache/directory/shared/ldap/schema/DeepTrimNormalizerTest.java
Fri Mar 13 17:39:42 2009
@@ -19,194 +19,230 @@
  */
 package org.apache.directory.shared.ldap.schema;
 
+
 import javax.naming.NamingException;
 
 import org.apache.directory.shared.ldap.schema.normalizers.DeepTrimNormalizer;
+import org.junit.Test;
 
-import junit.framework.TestCase;
+import static org.junit.Assert.assertEquals;
 
-//import org.apache.directory.shared.ldap.util.StringTools;
 
 /**
- *
  * Test the normalizer class
  *
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  */
-public class DeepTrimNormalizerTest extends TestCase
+public class DeepTrimNormalizerTest
 {
-   public void testDeepTrimNormalizerNull() throws NamingException
-   {
-       Normalizer normalizer = new DeepTrimNormalizer();
-       assertEquals( "", normalizer.normalize( (String)null ) );
-   }
-
-   public void testDeepTrimNormalizerEmpty() throws NamingException
-   {
-       Normalizer normalizer = new DeepTrimNormalizer();
-       assertEquals( "", normalizer.normalize( "" ) );
-   }
-
-   public void testDeepTrimNormalizerOneSpace() throws NamingException
-   {
-       Normalizer normalizer = new DeepTrimNormalizer();
-       assertEquals( "", normalizer.normalize( " " ) );
-   }
-
-   public void testDeepTrimNormalizerTwoSpaces() throws NamingException
-   {
-       Normalizer normalizer = new DeepTrimNormalizer();
-       assertEquals( "", normalizer.normalize( "  " ) );
-   }
-
-   public void testDeepTrimNormalizerNSpaces() throws NamingException
-   {
-       Normalizer normalizer = new DeepTrimNormalizer();
-       assertEquals( "", normalizer.normalize( "      " ) );
-   }
-
-   public void testInsignifiantSpacesStringOneChar() throws NamingException
-   {
-       Normalizer normalizer = new DeepTrimNormalizer();
-       assertEquals( "a", normalizer.normalize( "a" ) );
-   }
-
-   public void testInsignifiantSpacesStringTwoChars() throws NamingException
-   {
-       Normalizer normalizer = new DeepTrimNormalizer();
-       assertEquals( "aa", normalizer.normalize( "aa" ) );
-   }
-
-   public void testInsignifiantSpacesStringNChars() throws NamingException
-   {
-       Normalizer normalizer = new DeepTrimNormalizer();
-       assertEquals( "aaaaa", normalizer.normalize( "aaaaa" ) );
-   }
-
-   public void testInsignifiantSpacesStringOneCombining() throws NamingException
-   {
-       Normalizer normalizer = new DeepTrimNormalizer();
-       char[] chars = new char[]{ ' ', 0x0310 };
-       char[] expected = new char[]{ ' ', 0x0310 };
-       assertEquals( new String( expected ), normalizer.normalize( new String( chars ) )
);
-   }
-
-   public void testInsignifiantSpacesStringNCombining() throws NamingException
-   {
-       Normalizer normalizer = new DeepTrimNormalizer();
-       char[] chars = new char[]{ ' ', 0x0310, ' ', 0x0311, ' ', 0x0312 };
-       char[] expected = new char[]{ ' ', 0x0310, ' ', 0x0311, ' ', 0x0312 };
-       assertEquals( new String( expected ), normalizer.normalize( new String( chars ) )
);
-   }
-
-   public void testInsignifiantSpacesStringCharsSpaces() throws NamingException
-   {
-       Normalizer normalizer = new DeepTrimNormalizer();
-       assertEquals( "a", normalizer.normalize( " a" ) );
-       assertEquals( "a", normalizer.normalize( "a " ) );
-       assertEquals( "a", normalizer.normalize( " a " ) );
-       assertEquals( "a a", normalizer.normalize( "a a" ) );
-       assertEquals( "a a", normalizer.normalize( " a a" ) );
-       assertEquals( "a a", normalizer.normalize( "a a " ) );
-       assertEquals( "a a", normalizer.normalize( "a  a" ) );
-       assertEquals( "a a", normalizer.normalize( " a   a " ) );
-       assertEquals( "aaa aaa aaa", normalizer.normalize( "  aaa   aaa   aaa  " ) );
-   }
-
-   public void testNormalizeCharsCombiningSpaces() throws NamingException
-   {
-       Normalizer normalizer = new DeepTrimNormalizer();
-       char[] chars = new char[]{ ' ', 0x0310, 'a', 'a', ' ', ' ',  0x0311, ' ', ' ', 'a',
0x0311, 0x0312 };
-       char[] expected = new char[]{ ' ', 0x0310, 'a', 'a', ' ', ' ',  0x0311, ' ', 'a',
0x0311, 0x0312 };
-       assertEquals( new String( expected ), normalizer.normalize( new String( chars ) )
);
-   }
-
-   public void testNormalizeString() throws Exception
-   {
-       Normalizer normalizer = new DeepTrimNormalizer();
-       assertEquals( "abcd", normalizer.normalize( "abcd" ) );
-   }
-
-   public void testMapToSpace() throws Exception
-   {
-       Normalizer normalizer = new DeepTrimNormalizer();
-       char[] chars = new char[]{ 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0085, 0x00A0, 0x1680,
-           0x2000, 0x2001, 0x2002, 0x2003, 0x2004, 0x2005, 0x2006, 0x2007, 0x2008, 0x2009,
0x200A,
-           0x2028, 0x2029, 0x202F, 0x205F };
-       assertEquals( "", normalizer.normalize( new String( chars ) ) );
-   }
-
-   public void testNormalizeIgnore() throws Exception
-   {
-       Normalizer normalizer = new DeepTrimNormalizer();
-       char[] chars = new char[58];
-
-       int pos = 0;
-
-       for ( char c = 0x0000; c < 0x0008; c++ )
-       {
-           chars[pos++] = c;
-       }
-
-       for ( char c = 0x000E; c < 0x001F; c++ )
-       {
-           chars[pos++] = c;
-       }
-
-       for ( char c = 0x007F; c < 0x0084; c++ )
-       {
-           chars[pos++] = c;
-       }
-
-       for ( char c = 0x0086; c < 0x009F; c++ )
-       {
-           chars[pos++] = c;
-       }
-
-       chars[pos++] = 0x00AD;
-
-       assertEquals( "", normalizer.normalize( new String( chars ) ) );
-   }
-
-   /*
-   public void testSpeed() throws Exception
-   {
-       Normalizer normalizer = new DeepTrimNormalizer();
-       char[] chars = new char[]{ 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0085, 0x00A0, 0x1680,
-           0x2000, 0x2001, 0x2002, 0x2003, 0x2004, 0x2005, 0x2006, 0x2007, 0x2008, 0x2009,
0x200A,
-           0x2028, 0x2029, 0x202F, 0x205F };
-       String s = new String( chars );
-       assertEquals( "", normalizer.normalize( s ) );
-       
-       String t = "xs crvtbynU  Jikl7897790";
-       
-       Normalizer normalizer2 = new DeepTrimToLowerNormalizer();
-       
-       String s1 = (String)normalizer2.normalize( t );
-
-       long t0 = System.currentTimeMillis();
-
-       for ( int i = 0; i < 100000; i++ )
-       {
-           normalizer2.normalize( t );
-       }
-       
-       long t1 = System.currentTimeMillis();
-       
-       System.out.println( t1 - t0 );
-
-       String s2 = StringTools.deepTrimToLower( t );
-
-       t0 = System.currentTimeMillis();
-
-       for ( int i = 0; i < 100000; i++ )
-       {
-           StringTools.deepTrimToLower( t );
-       }
-       
-       t1 = System.currentTimeMillis();
-       
-       System.out.println( t1 - t0 );
-   }
-   */
+    @Test
+    public void testDeepTrimNormalizerNull() throws NamingException
+    {
+        Normalizer normalizer = new DeepTrimNormalizer();
+        assertEquals( "", normalizer.normalize( ( String ) null ) );
+    }
+
+
+    @Test
+    public void testDeepTrimNormalizerEmpty() throws NamingException
+    {
+        Normalizer normalizer = new DeepTrimNormalizer();
+        assertEquals( "", normalizer.normalize( "" ) );
+    }
+
+
+    @Test
+    public void testDeepTrimNormalizerOneSpace() throws NamingException
+    {
+        Normalizer normalizer = new DeepTrimNormalizer();
+        assertEquals( "", normalizer.normalize( " " ) );
+    }
+
+
+    @Test
+    public void testDeepTrimNormalizerTwoSpaces() throws NamingException
+    {
+        Normalizer normalizer = new DeepTrimNormalizer();
+        assertEquals( "", normalizer.normalize( "  " ) );
+    }
+
+
+    @Test
+    public void testDeepTrimNormalizerNSpaces() throws NamingException
+    {
+        Normalizer normalizer = new DeepTrimNormalizer();
+        assertEquals( "", normalizer.normalize( "      " ) );
+    }
+
+
+    @Test
+    public void testInsignifiantSpacesStringOneChar() throws NamingException
+    {
+        Normalizer normalizer = new DeepTrimNormalizer();
+        assertEquals( "a", normalizer.normalize( "a" ) );
+    }
+
+
+    @Test
+    public void testInsignifiantSpacesStringTwoChars() throws NamingException
+    {
+        Normalizer normalizer = new DeepTrimNormalizer();
+        assertEquals( "aa", normalizer.normalize( "aa" ) );
+    }
+
+
+    @Test
+    public void testInsignifiantSpacesStringNChars() throws NamingException
+    {
+        Normalizer normalizer = new DeepTrimNormalizer();
+        assertEquals( "aaaaa", normalizer.normalize( "aaaaa" ) );
+    }
+
+
+    @Test
+    public void testInsignifiantSpacesStringOneCombining() throws NamingException
+    {
+        Normalizer normalizer = new DeepTrimNormalizer();
+        char[] chars = new char[]
+            { ' ', 0x0310 };
+        char[] expected = new char[]
+            { ' ', 0x0310 };
+        assertEquals( new String( expected ), normalizer.normalize( new String( chars ) )
);
+    }
+
+
+    @Test
+    public void testInsignifiantSpacesStringNCombining() throws NamingException
+    {
+        Normalizer normalizer = new DeepTrimNormalizer();
+        char[] chars = new char[]
+            { ' ', 0x0310, ' ', 0x0311, ' ', 0x0312 };
+        char[] expected = new char[]
+            { ' ', 0x0310, ' ', 0x0311, ' ', 0x0312 };
+        assertEquals( new String( expected ), normalizer.normalize( new String( chars ) )
);
+    }
+
+
+    @Test
+    public void testInsignifiantSpacesStringCharsSpaces() throws NamingException
+    {
+        Normalizer normalizer = new DeepTrimNormalizer();
+        assertEquals( "a", normalizer.normalize( " a" ) );
+        assertEquals( "a", normalizer.normalize( "a " ) );
+        assertEquals( "a", normalizer.normalize( " a " ) );
+        assertEquals( "a a", normalizer.normalize( "a a" ) );
+        assertEquals( "a a", normalizer.normalize( " a a" ) );
+        assertEquals( "a a", normalizer.normalize( "a a " ) );
+        assertEquals( "a a", normalizer.normalize( "a  a" ) );
+        assertEquals( "a a", normalizer.normalize( " a   a " ) );
+        assertEquals( "aaa aaa aaa", normalizer.normalize( "  aaa   aaa   aaa  " ) );
+    }
+
+
+    @Test
+    public void testNormalizeCharsCombiningSpaces() throws NamingException
+    {
+        Normalizer normalizer = new DeepTrimNormalizer();
+        char[] chars = new char[]
+            { ' ', 0x0310, 'a', 'a', ' ', ' ', 0x0311, ' ', ' ', 'a', 0x0311, 0x0312 };
+        char[] expected = new char[]
+            { ' ', 0x0310, 'a', 'a', ' ', ' ', 0x0311, ' ', 'a', 0x0311, 0x0312 };
+        assertEquals( new String( expected ), normalizer.normalize( new String( chars ) )
);
+    }
+
+
+    @Test
+    public void testNormalizeString() throws Exception
+    {
+        Normalizer normalizer = new DeepTrimNormalizer();
+        assertEquals( "abcd", normalizer.normalize( "abcd" ) );
+    }
+
+
+    @Test
+    public void testMapToSpace() throws Exception
+    {
+        Normalizer normalizer = new DeepTrimNormalizer();
+        char[] chars = new char[]
+            { 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0085, 0x00A0, 0x1680, 0x2000, 0x2001, 0x2002,
0x2003, 0x2004, 0x2005,
+                0x2006, 0x2007, 0x2008, 0x2009, 0x200A, 0x2028, 0x2029, 0x202F, 0x205F };
+        assertEquals( "", normalizer.normalize( new String( chars ) ) );
+    }
+
+
+    @Test
+    public void testNormalizeIgnore() throws Exception
+    {
+        Normalizer normalizer = new DeepTrimNormalizer();
+        char[] chars = new char[58];
+
+        int pos = 0;
+
+        for ( char c = 0x0000; c < 0x0008; c++ )
+        {
+            chars[pos++] = c;
+        }
+
+        for ( char c = 0x000E; c < 0x001F; c++ )
+        {
+            chars[pos++] = c;
+        }
+
+        for ( char c = 0x007F; c < 0x0084; c++ )
+        {
+            chars[pos++] = c;
+        }
+
+        for ( char c = 0x0086; c < 0x009F; c++ )
+        {
+            chars[pos++] = c;
+        }
+
+        chars[pos++] = 0x00AD;
+
+        assertEquals( "", normalizer.normalize( new String( chars ) ) );
+    }
+
+    /*
+     @Test
+     public void testSpeed() throws Exception
+    {
+        Normalizer normalizer = new DeepTrimNormalizer();
+        char[] chars = new char[]{ 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0085, 0x00A0, 0x1680,
+            0x2000, 0x2001, 0x2002, 0x2003, 0x2004, 0x2005, 0x2006, 0x2007, 0x2008, 0x2009,
0x200A,
+            0x2028, 0x2029, 0x202F, 0x205F };
+        String s = new String( chars );
+        assertEquals( "", normalizer.normalize( s ) );
+        
+        String t = "xs crvtbynU  Jikl7897790";
+        
+        Normalizer normalizer2 = new DeepTrimToLowerNormalizer();
+        
+        String s1 = (String)normalizer2.normalize( t );
+
+        long t0 = System.currentTimeMillis();
+
+        for ( int i = 0; i < 100000; i++ )
+        {
+            normalizer2.normalize( t );
+        }
+        
+        long t1 = System.currentTimeMillis();
+        
+        System.out.println( t1 - t0 );
+
+        String s2 = StringTools.deepTrimToLower( t );
+
+        t0 = System.currentTimeMillis();
+
+        for ( int i = 0; i < 100000; i++ )
+        {
+            StringTools.deepTrimToLower( t );
+        }
+        
+        t1 = System.currentTimeMillis();
+        
+        System.out.println( t1 - t0 );
+    }
+    */
 }
\ No newline at end of file

Modified: directory/shared/branches/shared-replication/ldap/src/test/java/org/apache/directory/shared/ldap/schema/NumericNormalizerTest.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-replication/ldap/src/test/java/org/apache/directory/shared/ldap/schema/NumericNormalizerTest.java?rev=753323&r1=753322&r2=753323&view=diff
==============================================================================
--- directory/shared/branches/shared-replication/ldap/src/test/java/org/apache/directory/shared/ldap/schema/NumericNormalizerTest.java
(original)
+++ directory/shared/branches/shared-replication/ldap/src/test/java/org/apache/directory/shared/ldap/schema/NumericNormalizerTest.java
Fri Mar 13 17:39:42 2009
@@ -19,79 +19,97 @@
  */
 package org.apache.directory.shared.ldap.schema;
 
+
 import javax.naming.NamingException;
 
 import org.apache.directory.shared.ldap.schema.normalizers.NumericNormalizer;
+import org.junit.Test;
+import static org.junit.Assert.assertEquals;
 
-import junit.framework.TestCase;
 
 /**
- *
  * Test the numeric normalizer class
  *
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  */
-public class NumericNormalizerTest extends TestCase
+public class NumericNormalizerTest
 {
-   public void testNumericNormalizerNull() throws NamingException
-   {
-       Normalizer normalizer = new NumericNormalizer();
-       assertEquals( "", normalizer.normalize( (String)null ) );
-   }
-
-   public void testNumericNormalizerEmpty() throws NamingException
-   {
-       Normalizer normalizer = new NumericNormalizer();
-       assertEquals( "", normalizer.normalize( "" ) );
-   }
-
-   public void testNumericNormalizerOneSpace() throws NamingException
-   {
-       Normalizer normalizer = new NumericNormalizer();
-       assertEquals( "", normalizer.normalize( " " ) );
-   }
-
-   public void testNumericNormalizerTwoSpaces() throws NamingException
-   {
-       Normalizer normalizer = new NumericNormalizer();
-       assertEquals( "", normalizer.normalize( "  " ) );
-   }
-
-   public void testNumericNormalizerNSpaces() throws NamingException
-   {
-       Normalizer normalizer = new NumericNormalizer();
-       assertEquals( "", normalizer.normalize( "      " ) );
-   }
-
-   public void testInsignifiantSpacesStringOneChar() throws NamingException
-   {
-       Normalizer normalizer = new NumericNormalizer();
-       assertEquals( "1", normalizer.normalize( "1" ) );
-   }
-
-   public void testInsignifiantSpacesStringTwoChars() throws NamingException
-   {
-       Normalizer normalizer = new NumericNormalizer();
-       assertEquals( "11", normalizer.normalize( "11" ) );
-   }
-
-   public void testInsignifiantSpacesStringNChars() throws NamingException
-   {
-       Normalizer normalizer = new NumericNormalizer();
-       assertEquals( "123456", normalizer.normalize( "123456" ) );
-   }
-
-   public void testInsignifiantNumericCharsSpaces() throws NamingException
-   {
-       Normalizer normalizer = new NumericNormalizer();
-       assertEquals( "1", normalizer.normalize( " 1" ) );
-       assertEquals( "1", normalizer.normalize( "1 " ) );
-       assertEquals( "1", normalizer.normalize( " 1 " ) );
-       assertEquals( "11", normalizer.normalize( "1 1" ) );
-       assertEquals( "11", normalizer.normalize( " 1 1" ) );
-       assertEquals( "11", normalizer.normalize( "1 1 " ) );
-       assertEquals( "11", normalizer.normalize( "1  1" ) );
-       assertEquals( "11", normalizer.normalize( " 1   1 " ) );
-       assertEquals( "123456789", normalizer.normalize( "  123   456   789  " ) );
-   }
+    @Test
+    public void testNumericNormalizerNull() throws NamingException
+    {
+        Normalizer normalizer = new NumericNormalizer();
+        assertEquals( "", normalizer.normalize( ( String ) null ) );
+    }
+
+
+    @Test
+    public void testNumericNormalizerEmpty() throws NamingException
+    {
+        Normalizer normalizer = new NumericNormalizer();
+        assertEquals( "", normalizer.normalize( "" ) );
+    }
+
+
+    @Test
+    public void testNumericNormalizerOneSpace() throws NamingException
+    {
+        Normalizer normalizer = new NumericNormalizer();
+        assertEquals( "", normalizer.normalize( " " ) );
+    }
+
+
+    @Test
+    public void testNumericNormalizerTwoSpaces() throws NamingException
+    {
+        Normalizer normalizer = new NumericNormalizer();
+        assertEquals( "", normalizer.normalize( "  " ) );
+    }
+
+
+    @Test
+    public void testNumericNormalizerNSpaces() throws NamingException
+    {
+        Normalizer normalizer = new NumericNormalizer();
+        assertEquals( "", normalizer.normalize( "      " ) );
+    }
+
+
+    @Test
+    public void testInsignifiantSpacesStringOneChar() throws NamingException
+    {
+        Normalizer normalizer = new NumericNormalizer();
+        assertEquals( "1", normalizer.normalize( "1" ) );
+    }
+
+
+    @Test
+    public void testInsignifiantSpacesStringTwoChars() throws NamingException
+    {
+        Normalizer normalizer = new NumericNormalizer();
+        assertEquals( "11", normalizer.normalize( "11" ) );
+    }
+
+
+    @Test
+    public void testInsignifiantSpacesStringNChars() throws NamingException
+    {
+        Normalizer normalizer = new NumericNormalizer();
+        assertEquals( "123456", normalizer.normalize( "123456" ) );
+    }
+
+
+    @Test
+    public void testInsignifiantNumericCharsSpaces() throws NamingException
+    {
+        Normalizer normalizer = new NumericNormalizer();
+        assertEquals( "1", normalizer.normalize( " 1" ) );
+        assertEquals( "1", normalizer.normalize( "1 " ) );
+        assertEquals( "1", normalizer.normalize( " 1 " ) );
+        assertEquals( "11", normalizer.normalize( "1 1" ) );
+        assertEquals( "11", normalizer.normalize( " 1 1" ) );
+        assertEquals( "11", normalizer.normalize( "1 1 " ) );
+        assertEquals( "11", normalizer.normalize( "1  1" ) );
+        assertEquals( "11", normalizer.normalize( " 1   1 " ) );
+        assertEquals( "123456789", normalizer.normalize( "  123   456   789  " ) );
+    }
 }
\ No newline at end of file

Modified: directory/shared/branches/shared-replication/ldap/src/test/java/org/apache/directory/shared/ldap/schema/SchemaUtilsTest.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-replication/ldap/src/test/java/org/apache/directory/shared/ldap/schema/SchemaUtilsTest.java?rev=753323&r1=753322&r2=753323&view=diff
==============================================================================
--- directory/shared/branches/shared-replication/ldap/src/test/java/org/apache/directory/shared/ldap/schema/SchemaUtilsTest.java
(original)
+++ directory/shared/branches/shared-replication/ldap/src/test/java/org/apache/directory/shared/ldap/schema/SchemaUtilsTest.java
Fri Mar 13 17:39:42 2009
@@ -23,9 +23,9 @@
 import java.util.Comparator;
 import javax.naming.NamingException;
 
-import junit.framework.TestCase;
-
 import org.apache.directory.shared.ldap.NotImplementedException;
+import org.junit.Test;
+import static org.junit.Assert.assertEquals;
 
 
 /**
@@ -34,7 +34,7 @@
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  * @version $Rev$
  */
-public class SchemaUtilsTest extends TestCase
+public class SchemaUtilsTest
 {
     public static Syntax[] getSyntaxes()
     {
@@ -143,6 +143,7 @@
      * operations {@link SchemaUtils#render(StringBuffer, String[])} and
      * {@link SchemaUtils#render(String[])} are tested here.
      */
+    @Test
     public void testRenderQdescrs()
     {
         assertEquals( "", SchemaUtils.render( ( String[] ) null ).toString() );
@@ -172,12 +173,6 @@
     }
 
 
-    public void testRenderObjectClassArray()
-    {
-    }
-
-    // --------------------
-
     static class SyntaxImpl extends AbstractSyntax
     {
         private static final long serialVersionUID = 1L;

Modified: directory/shared/branches/shared-replication/ldap/src/test/java/org/apache/directory/shared/ldap/schema/TelephoneNumberNormalizerTest.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-replication/ldap/src/test/java/org/apache/directory/shared/ldap/schema/TelephoneNumberNormalizerTest.java?rev=753323&r1=753322&r2=753323&view=diff
==============================================================================
--- directory/shared/branches/shared-replication/ldap/src/test/java/org/apache/directory/shared/ldap/schema/TelephoneNumberNormalizerTest.java
(original)
+++ directory/shared/branches/shared-replication/ldap/src/test/java/org/apache/directory/shared/ldap/schema/TelephoneNumberNormalizerTest.java
Fri Mar 13 17:39:42 2009
@@ -19,106 +19,130 @@
  */
 package org.apache.directory.shared.ldap.schema;
 
+
 import javax.naming.NamingException;
 
 import org.apache.directory.shared.ldap.schema.normalizers.TelephoneNumberNormalizer;
+import org.junit.Test;
+import static org.junit.Assert.assertEquals;
 
-import junit.framework.TestCase;
 
 /**
- *
  * Test the Telephone Number normalizer class
  *
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  */
-public class TelephoneNumberNormalizerTest extends TestCase
+public class TelephoneNumberNormalizerTest
 {
-   public void testTelephoneNumberNormalizerNull() throws NamingException
-   {
-       Normalizer normalizer = new TelephoneNumberNormalizer();
-       assertEquals( "", normalizer.normalize( (String)null ) );
-   }
-
-   public void testTelephoneNumberNormalizerEmpty() throws NamingException
-   {
-       Normalizer normalizer = new TelephoneNumberNormalizer();
-       assertEquals( "", normalizer.normalize( "" ) );
-   }
-
-   public void testTelephoneNumberNormalizerOneSpace() throws NamingException
-   {
-       Normalizer normalizer = new TelephoneNumberNormalizer();
-       assertEquals( "", normalizer.normalize( " " ) );
-   }
-
-   public void testTelephoneNumberNormalizerTwoSpaces() throws NamingException
-   {
-       Normalizer normalizer = new TelephoneNumberNormalizer();
-       assertEquals( "", normalizer.normalize( "  " ) );
-   }
-
-   public void testTelephoneNumberNormalizerNSpaces() throws NamingException
-   {
-       Normalizer normalizer = new TelephoneNumberNormalizer();
-       assertEquals( "", normalizer.normalize( "      " ) );
-   }
-
-   public void testTelephoneNumberNormalizerOneHyphen() throws NamingException
-   {
-       Normalizer normalizer = new TelephoneNumberNormalizer();
-       assertEquals( "", normalizer.normalize( "-" ) );
-   }
-
-   public void testTelephoneNumberNormalizerTwoHyphen() throws NamingException
-   {
-       Normalizer normalizer = new TelephoneNumberNormalizer();
-       assertEquals( "", normalizer.normalize( "--" ) );
-   }
-
-   public void testTelephoneNumberNormalizerHyphensSpaces() throws NamingException
-   {
-       Normalizer normalizer = new TelephoneNumberNormalizer();
-       assertEquals( "", normalizer.normalize( " -- - -- " ) );
-   }
-
-   public void testInsignifiantSpacesStringOneChar() throws NamingException
-   {
-       Normalizer normalizer = new TelephoneNumberNormalizer();
-       assertEquals( "1", normalizer.normalize( "1" ) );
-   }
-
-   public void testInsignifiantSpacesStringTwoChars() throws NamingException
-   {
-       Normalizer normalizer = new TelephoneNumberNormalizer();
-       assertEquals( "11", normalizer.normalize( "11" ) );
-   }
-
-   public void testInsignifiantSpacesStringNChars() throws NamingException
-   {
-       Normalizer normalizer = new TelephoneNumberNormalizer();
-       assertEquals( "123456", normalizer.normalize( "123456" ) );
-   }
-
-   public void testInsignifiantTelephoneNumberCharsSpaces() throws NamingException
-   {
-       Normalizer normalizer = new TelephoneNumberNormalizer();
-       assertEquals( "1", normalizer.normalize( " 1" ) );
-       assertEquals( "1", normalizer.normalize( "1 " ) );
-       assertEquals( "1", normalizer.normalize( " 1 " ) );
-       assertEquals( "11", normalizer.normalize( "1 1" ) );
-       assertEquals( "11", normalizer.normalize( " 1 1" ) );
-       assertEquals( "11", normalizer.normalize( "1 1 " ) );
-       assertEquals( "11", normalizer.normalize( "1  1" ) );
-       assertEquals( "11", normalizer.normalize( " 1   1 " ) );
-       assertEquals( "123456789", normalizer.normalize( "  123   456   789  " ) );
-       assertEquals( "1", normalizer.normalize( "-1" ) );
-       assertEquals( "1", normalizer.normalize( "1-" ) );
-       assertEquals( "1", normalizer.normalize( "-1-" ) );
-       assertEquals( "11", normalizer.normalize( "1-1" ) );
-       assertEquals( "11", normalizer.normalize( "-1-1" ) );
-       assertEquals( "11", normalizer.normalize( "1-1-" ) );
-       assertEquals( "11", normalizer.normalize( "1--1" ) );
-       assertEquals( "11", normalizer.normalize( "-1---1-" ) );
-       assertEquals( "1(2)+3456789", normalizer.normalize( "---1(2)+3   456-  789 --" ) );
-   }
+    @Test
+    public void testTelephoneNumberNormalizerNull() throws NamingException
+    {
+        Normalizer normalizer = new TelephoneNumberNormalizer();
+        assertEquals( "", normalizer.normalize( ( String ) null ) );
+    }
+
+
+    @Test
+    public void testTelephoneNumberNormalizerEmpty() throws NamingException
+    {
+        Normalizer normalizer = new TelephoneNumberNormalizer();
+        assertEquals( "", normalizer.normalize( "" ) );
+    }
+
+
+    @Test
+    public void testTelephoneNumberNormalizerOneSpace() throws NamingException
+    {
+        Normalizer normalizer = new TelephoneNumberNormalizer();
+        assertEquals( "", normalizer.normalize( " " ) );
+    }
+
+
+    @Test
+    public void testTelephoneNumberNormalizerTwoSpaces() throws NamingException
+    {
+        Normalizer normalizer = new TelephoneNumberNormalizer();
+        assertEquals( "", normalizer.normalize( "  " ) );
+    }
+
+
+    @Test
+    public void testTelephoneNumberNormalizerNSpaces() throws NamingException
+    {
+        Normalizer normalizer = new TelephoneNumberNormalizer();
+        assertEquals( "", normalizer.normalize( "      " ) );
+    }
+
+
+    @Test
+    public void testTelephoneNumberNormalizerOneHyphen() throws NamingException
+    {
+        Normalizer normalizer = new TelephoneNumberNormalizer();
+        assertEquals( "", normalizer.normalize( "-" ) );
+    }
+
+
+    @Test
+    public void testTelephoneNumberNormalizerTwoHyphen() throws NamingException
+    {
+        Normalizer normalizer = new TelephoneNumberNormalizer();
+        assertEquals( "", normalizer.normalize( "--" ) );
+    }
+
+
+    @Test
+    public void testTelephoneNumberNormalizerHyphensSpaces() throws NamingException
+    {
+        Normalizer normalizer = new TelephoneNumberNormalizer();
+        assertEquals( "", normalizer.normalize( " -- - -- " ) );
+    }
+
+
+    @Test
+    public void testInsignifiantSpacesStringOneChar() throws NamingException
+    {
+        Normalizer normalizer = new TelephoneNumberNormalizer();
+        assertEquals( "1", normalizer.normalize( "1" ) );
+    }
+
+
+    @Test
+    public void testInsignifiantSpacesStringTwoChars() throws NamingException
+    {
+        Normalizer normalizer = new TelephoneNumberNormalizer();
+        assertEquals( "11", normalizer.normalize( "11" ) );
+    }
+
+
+    @Test
+    public void testInsignifiantSpacesStringNChars() throws NamingException
+    {
+        Normalizer normalizer = new TelephoneNumberNormalizer();
+        assertEquals( "123456", normalizer.normalize( "123456" ) );
+    }
+
+
+    @Test
+    public void testInsignifiantTelephoneNumberCharsSpaces() throws NamingException
+    {
+        Normalizer normalizer = new TelephoneNumberNormalizer();
+        assertEquals( "1", normalizer.normalize( " 1" ) );
+        assertEquals( "1", normalizer.normalize( "1 " ) );
+        assertEquals( "1", normalizer.normalize( " 1 " ) );
+        assertEquals( "11", normalizer.normalize( "1 1" ) );
+        assertEquals( "11", normalizer.normalize( " 1 1" ) );
+        assertEquals( "11", normalizer.normalize( "1 1 " ) );
+        assertEquals( "11", normalizer.normalize( "1  1" ) );
+        assertEquals( "11", normalizer.normalize( " 1   1 " ) );
+        assertEquals( "123456789", normalizer.normalize( "  123   456   789  " ) );
+        assertEquals( "1", normalizer.normalize( "-1" ) );
+        assertEquals( "1", normalizer.normalize( "1-" ) );
+        assertEquals( "1", normalizer.normalize( "-1-" ) );
+        assertEquals( "11", normalizer.normalize( "1-1" ) );
+        assertEquals( "11", normalizer.normalize( "-1-1" ) );
+        assertEquals( "11", normalizer.normalize( "1-1-" ) );
+        assertEquals( "11", normalizer.normalize( "1--1" ) );
+        assertEquals( "11", normalizer.normalize( "-1---1-" ) );
+        assertEquals( "1(2)+3456789", normalizer.normalize( "---1(2)+3   456-  789 --" )
);
+    }
 }
\ No newline at end of file

Modified: directory/shared/branches/shared-replication/ldap/src/test/java/org/apache/directory/shared/ldap/schema/UsageEnumTest.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-replication/ldap/src/test/java/org/apache/directory/shared/ldap/schema/UsageEnumTest.java?rev=753323&r1=753322&r2=753323&view=diff
==============================================================================
--- directory/shared/branches/shared-replication/ldap/src/test/java/org/apache/directory/shared/ldap/schema/UsageEnumTest.java
(original)
+++ directory/shared/branches/shared-replication/ldap/src/test/java/org/apache/directory/shared/ldap/schema/UsageEnumTest.java
Fri Mar 13 17:39:42 2009
@@ -19,7 +19,8 @@
  */
 package org.apache.directory.shared.ldap.schema;
 
-import junit.framework.TestCase;
+import org.junit.Test;
+import static org.junit.Assert.assertEquals;
 
 /**
  * The unit tests for methods on UsageEnum.
@@ -27,8 +28,9 @@
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  * @version $Rev: 485048 $
  */
-public class UsageEnumTest extends TestCase
+public class UsageEnumTest
 {
+    @Test
     public void testGetValue()
     {
         assertEquals( 0, UsageEnum.USER_APPLICATIONS.getValue() );
@@ -37,6 +39,7 @@
         assertEquals( 3, UsageEnum.DSA_OPERATION.getValue() );
     }
     
+    @Test
     public void testGetUsage()
     {
         assertEquals( UsageEnum.DIRECTORY_OPERATION, UsageEnum.getUsage( "directoryOperation"
) );
@@ -46,6 +49,7 @@
         assertEquals( null, UsageEnum.getUsage( "azerty" ) );
     }
     
+    @Test
     public void testRenderer()
     {
         assertEquals( "directoryOperation", UsageEnum.render( UsageEnum.DIRECTORY_OPERATION
) );



Mime
View raw message