directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r754728 - /directory/shared/branches/shared-replication/ldap/src/test/java/org/apache/directory/shared/ldap/util/
Date Sun, 15 Mar 2009 19:17:58 GMT
Author: elecharny
Date: Sun Mar 15 19:17:57 2009
New Revision: 754728

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

Modified:
    directory/shared/branches/shared-replication/ldap/src/test/java/org/apache/directory/shared/ldap/util/ArrayEnumerationTest.java
    directory/shared/branches/shared-replication/ldap/src/test/java/org/apache/directory/shared/ldap/util/ByteBufferTest.java
    directory/shared/branches/shared-replication/ldap/src/test/java/org/apache/directory/shared/ldap/util/DNUtilsTest.java
    directory/shared/branches/shared-replication/ldap/src/test/java/org/apache/directory/shared/ldap/util/DirectoryClassUtilsTest.java
    directory/shared/branches/shared-replication/ldap/src/test/java/org/apache/directory/shared/ldap/util/GeneralizedTimeTest.java
    directory/shared/branches/shared-replication/ldap/src/test/java/org/apache/directory/shared/ldap/util/JoinIteratorTest.java
    directory/shared/branches/shared-replication/ldap/src/test/java/org/apache/directory/shared/ldap/util/LdapUrlTest.java
    directory/shared/branches/shared-replication/ldap/src/test/java/org/apache/directory/shared/ldap/util/NamespaceToolsTest.java
    directory/shared/branches/shared-replication/ldap/src/test/java/org/apache/directory/shared/ldap/util/StringToolsTest.java

Modified: directory/shared/branches/shared-replication/ldap/src/test/java/org/apache/directory/shared/ldap/util/ArrayEnumerationTest.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-replication/ldap/src/test/java/org/apache/directory/shared/ldap/util/ArrayEnumerationTest.java?rev=754728&r1=754727&r2=754728&view=diff
==============================================================================
--- directory/shared/branches/shared-replication/ldap/src/test/java/org/apache/directory/shared/ldap/util/ArrayEnumerationTest.java (original)
+++ directory/shared/branches/shared-replication/ldap/src/test/java/org/apache/directory/shared/ldap/util/ArrayEnumerationTest.java Sun Mar 15 19:17:57 2009
@@ -23,8 +23,11 @@
 import java.util.NoSuchElementException;
 
 import org.apache.directory.shared.ldap.util.ArrayEnumeration;
-
-import junit.framework.TestCase;
+import org.junit.Test;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.fail;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.assertNotNull;
 
 
 /**
@@ -33,8 +36,9 @@
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  * @version $Rev$
  */
-public class ArrayEnumerationTest extends TestCase
+public class ArrayEnumerationTest
 {
+    @Test
     public void testAll()
     {
         // test with null array

Modified: directory/shared/branches/shared-replication/ldap/src/test/java/org/apache/directory/shared/ldap/util/ByteBufferTest.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-replication/ldap/src/test/java/org/apache/directory/shared/ldap/util/ByteBufferTest.java?rev=754728&r1=754727&r2=754728&view=diff
==============================================================================
--- directory/shared/branches/shared-replication/ldap/src/test/java/org/apache/directory/shared/ldap/util/ByteBufferTest.java (original)
+++ directory/shared/branches/shared-replication/ldap/src/test/java/org/apache/directory/shared/ldap/util/ByteBufferTest.java Sun Mar 15 19:17:57 2009
@@ -20,7 +20,8 @@
 package org.apache.directory.shared.ldap.util;
 
 
-import junit.framework.TestCase;
+import org.junit.Test;
+import static org.junit.Assert.assertEquals;
 
 
 /**
@@ -29,8 +30,9 @@
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  * @version $Rev$
  */
-public class ByteBufferTest extends TestCase
+public class ByteBufferTest
 {
+    @Test
     public void testByteBufferGrowth()
     {
         ByteBuffer buf = new ByteBuffer();

Modified: directory/shared/branches/shared-replication/ldap/src/test/java/org/apache/directory/shared/ldap/util/DNUtilsTest.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-replication/ldap/src/test/java/org/apache/directory/shared/ldap/util/DNUtilsTest.java?rev=754728&r1=754727&r2=754728&view=diff
==============================================================================
--- directory/shared/branches/shared-replication/ldap/src/test/java/org/apache/directory/shared/ldap/util/DNUtilsTest.java (original)
+++ directory/shared/branches/shared-replication/ldap/src/test/java/org/apache/directory/shared/ldap/util/DNUtilsTest.java Sun Mar 15 19:17:57 2009
@@ -21,9 +21,9 @@
 
 
 import org.apache.directory.shared.ldap.util.StringTools;
+import org.junit.Test;
+import static org.junit.Assert.assertEquals;
 
-import junit.framework.Assert;
-import junit.framework.TestCase;
 
 
 /**
@@ -31,7 +31,7 @@
  * 
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  */
-public class DNUtilsTest extends TestCase
+public class DNUtilsTest
 {
     // ~ Methods
     // ------------------------------------------------------------------------------------
@@ -39,114 +39,125 @@
     /**
      * Test the DNUtils AreEquals method
      */
+    @Test
     public void testAreEqualsFull()
     {
         // Full compare
-        Assert.assertEquals( 6, StringTools.areEquals( "azerty".getBytes(), 0, "azerty" ) );
+        assertEquals( 6, StringTools.areEquals( "azerty".getBytes(), 0, "azerty" ) );
     }
 
 
     /**
      * Test the DNUtils AreEquals method
      */
+    @Test
     public void testAreEqualsDiff()
     {
         // First character is !=
-        Assert.assertEquals( -1, StringTools.areEquals( "azerty".getBytes(), 0, "Azerty" ) );
+        assertEquals( -1, StringTools.areEquals( "azerty".getBytes(), 0, "Azerty" ) );
     }
 
 
     /**
      * Test the DNUtils AreEquals method
      */
+    @Test
     public void testAreEqualsEmpty()
     {
         // Compare to an empty string
-        Assert.assertEquals( -1, StringTools.areEquals( "azerty".getBytes(), 0, "" ) );
+        assertEquals( -1, StringTools.areEquals( "azerty".getBytes(), 0, "" ) );
     }
 
 
     /**
      * Test the DNUtils AreEquals method
      */
+    @Test
     public void testAreEqualsFirstCharDiff()
     {
         // First character is !=
-        Assert.assertEquals( -1, StringTools.areEquals( "azerty".getBytes(), 0, "Azerty" ) );
+        assertEquals( -1, StringTools.areEquals( "azerty".getBytes(), 0, "Azerty" ) );
     }
 
 
     /**
      * Test the DNUtils AreEquals method
      */
+    @Test
     public void testAreEqualsMiddleCharDiff()
     {
         // First character is !=
-        Assert.assertEquals( -1, StringTools.areEquals( "azerty".getBytes(), 0, "azeRty" ) );
+        assertEquals( -1, StringTools.areEquals( "azerty".getBytes(), 0, "azeRty" ) );
     }
 
 
     /**
      * Test the DNUtils AreEquals method
      */
+    @Test
     public void testAreEqualsLastCharDiff()
     {
         // First character is !=
-        Assert.assertEquals( -1, StringTools.areEquals( "azerty".getBytes(), 0, "azertY" ) );
+        assertEquals( -1, StringTools.areEquals( "azerty".getBytes(), 0, "azertY" ) );
     }
 
 
     /**
      * Test the DNUtils AreEquals method
      */
+    @Test
     public void testAreEqualsCharByChar()
     {
         // Index must be incremented after each comparison
-        Assert.assertEquals( 1, StringTools.areEquals( "azerty".getBytes(), 0, "a" ) );
-        Assert.assertEquals( 2, StringTools.areEquals( "azerty".getBytes(), 1, "z" ) );
-        Assert.assertEquals( 3, StringTools.areEquals( "azerty".getBytes(), 2, "e" ) );
-        Assert.assertEquals( 4, StringTools.areEquals( "azerty".getBytes(), 3, "r" ) );
-        Assert.assertEquals( 5, StringTools.areEquals( "azerty".getBytes(), 4, "t" ) );
-        Assert.assertEquals( 6, StringTools.areEquals( "azerty".getBytes(), 5, "y" ) );
+        assertEquals( 1, StringTools.areEquals( "azerty".getBytes(), 0, "a" ) );
+        assertEquals( 2, StringTools.areEquals( "azerty".getBytes(), 1, "z" ) );
+        assertEquals( 3, StringTools.areEquals( "azerty".getBytes(), 2, "e" ) );
+        assertEquals( 4, StringTools.areEquals( "azerty".getBytes(), 3, "r" ) );
+        assertEquals( 5, StringTools.areEquals( "azerty".getBytes(), 4, "t" ) );
+        assertEquals( 6, StringTools.areEquals( "azerty".getBytes(), 5, "y" ) );
     }
 
 
     /**
      * Test the DNUtils AreEquals method
      */
+    @Test
     public void testAreEqualsTooShort()
     {
         // length too short
-        Assert.assertEquals( -1, StringTools.areEquals( "azerty".getBytes(), 0, "azertyiop" ) );
+        assertEquals( -1, StringTools.areEquals( "azerty".getBytes(), 0, "azertyiop" ) );
     }
 
 
     /**
      * Test the DNUtils AreEquals method
      */
+    @Test
     public void testAreEqualsTooShortMiddle()
     {
         // length too short
-        Assert.assertEquals( -1, StringTools.areEquals( "azerty".getBytes(), 0, "ertyiop" ) );
+        assertEquals( -1, StringTools.areEquals( "azerty".getBytes(), 0, "ertyiop" ) );
     }
 
 
     /**
      * Test the DNUtils AreEquals method
      */
+    @Test
     public void testAreEqualsLastChar()
     {
         // last character
-        Assert.assertEquals( 6, StringTools.areEquals( "azerty".getBytes(), 5, "y" ) );
+        assertEquals( 6, StringTools.areEquals( "azerty".getBytes(), 5, "y" ) );
     }
 
 
     /**
      * Test the DNUtils AreEquals method
      */
+    @Test
     public void testAreEqualsMiddle()
     {
         // In the middle
-        Assert.assertEquals( 4, StringTools.areEquals( "azerty".getBytes(), 2, "er" ) );
+        assertEquals( 4, StringTools.areEquals( "azerty".getBytes(), 2, "er" ) );
     }
 }

Modified: directory/shared/branches/shared-replication/ldap/src/test/java/org/apache/directory/shared/ldap/util/DirectoryClassUtilsTest.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-replication/ldap/src/test/java/org/apache/directory/shared/ldap/util/DirectoryClassUtilsTest.java?rev=754728&r1=754727&r2=754728&view=diff
==============================================================================
--- directory/shared/branches/shared-replication/ldap/src/test/java/org/apache/directory/shared/ldap/util/DirectoryClassUtilsTest.java (original)
+++ directory/shared/branches/shared-replication/ldap/src/test/java/org/apache/directory/shared/ldap/util/DirectoryClassUtilsTest.java Sun Mar 15 19:17:57 2009
@@ -24,7 +24,10 @@
 import java.util.ArrayList;
 import java.util.Collection;
 
-import junit.framework.TestCase;
+import org.junit.Test;
+import static org.junit.Assert.fail;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
 
 
 /**
@@ -33,7 +36,7 @@
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  * @version $Rev:$
  */
-public class DirectoryClassUtilsTest extends TestCase
+public class DirectoryClassUtilsTest
 {
     private static class TestClass
     {
@@ -48,6 +51,7 @@
         }
     }
     
+    @Test
     public void testSameBehaviourOfStandardGetMethod()
     {
         Method m1 = null;
@@ -82,6 +86,7 @@
         
     }
     
+    @Test
     public void testNewBehaviourOfAssignmentCompatibleGetMethod()
     {
         Method m2 = null;

Modified: directory/shared/branches/shared-replication/ldap/src/test/java/org/apache/directory/shared/ldap/util/GeneralizedTimeTest.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-replication/ldap/src/test/java/org/apache/directory/shared/ldap/util/GeneralizedTimeTest.java?rev=754728&r1=754727&r2=754728&view=diff
==============================================================================
--- directory/shared/branches/shared-replication/ldap/src/test/java/org/apache/directory/shared/ldap/util/GeneralizedTimeTest.java (original)
+++ directory/shared/branches/shared-replication/ldap/src/test/java/org/apache/directory/shared/ldap/util/GeneralizedTimeTest.java Sun Mar 15 19:17:57 2009
@@ -24,11 +24,14 @@
 import java.util.Calendar;
 import java.util.TimeZone;
 
-import junit.framework.TestCase;
-
 import org.apache.directory.shared.ldap.schema.syntax.GeneralizedTimeSyntaxCheckerTest;
 import org.apache.directory.shared.ldap.util.GeneralizedTime.Format;
 import org.apache.directory.shared.ldap.util.GeneralizedTime.TimeZoneFormat;
+import org.junit.Test;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.fail;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.assertFalse;
 
 
 /**
@@ -37,7 +40,7 @@
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  * @version $Rev: 542077 $
  */
-public class GeneralizedTimeTest extends TestCase
+public class GeneralizedTimeTest
 {
 
     // Test all valid variants:
@@ -48,6 +51,7 @@
     /**
      * Tests yyyyMMddHHmmssZ.
      */
+    @Test
     public void testYearMonthDayHourMinSecZulu() throws ParseException
     {
         String gt = "20080102121314Z";
@@ -60,6 +64,7 @@
     /**
      * Tests yyyyMMddHHmmss+04.
      */
+    @Test
     public void testYearMonthDayHourMinSecPlusHour() throws ParseException
     {
         String gt = "20080102121314+04";
@@ -72,6 +77,7 @@
     /**
      * Tests yyyyMMddHHmmss-1030.
      */
+    @Test
     public void testYearMonthDayHourMinSecMinusHourMin() throws ParseException
     {
         String gt = "20080102121314-1030";
@@ -84,6 +90,7 @@
     /**
      * Tests yyyyMMddHHmmss.SSSZ.
      */
+    @Test
     public void testYearMonthDayHourMinSecDotFractionZulu() throws ParseException
     {
         String gt = "20080102121314.987Z";
@@ -96,6 +103,7 @@
     /**
      * Tests yyyyMMddHHmmss.SSS+0100.
      */
+    @Test
     public void testYearMonthDayHourMinSecDotFractionPlusHour() throws ParseException
     {
         String gt = "20080102121314.987+0100";
@@ -108,6 +116,7 @@
     /**
      * Tests yyyyMMddHHmmss.SSS-1030.
      */
+    @Test
     public void testYearMonthDayHourMinSecDotFractionMinusHourMin() throws ParseException
     {
         String gt = "20080102121314.987-1030";
@@ -120,6 +129,7 @@
     /**
      * Tests yyyyMMddHHmmss,SSSZ.
      */
+    @Test
     public void testYearMonthDayHourMinSecCommaFractionZulu() throws ParseException
     {
         String gt = "20080102121314,987Z";
@@ -132,6 +142,7 @@
     /**
      * Tests yyyyMMddHHmmss,SSS+0100.
      */
+    @Test
     public void testYearMonthDayHourMinSecCommaFractionPlusHour() throws ParseException
     {
         String gt = "20080102121314,987+0100";
@@ -144,6 +155,7 @@
     /**
      * Tests yyyyMMddHHmmss,SSS-1030.
      */
+    @Test
     public void testYearMonthDayHourMinSecCommaFractionMinusHourMin() throws ParseException
     {
         String gt = "20080102121314,987-1030";
@@ -156,6 +168,7 @@
     /**
      * Tests yyyyMMddHHmmZ.
      */
+    @Test
     public void testYearMonthDayHourMinZulu() throws ParseException
     {
         String gt = "200801021213Z";
@@ -168,6 +181,7 @@
     /**
      * Tests yyyyMMddHHmm+HH.
      */
+    @Test
     public void testYearMonthDayHourMinPlusHour() throws ParseException
     {
         String gt = "200801021213+04";
@@ -180,6 +194,7 @@
     /**
      * Tests yyyyMMddHHmm-HHmm.
      */
+    @Test
     public void testYearMonthDayHourMinMinusHourMin() throws ParseException
     {
         String gt = "200801021213-1030";
@@ -192,6 +207,7 @@
     /**
      * Tests yyyyMMddHHmm.SSSZ.
      */
+    @Test
     public void testYearMonthDayHourMinDotFractionZulu() throws ParseException
     {
         String gt = "200801021213.987Z";
@@ -204,6 +220,7 @@
     /**
      * Tests yyyyMMddHHmm.SSS+0100.
      */
+    @Test
     public void testYearMonthDayHourMinDotFractionPlusHour() throws ParseException
     {
         String gt = "200801021213.987+0100";
@@ -216,6 +233,7 @@
     /**
      * Tests yyyyMMddHHmm.SSS-1030.
      */
+    @Test
     public void testYearMonthDayHourMinDotFractionMinusHourMin() throws ParseException
     {
         String gt = "200801021213.987-1030";
@@ -228,6 +246,7 @@
     /**
      * Tests yyyyMMddHHmm,SSSZ.
      */
+    @Test
     public void testYearMonthDayHourMinCommaFractionZulu() throws ParseException
     {
         String gt = "200801021213,987Z";
@@ -240,6 +259,7 @@
     /**
      * Tests yyyyMMddHHmm,SSS+0100.
      */
+    @Test
     public void testYearMonthDayHourMinCommaFractionPlusHour() throws ParseException
     {
         String gt = "200801021213,987+0100";
@@ -252,6 +272,7 @@
     /**
      * Tests yyyyMMddHHmm,SSS-1030.
      */
+    @Test
     public void testYearMonthDayHourMinCommaFractionMinusHourMin() throws ParseException
     {
         String gt = "200801021213,987-1030";
@@ -264,6 +285,7 @@
     /**
      * Tests yyyyMMddHHZ.
      */
+    @Test
     public void testYearMonthDayHourZulu() throws ParseException
     {
         String gt = "2008010212Z";
@@ -276,6 +298,7 @@
     /**
      * Tests yyyyMMddHH+HH.
      */
+    @Test
     public void testYearMonthDayHourPlusHour() throws ParseException
     {
         String gt = "2008010212+04";
@@ -288,6 +311,7 @@
     /**
      * Tests yyyyMMddHH-HHmm.
      */
+    @Test
     public void testYearMonthDayHourMinusHourMin() throws ParseException
     {
         String gt = "2008010212-1030";
@@ -300,6 +324,7 @@
     /**
      * Tests yyyyMMddHH.SSSZ.
      */
+    @Test
     public void testYearMonthDayHourDotFractionZulu() throws ParseException
     {
         String gt = "200801021213.987Z";
@@ -312,6 +337,7 @@
     /**
      * Tests yyyyMMddHH.SSS+0100.
      */
+    @Test
     public void testYearMonthDayHourDotFractionPlusHour() throws ParseException
     {
         String gt = "2008010212.987+0100";
@@ -324,6 +350,7 @@
     /**
      * Tests yyyyMMddHH.SSS-1030.
      */
+    @Test
     public void testYearMonthDayHourDotFractionMinusHourMin() throws ParseException
     {
         String gt = "2008010212.987-1030";
@@ -336,6 +363,7 @@
     /**
      * Tests yyyyMMddHH,SSSZ.
      */
+    @Test
     public void testYearMonthDayHourCommaFractionZulu() throws ParseException
     {
         String gt = "2008010212,987Z";
@@ -348,6 +376,7 @@
     /**
      * Tests yyyyMMddHH,SSS+0100.
      */
+    @Test
     public void testYearMonthDayHourCommaFractionPlusHour() throws ParseException
     {
         String gt = "2008010212,987+0100";
@@ -360,6 +389,7 @@
     /**
      * Tests yyyyMMddHH,SSS-1030.
      */
+    @Test
     public void testYearMonthDayHourCommaFractionMinusHourMin() throws ParseException
     {
         String gt = "2008010212,987-1030";
@@ -372,6 +402,7 @@
     /**
      * Tests fraction of a second.
      */
+    @Test
     public void testFractionOfSecond() throws ParseException
     {
         String gt = "20080102121314,987Z";
@@ -385,6 +416,7 @@
     /**
      * Tests fraction of a minute.
      */
+    @Test
     public void testFractionOfMinute1() throws ParseException
     {
         String gt = "200801021213,5Z";
@@ -399,6 +431,7 @@
     /**
      * Tests fraction of a minute.
      */
+    @Test
     public void testFractionOfMinute2() throws ParseException
     {
         String gt = "200801021213,125Z";
@@ -413,6 +446,7 @@
     /**
      * Tests fraction of an hour.
      */
+    @Test
     public void testFractionOfHour1() throws ParseException
     {
         String gt = "2008010212,5Z";
@@ -428,6 +462,7 @@
     /**
      * Tests fraction of an hour.
      */
+    @Test
     public void testFractionOfHour2() throws ParseException
     {
         String gt = "2008010212,125Z";
@@ -443,6 +478,7 @@
     /**
      * Test formatting
      */
+    @Test
     public void testFormatting() throws ParseException
     {
         String gt = "20080102121314Z";
@@ -469,6 +505,7 @@
     /**
      * Testcases from {@link GeneralizedTimeSyntaxCheckerTest#testCorrectCase()}.
      */
+    @Test
     public void testGeneralizedTimeSyntaxCheckerTestCorrectCase() throws ParseException
     {
         new GeneralizedTime( "20061205184527Z" );
@@ -483,6 +520,7 @@
     /**
      * Testcases from {@link GeneralizedTimeSyntaxCheckerTest#testErrorCase()}.
      */
+    @Test
     public void testGeneralizedTimeSyntaxCheckerTestErrorCase()
     {
         try
@@ -609,6 +647,7 @@
      * Tests leap second.
      * The GeneralizedTime class does not support leap seconds!
      */
+    @Test
     public void testLeapSecond() throws ParseException
     {
         String gt = "20051231235960Z";
@@ -627,6 +666,7 @@
     /**
      * Tests Feb 29 in a leap year.
      */
+    @Test
     public void testFebruary29inLeapYear() throws ParseException
     {
         String gt = "20080229000000Z";
@@ -639,6 +679,7 @@
     /**
      * Tests Feb 29 in a non-leap year.
      */
+    @Test
     public void testFebruary29inNonLeapYear() throws ParseException
     {
         String gt = "20070229000000Z";
@@ -657,6 +698,7 @@
     /**
      * Tests null.
      */
+    @Test
     public void testNull() throws ParseException
     {
         try
@@ -687,6 +729,7 @@
     /**
      * Tests empty string.
      */
+    @Test
     public void testEmpty() throws ParseException
     {
         String gt = "";
@@ -705,6 +748,7 @@
     /**
      * Tests invalid cases.
      */
+    @Test
     public void testInvalid() throws ParseException
     {
         // too short year
@@ -976,6 +1020,7 @@
     /**
      * Tests constructor with calendar object.
      */
+    @Test
     public void testCalendar() throws ParseException
     {
         Calendar calendar = Calendar.getInstance();
@@ -996,6 +1041,7 @@
     /**
      * Tests a complete round trip.
      */
+    @Test
     public void testRoundTrip() throws ParseException
     {
         Calendar calendar = Calendar.getInstance( TimeZone.getTimeZone( "GMT" ) );
@@ -1029,6 +1075,7 @@
     /**
      * Tests the compareTo() method.
      */
+    @Test
     public void testCompareTo() throws ParseException
     {
         String gt1 = "20080102121313,999Z";
@@ -1057,6 +1104,7 @@
     /**
      * Tests the equals() method.
      */
+    @Test
     public void testEquals() throws ParseException
     {
         String gt1 = "20080102121314Z";

Modified: directory/shared/branches/shared-replication/ldap/src/test/java/org/apache/directory/shared/ldap/util/JoinIteratorTest.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-replication/ldap/src/test/java/org/apache/directory/shared/ldap/util/JoinIteratorTest.java?rev=754728&r1=754727&r2=754728&view=diff
==============================================================================
--- directory/shared/branches/shared-replication/ldap/src/test/java/org/apache/directory/shared/ldap/util/JoinIteratorTest.java (original)
+++ directory/shared/branches/shared-replication/ldap/src/test/java/org/apache/directory/shared/ldap/util/JoinIteratorTest.java Sun Mar 15 19:17:57 2009
@@ -26,8 +26,13 @@
 import java.util.List;
 
 import org.apache.directory.shared.ldap.util.JoinIterator;
+import org.junit.Test;
 
-import junit.framework.TestCase;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.fail;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertFalse;
 
 
 /**
@@ -36,8 +41,9 @@
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  * @version $Rev$
  */
-public class JoinIteratorTest extends TestCase
+public class JoinIteratorTest
 {
+    @Test
     public void testNullArgument()
     {
         try
@@ -52,6 +58,7 @@
     }
 
 
+    @Test
     public void testSingleArgument()
     {
         Iterator<?>[] iterators = new Iterator<?>[]
@@ -69,6 +76,7 @@
     }
 
 
+    @Test
     public void testTwoArguments()
     {
         Iterator<?>[] iterators = new Iterator<?>[]
@@ -83,6 +91,7 @@
     }
 
 
+    @Test
     public void testSeveralArguments()
     {
         List<String> multivalued = new ArrayList<String>();

Modified: directory/shared/branches/shared-replication/ldap/src/test/java/org/apache/directory/shared/ldap/util/LdapUrlTest.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-replication/ldap/src/test/java/org/apache/directory/shared/ldap/util/LdapUrlTest.java?rev=754728&r1=754727&r2=754728&view=diff
==============================================================================
--- directory/shared/branches/shared-replication/ldap/src/test/java/org/apache/directory/shared/ldap/util/LdapUrlTest.java (original)
+++ directory/shared/branches/shared-replication/ldap/src/test/java/org/apache/directory/shared/ldap/util/LdapUrlTest.java Sun Mar 15 19:17:57 2009
@@ -26,13 +26,16 @@
 import javax.naming.InvalidNameException;
 import javax.naming.directory.SearchControls;
 
-import junit.framework.Assert;
-import junit.framework.TestCase;
-
 import org.apache.directory.shared.ldap.codec.util.LdapURLEncodingException;
 import org.apache.directory.shared.ldap.name.LdapDN;
 import org.apache.directory.shared.ldap.util.LdapURL.Extension;
 import org.junit.Test;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.fail;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertFalse;
 
 
 /**
@@ -40,43 +43,37 @@
  * 
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  */
-public class LdapUrlTest extends TestCase
+public class LdapUrlTest
 {
     // ~ Methods
     // ------------------------------------------------------------------------------------
-
-    /**
-     * Setup the test
-     */
-    protected void setUp()
-    {
-    }
-
-
     /**
      * Test a null LdapURL
      */
+    @Test
     public void testLdapUrlNull()
     {
-        Assert.assertEquals( "ldap:///", new LdapURL().toString() );
+        assertEquals( "ldap:///", new LdapURL().toString() );
     }
 
 
     /**
      * test an empty LdapURL
      */
+    @Test
     public void testLdapDNEmpty() throws LdapURLEncodingException
     {
-        Assert.assertEquals( "ldap:///", new LdapURL( "" ).toString() );
+        assertEquals( "ldap:///", new LdapURL( "" ).toString() );
     }
 
 
     /**
      * test a simple LdapURL
      */
+    @Test
     public void testLdapDNSimple() throws LdapURLEncodingException
     {
-        Assert.assertEquals( "ldap://directory.apache.org:80/", new LdapURL( "ldap://directory.apache.org:80/" )
+        assertEquals( "ldap://directory.apache.org:80/", new LdapURL( "ldap://directory.apache.org:80/" )
             .toString() );
     }
 
@@ -84,15 +81,17 @@
     /**
      * test a LdapURL host 1
      */
+    @Test
     public void testLdapDNWithMinus() throws LdapURLEncodingException
     {
-        Assert.assertEquals( "ldap://d-a.org:80/", new LdapURL( "ldap://d-a.org:80/" ).toString() );
+        assertEquals( "ldap://d-a.org:80/", new LdapURL( "ldap://d-a.org:80/" ).toString() );
     }
 
 
     /**
      * test a LdapURL with a bad port
      */
+    @Test
     public void testLdapDNBadPort()
     {
         try
@@ -101,17 +100,18 @@
         }
         catch ( LdapURLEncodingException luee )
         {
-            Assert.assertTrue( true );
+            assertTrue( true );
             return;
         }
 
-        Assert.fail();
+        fail();;
     }
 
 
     /**
      * test a LdapURL with a bad port 2
      */
+    @Test
     public void testLdapDNBadPort2()
     {
         try
@@ -120,17 +120,18 @@
         }
         catch ( LdapURLEncodingException luee )
         {
-            Assert.assertTrue( true );
+            assertTrue( true );
             return;
         }
 
-        Assert.fail();
+        fail();;
     }
 
 
     /**
      * test a LdapURL with a bad port 3
      */
+    @Test
     public void testLdapDNBadPort3()
     {
         try
@@ -139,17 +140,18 @@
         }
         catch ( LdapURLEncodingException luee )
         {
-            Assert.assertTrue( true );
+            assertTrue( true );
             return;
         }
 
-        Assert.fail();
+        fail();;
     }
 
 
     /**
      * test a LdapURL with a bad port 4
      */
+    @Test
     public void testLdapDNBadPort4()
     {
         try
@@ -158,26 +160,28 @@
         }
         catch ( LdapURLEncodingException luee )
         {
-            Assert.assertTrue( true );
+            assertTrue( true );
             return;
         }
 
-        Assert.fail();
+        fail();;
     }
 
 
     /**
      * test a LdapURL with no host
      */
+    @Test
     public void testLdapDNBadHost1() throws LdapURLEncodingException
     {
-        Assert.assertEquals( "ldap:///", new LdapURL( "ldap:///" ).toString() );
+        assertEquals( "ldap:///", new LdapURL( "ldap:///" ).toString() );
     }
 
 
     /**
      * test a LdapURL with a bad host 2
      */
+    @Test
     public void testLdapDNBadHost2()
     {
         try
@@ -186,17 +190,18 @@
         }
         catch ( LdapURLEncodingException luee )
         {
-            Assert.assertTrue( true );
+            assertTrue( true );
             return;
         }
 
-        Assert.fail();
+        fail();;
     }
 
 
     /**
      * test a LdapURL with a bad host 3
      */
+    @Test
     public void testLdapDNBadHost3()
     {
         try
@@ -205,17 +210,18 @@
         }
         catch ( LdapURLEncodingException luee )
         {
-            Assert.assertTrue( true );
+            assertTrue( true );
             return;
         }
 
-        Assert.fail();
+        fail();;
     }
 
 
     /**
      * test a LdapURL with a bad host 4
      */
+    @Test
     public void testLdapDNBadHost4()
     {
         try
@@ -224,17 +230,18 @@
         }
         catch ( LdapURLEncodingException luee )
         {
-            Assert.assertTrue( true );
+            assertTrue( true );
             return;
         }
 
-        Assert.fail();
+        fail();;
     }
 
 
     /**
      * test a LdapURL with a bad host 5
      */
+    @Test
     public void testLdapDNBadHost5()
     {
         try
@@ -243,17 +250,18 @@
         }
         catch ( LdapURLEncodingException luee )
         {
-            Assert.assertTrue( true );
+            assertTrue( true );
             return;
         }
 
-        Assert.fail();
+        fail();;
     }
 
 
     /**
      * test a LdapURL with a bad host 6
      */
+    @Test
     public void testLdapDNBadHost6()
     {
         try
@@ -262,17 +270,18 @@
         }
         catch ( LdapURLEncodingException luee )
         {
-            Assert.assertTrue( true );
+            assertTrue( true );
             return;
         }
 
-        Assert.fail();
+        fail();;
     }
 
 
     /**
      * test a LdapURL with a bad host 7
      */
+    @Test
     public void testLdapDNBadHost7()
     {
         try
@@ -281,35 +290,38 @@
         }
         catch ( LdapURLEncodingException luee )
         {
-            Assert.assertTrue( true );
+            assertTrue( true );
             return;
         }
 
-        Assert.fail();
+        fail();;
     }
 
 
     /**
      * test a LdapURL IP host
      */
+    @Test
     public void testLdapDNIPHost() throws LdapURLEncodingException
     {
-        Assert.assertEquals( "ldap://1.2.3.4/", new LdapURL( "ldap://1.2.3.4/" ).toString() );
+        assertEquals( "ldap://1.2.3.4/", new LdapURL( "ldap://1.2.3.4/" ).toString() );
     }
 
 
     /**
      * test a LdapURL IP host and port
      */
+    @Test
     public void testLdapDNIPHostPort() throws LdapURLEncodingException
     {
-        Assert.assertEquals( "ldap://1.2.3.4:80/", new LdapURL( "ldap://1.2.3.4:80/" ).toString() );
+        assertEquals( "ldap://1.2.3.4:80/", new LdapURL( "ldap://1.2.3.4:80/" ).toString() );
     }
 
 
     /**
      * test a LdapURL with a bad IP host 1
      */
+    @Test
     public void testLdapDNBadHostIP1()
     {
         try
@@ -318,17 +330,18 @@
         }
         catch ( LdapURLEncodingException luee )
         {
-            Assert.assertTrue( true );
+            assertTrue( true );
             return;
         }
 
-        Assert.fail();
+        fail();;
     }
 
 
     /**
      * test a LdapURL with a bad IP host 2
      */
+    @Test
     public void testLdapDNBadHostIP2()
     {
         try
@@ -337,17 +350,18 @@
         }
         catch ( LdapURLEncodingException luee )
         {
-            Assert.assertTrue( true );
+            assertTrue( true );
             return;
         }
 
-        Assert.fail();
+        fail();;
     }
 
 
     /**
      * test a LdapURL with a bad IP host 3
      */
+    @Test
     public void testLdapDNBadHostIP3()
     {
         try
@@ -356,17 +370,18 @@
         }
         catch ( LdapURLEncodingException luee )
         {
-            Assert.assertTrue( true );
+            assertTrue( true );
             return;
         }
 
-        Assert.fail();
+        fail();;
     }
 
 
     /**
      * test a LdapURL with a bad IP host 4
      */
+    @Test
     public void testLdapDNBadHostIP4()
     {
         try
@@ -375,29 +390,31 @@
         }
         catch ( LdapURLEncodingException luee )
         {
-            Assert.assertTrue( true );
+            assertTrue( true );
             return;
         }
 
-        Assert.fail();
+        fail();;
     }
 
 
     /**
      * test a LdapURL with a valid host hich is not an IP
      */
+    @Test
     public void testLdapDNNotAnIP() throws LdapURLEncodingException
     {
-        Assert.assertEquals( "ldap://1.1.1.100000.a/", new LdapURL( "ldap://1.1.1.100000.a/" ).toString() );
+        assertEquals( "ldap://1.1.1.100000.a/", new LdapURL( "ldap://1.1.1.100000.a/" ).toString() );
     }
 
 
     /**
      * test a LdapURL with valid simpleDN
      */
+    @Test
     public void testLdapDNSimpleDN() throws LdapURLEncodingException
     {
-        Assert.assertEquals( "ldap://directory.apache.org:389/dc=example,dc=org/", new LdapURL(
+        assertEquals( "ldap://directory.apache.org:389/dc=example,dc=org/", new LdapURL(
             "ldap://directory.apache.org:389/dc=example,dc=org/" ).toString() );
     }
 
@@ -405,9 +422,10 @@
     /**
      * test a LdapURL with valid simpleDN 2
      */
+    @Test
     public void testLdapDNSimpleDN2() throws LdapURLEncodingException
     {
-        Assert.assertEquals( "ldap://directory.apache.org:389/dc=example", new LdapURL(
+        assertEquals( "ldap://directory.apache.org:389/dc=example", new LdapURL(
             "ldap://directory.apache.org:389/dc=example" ).toString() );
     }
 
@@ -415,9 +433,10 @@
     /**
      * test a LdapURL with a valid encoded DN
      */
+    @Test
     public void testLdapDNSimpleDNEncoded() throws LdapURLEncodingException
     {
-        Assert.assertEquals( "ldap://directory.apache.org:389/dc=example%202,dc=org", new LdapURL(
+        assertEquals( "ldap://directory.apache.org:389/dc=example%202,dc=org", new LdapURL(
             "ldap://directory.apache.org:389/dc=example%202,dc=org" ).toString() );
     }
 
@@ -425,6 +444,7 @@
     /**
      * test a LdapURL with an invalid DN
      */
+    @Test
     public void testLdapDNInvalidDN()
     {
         try
@@ -433,7 +453,7 @@
         }
         catch ( LdapURLEncodingException luee )
         {
-            Assert.assertTrue( true );
+            assertTrue( true );
             return;
         }
     }
@@ -442,6 +462,7 @@
     /**
      * test a LdapURL with an invalid DN 2
      */
+    @Test
     public void testLdapDNInvalidDN2()
     {
         try
@@ -450,7 +471,7 @@
         }
         catch ( LdapURLEncodingException luee )
         {
-            Assert.assertTrue( true );
+            assertTrue( true );
             return;
         }
     }
@@ -459,9 +480,10 @@
     /**
      * test a LdapURL with valid unique attributes
      */
+    @Test
     public void testLdapDNUniqueAttribute() throws LdapURLEncodingException
     {
-        Assert.assertEquals( "ldap://directory.apache.org:389/dc=example,dc=org?ou", new LdapURL(
+        assertEquals( "ldap://directory.apache.org:389/dc=example,dc=org?ou", new LdapURL(
             "ldap://directory.apache.org:389/dc=example,dc=org?ou" ).toString() );
     }
 
@@ -469,9 +491,10 @@
     /**
      * test a LdapURL with valid attributes
      */
+    @Test
     public void testLdapDNAttributes() throws LdapURLEncodingException
     {
-        Assert.assertEquals( "ldap://directory.apache.org:389/dc=example,dc=org?ou,objectclass,dc", new LdapURL(
+        assertEquals( "ldap://directory.apache.org:389/dc=example,dc=org?ou,objectclass,dc", new LdapURL(
             "ldap://directory.apache.org:389/dc=example,dc=org?ou,objectclass,dc" ).toString() );
     }
 
@@ -479,9 +502,10 @@
     /**
      * test a LdapURL with valid duplicated attributes
      */
+    @Test
     public void testLdapDNDuplicatedAttributes() throws LdapURLEncodingException
     {
-        Assert.assertEquals( "ldap://directory.apache.org:389/dc=example,dc=org?ou,dc", new LdapURL(
+        assertEquals( "ldap://directory.apache.org:389/dc=example,dc=org?ou,dc", new LdapURL(
             "ldap://directory.apache.org:389/dc=example,dc=org?ou,dc,ou" ).toString() );
     }
 
@@ -489,6 +513,7 @@
     /**
      * test a LdapURL with invalid attributes
      */
+    @Test
     public void testLdapInvalideAttributes()
     {
         try
@@ -497,7 +522,7 @@
         }
         catch ( LdapURLEncodingException luee )
         {
-            Assert.assertTrue( true );
+            assertTrue( true );
             return;
         }
     }
@@ -506,6 +531,7 @@
     /**
      * test a LdapURL with attributes but no DN
      */
+    @Test
     public void testLdapNoDNAttributes()
     {
         try
@@ -514,7 +540,7 @@
         }
         catch ( LdapURLEncodingException luee )
         {
-            Assert.assertTrue( true );
+            assertTrue( true );
             return;
         }
     }
@@ -523,9 +549,10 @@
     /**
      * test 1 from RFC 2255 LdapURL
      */
+    @Test
     public void testLdapRFC2255_1() throws LdapURLEncodingException
     {
-        Assert.assertEquals( "ldap:///o=University%20of%20Michigan,c=US", new LdapURL(
+        assertEquals( "ldap:///o=University%20of%20Michigan,c=US", new LdapURL(
             "ldap:///o=University%20of%20Michigan,c=US" ).toString() );
     }
 
@@ -533,9 +560,10 @@
     /**
      * test 2 from RFC 2255 LdapURL
      */
+    @Test
     public void testLdapRFC2255_2() throws LdapURLEncodingException
     {
-        Assert.assertEquals( "ldap://ldap.itd.umich.edu/o=University%20of%20Michigan,c=US", new LdapURL(
+        assertEquals( "ldap://ldap.itd.umich.edu/o=University%20of%20Michigan,c=US", new LdapURL(
             "ldap://ldap.itd.umich.edu/o=University%20of%20Michigan,c=US" ).toString() );
     }
 
@@ -543,9 +571,10 @@
     /**
      * test 3 from RFC 2255 LdapURL
      */
+    @Test
     public void testLdapRFC2255_3() throws LdapURLEncodingException
     {
-        Assert.assertEquals( "ldap://ldap.itd.umich.edu/o=University%20of%20Michigan,c=US?postalAddress", new LdapURL(
+        assertEquals( "ldap://ldap.itd.umich.edu/o=University%20of%20Michigan,c=US?postalAddress", new LdapURL(
             "ldap://ldap.itd.umich.edu/o=University%20of%20Michigan,c=US?postalAddress" ).toString() );
     }
 
@@ -553,9 +582,10 @@
     /**
      * test 4 from RFC 2255 LdapURL
      */
+    @Test
     public void testLdapRFC2255_4() throws LdapURLEncodingException
     {
-        Assert.assertEquals( "ldap://host.com:6666/o=University%20of%20Michigan,c=US??sub?(cn=Babs%20Jensen)",
+        assertEquals( "ldap://host.com:6666/o=University%20of%20Michigan,c=US??sub?(cn=Babs%20Jensen)",
             new LdapURL( "ldap://host.com:6666/o=University%20of%20Michigan,c=US??sub?(cn=Babs%20Jensen)" ).toString() );
     }
 
@@ -563,9 +593,10 @@
     /**
      * test 5 from RFC 2255 LdapURL
      */
+    @Test
     public void testLdapRFC2255_5() throws LdapURLEncodingException
     {
-        Assert.assertEquals( "ldap://ldap.itd.umich.edu/c=GB?objectClass?one", new LdapURL(
+        assertEquals( "ldap://ldap.itd.umich.edu/c=GB?objectClass?one", new LdapURL(
             "ldap://ldap.itd.umich.edu/c=GB?objectClass?one" ).toString() );
     }
 
@@ -573,9 +604,10 @@
     /**
      * test 6 from RFC 2255 LdapURL
      */
+    @Test
     public void testLdapRFC2255_6() throws LdapURLEncodingException
     {
-        Assert.assertEquals( "ldap://ldap.question.com/o=Question%3f,c=US?mail", new LdapURL(
+        assertEquals( "ldap://ldap.question.com/o=Question%3f,c=US?mail", new LdapURL(
             "ldap://ldap.question.com/o=Question%3f,c=US?mail" ).toString() );
     }
 
@@ -583,9 +615,10 @@
     /**
      * test 7 from RFC 2255 LdapURL
      */
+    @Test
     public void testLdapRFC2255_7() throws LdapURLEncodingException
     {
-        Assert.assertEquals( "ldap://ldap.netscape.com/o=Babsco,c=US???(int=%5c00%5c00%5c00%5c04)", new LdapURL(
+        assertEquals( "ldap://ldap.netscape.com/o=Babsco,c=US???(int=%5c00%5c00%5c00%5c04)", new LdapURL(
             "ldap://ldap.netscape.com/o=Babsco,c=US???(int=%5c00%5c00%5c00%5c04)" ).toString() );
     }
 
@@ -593,9 +626,10 @@
     /**
      * test 8 from RFC 2255 LdapURL
      */
+    @Test
     public void testLdapRFC2255_8() throws LdapURLEncodingException
     {
-        Assert.assertEquals( "ldap:///??sub??bindname=cn=Manager%2co=Foo", new LdapURL(
+        assertEquals( "ldap:///??sub??bindname=cn=Manager%2co=Foo", new LdapURL(
             "ldap:///??sub??bindname=cn=Manager%2co=Foo" ).toString() );
     }
 
@@ -603,9 +637,10 @@
     /**
      * test 9 from RFC 2255 LdapURL
      */
+    @Test
     public void testLdapRFC2255_9() throws LdapURLEncodingException
     {
-        Assert.assertEquals( "ldap:///??sub??!bindname=cn=Manager%2co=Foo", new LdapURL(
+        assertEquals( "ldap:///??sub??!bindname=cn=Manager%2co=Foo", new LdapURL(
             "ldap:///??sub??!bindname=cn=Manager%2co=Foo" ).toString() );
     }
 
@@ -613,18 +648,20 @@
     /**
      * test an empty ldaps:// LdapURL
      */
+    @Test
     public void testLdapDNEmptyLdaps() throws LdapURLEncodingException
     {
-        Assert.assertEquals( "ldaps:///", new LdapURL( "ldaps:///" ).toString() );
+        assertEquals( "ldaps:///", new LdapURL( "ldaps:///" ).toString() );
     }
 
 
     /**
      * test an simple ldaps:// LdapURL
      */
+    @Test
     public void testLdapDNSimpleLdaps() throws LdapURLEncodingException
     {
-        Assert.assertEquals( "ldaps://directory.apache.org:80/", new LdapURL( "ldaps://directory.apache.org:80/" )
+        assertEquals( "ldaps://directory.apache.org:80/", new LdapURL( "ldaps://directory.apache.org:80/" )
             .toString() );
     }
 
@@ -632,160 +669,167 @@
     /**
      * test the setScheme() method
      */
+    @Test
     public void testLdapDNSetScheme() throws LdapURLEncodingException
     {
         LdapURL url = new LdapURL();
-        Assert.assertEquals( "ldap://", url.getScheme() );
+        assertEquals( "ldap://", url.getScheme() );
 
         url.setScheme( "invalid" );
-        Assert.assertEquals( "ldap://", url.getScheme() );
+        assertEquals( "ldap://", url.getScheme() );
 
         url.setScheme( "ldap://" );
-        Assert.assertEquals( "ldap://", url.getScheme() );
+        assertEquals( "ldap://", url.getScheme() );
 
         url.setScheme( "ldaps://" );
-        Assert.assertEquals( "ldaps://", url.getScheme() );
+        assertEquals( "ldaps://", url.getScheme() );
 
         url.setScheme( null );
-        Assert.assertEquals( "ldap://", url.getScheme() );
+        assertEquals( "ldap://", url.getScheme() );
     }
 
 
     /**
      * test the setHost() method
      */
+    @Test
     public void testLdapDNSetHost() throws LdapURLEncodingException
     {
         LdapURL url = new LdapURL();
-        Assert.assertNull( url.getHost() );
+        assertNull( url.getHost() );
 
         url.setHost( "ldap.apache.org" );
-        Assert.assertEquals( "ldap.apache.org", url.getHost() );
-        Assert.assertEquals( "ldap://ldap.apache.org/", url.toString() );
+        assertEquals( "ldap.apache.org", url.getHost() );
+        assertEquals( "ldap://ldap.apache.org/", url.toString() );
 
         url.setHost( null );
-        Assert.assertNull( url.getHost() );
-        Assert.assertEquals( "ldap:///", url.toString() );
+        assertNull( url.getHost() );
+        assertEquals( "ldap:///", url.toString() );
     }
 
 
     /**
      * test the setPort() method
      */
+    @Test
     public void testLdapDNSetPort() throws LdapURLEncodingException
     {
         LdapURL url = new LdapURL();
-        Assert.assertEquals( -1, url.getPort() );
+        assertEquals( -1, url.getPort() );
 
         url.setPort( 389 );
-        Assert.assertEquals( 389, url.getPort() );
-        Assert.assertEquals( "ldap://:389/", url.toString() );
+        assertEquals( 389, url.getPort() );
+        assertEquals( "ldap://:389/", url.toString() );
 
         url.setPort( 0 );
-        Assert.assertEquals( -1, url.getPort() );
-        Assert.assertEquals( "ldap:///", url.toString() );
+        assertEquals( -1, url.getPort() );
+        assertEquals( "ldap:///", url.toString() );
 
         url.setPort( 65536 );
-        Assert.assertEquals( -1, url.getPort() );
-        Assert.assertEquals( "ldap:///", url.toString() );
+        assertEquals( -1, url.getPort() );
+        assertEquals( "ldap:///", url.toString() );
     }
 
 
     /**
      * test the setDn() method
      */
+    @Test
     public void testLdapDNSetDn() throws LdapURLEncodingException, InvalidNameException
     {
         LdapURL url = new LdapURL();
-        Assert.assertNull( url.getDn() );
+        assertNull( url.getDn() );
 
         LdapDN dn = new LdapDN( "dc=example,dc=com" );
         url.setDn( dn );
-        Assert.assertEquals( dn, url.getDn() );
-        Assert.assertEquals( "ldap:///dc=example,dc=com", url.toString() );
+        assertEquals( dn, url.getDn() );
+        assertEquals( "ldap:///dc=example,dc=com", url.toString() );
 
         url.setDn( null );
-        Assert.assertNull( url.getDn() );
-        Assert.assertEquals( "ldap:///", url.toString() );
+        assertNull( url.getDn() );
+        assertEquals( "ldap:///", url.toString() );
     }
 
 
     /**
      * test the setAttributes() method
      */
+    @Test
     public void testLdapDNSetAttributes() throws LdapURLEncodingException, InvalidNameException
     {
         LdapURL url = new LdapURL();
-        Assert.assertNotNull( url.getAttributes() );
-        Assert.assertTrue( url.getAttributes().isEmpty() );
+        assertNotNull( url.getAttributes() );
+        assertTrue( url.getAttributes().isEmpty() );
 
         List<String> attributes = new ArrayList<String>();
         url.setDn( new LdapDN( "dc=example,dc=com" ) );
 
         url.setAttributes( null );
-        Assert.assertNotNull( url.getAttributes() );
-        Assert.assertTrue( url.getAttributes().isEmpty() );
-        Assert.assertEquals( "ldap:///dc=example,dc=com", url.toString() );
+        assertNotNull( url.getAttributes() );
+        assertTrue( url.getAttributes().isEmpty() );
+        assertEquals( "ldap:///dc=example,dc=com", url.toString() );
 
         attributes.add( "cn" );
         url.setAttributes( attributes );
-        Assert.assertNotNull( url.getAttributes() );
-        Assert.assertEquals( 1, url.getAttributes().size() );
-        Assert.assertEquals( "ldap:///dc=example,dc=com?cn", url.toString() );
+        assertNotNull( url.getAttributes() );
+        assertEquals( 1, url.getAttributes().size() );
+        assertEquals( "ldap:///dc=example,dc=com?cn", url.toString() );
 
         attributes.add( "userPassword;binary" );
         url.setAttributes( attributes );
-        Assert.assertNotNull( url.getAttributes() );
-        Assert.assertEquals( 2, url.getAttributes().size() );
-        Assert.assertEquals( "ldap:///dc=example,dc=com?cn,userPassword;binary", url.toString() );
+        assertNotNull( url.getAttributes() );
+        assertEquals( 2, url.getAttributes().size() );
+        assertEquals( "ldap:///dc=example,dc=com?cn,userPassword;binary", url.toString() );
     }
 
 
     /**
      * test the setScope() method
      */
+    @Test
     public void testLdapDNSetScope() throws LdapURLEncodingException, InvalidNameException
     {
         LdapURL url = new LdapURL();
-        Assert.assertEquals( SearchControls.OBJECT_SCOPE, url.getScope() );
+        assertEquals( SearchControls.OBJECT_SCOPE, url.getScope() );
 
         url.setDn( new LdapDN( "dc=example,dc=com" ) );
 
         url.setScope( SearchControls.ONELEVEL_SCOPE );
-        Assert.assertEquals( SearchControls.ONELEVEL_SCOPE, url.getScope() );
-        Assert.assertEquals( "ldap:///dc=example,dc=com??one", url.toString() );
+        assertEquals( SearchControls.ONELEVEL_SCOPE, url.getScope() );
+        assertEquals( "ldap:///dc=example,dc=com??one", url.toString() );
 
         url.setScope( SearchControls.SUBTREE_SCOPE );
-        Assert.assertEquals( SearchControls.SUBTREE_SCOPE, url.getScope() );
-        Assert.assertEquals( "ldap:///dc=example,dc=com??sub", url.toString() );
+        assertEquals( SearchControls.SUBTREE_SCOPE, url.getScope() );
+        assertEquals( "ldap:///dc=example,dc=com??sub", url.toString() );
 
         url.setScope( -1 );
-        Assert.assertEquals( SearchControls.OBJECT_SCOPE, url.getScope() );
-        Assert.assertEquals( "ldap:///dc=example,dc=com", url.toString() );
+        assertEquals( SearchControls.OBJECT_SCOPE, url.getScope() );
+        assertEquals( "ldap:///dc=example,dc=com", url.toString() );
     }
 
 
     /**
      * test the setFilter() method
      */
+    @Test
     public void testLdapDNSetFilter() throws LdapURLEncodingException, InvalidNameException
     {
         LdapURL url = new LdapURL();
-        Assert.assertNull( url.getFilter() );
+        assertNull( url.getFilter() );
 
         url.setDn( new LdapDN( "dc=example,dc=com" ) );
 
         url.setFilter( "(objectClass=person)" );
-        Assert.assertEquals( "(objectClass=person)", url.getFilter() );
-        Assert.assertEquals( "ldap:///dc=example,dc=com???(objectClass=person)", url.toString() );
+        assertEquals( "(objectClass=person)", url.getFilter() );
+        assertEquals( "ldap:///dc=example,dc=com???(objectClass=person)", url.toString() );
 
         url.setFilter( "(cn=Babs Jensen)" );
-        Assert.assertEquals( "(cn=Babs Jensen)", url.getFilter() );
-        Assert.assertEquals( "ldap:///dc=example,dc=com???(cn=Babs%20Jensen)", url.toString() );
+        assertEquals( "(cn=Babs Jensen)", url.getFilter() );
+        assertEquals( "ldap:///dc=example,dc=com???(cn=Babs%20Jensen)", url.toString() );
 
         url.setFilter( null );
-        Assert.assertNull( url.getFilter() );
-        Assert.assertEquals( "ldap:///dc=example,dc=com", url.toString() );
+        assertNull( url.getFilter() );
+        assertEquals( "ldap:///dc=example,dc=com", url.toString() );
     }
 
 

Modified: directory/shared/branches/shared-replication/ldap/src/test/java/org/apache/directory/shared/ldap/util/NamespaceToolsTest.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-replication/ldap/src/test/java/org/apache/directory/shared/ldap/util/NamespaceToolsTest.java?rev=754728&r1=754727&r2=754728&view=diff
==============================================================================
--- directory/shared/branches/shared-replication/ldap/src/test/java/org/apache/directory/shared/ldap/util/NamespaceToolsTest.java (original)
+++ directory/shared/branches/shared-replication/ldap/src/test/java/org/apache/directory/shared/ldap/util/NamespaceToolsTest.java Sun Mar 15 19:17:57 2009
@@ -20,53 +20,60 @@
 package org.apache.directory.shared.ldap.util;
 
 
-import junit.framework.Assert;
-import junit.framework.TestCase;
-
 import javax.naming.Name;
 import javax.naming.NamingException;
 
 import org.apache.directory.shared.ldap.name.LdapDN;
 import org.apache.directory.shared.ldap.util.NamespaceTools;
+import org.junit.Test;
 
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.assertFalse;
 
 /**
  * Test the NameToolsTest class
  * 
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  */
-public class NamespaceToolsTest extends TestCase
+public class NamespaceToolsTest
 {
+    @Test
     public void testNullRealm()
     {
-        Assert.assertEquals( "", NamespaceTools.inferLdapName( null ) );
+        assertEquals( "", NamespaceTools.inferLdapName( null ) );
     }
 
 
+    @Test
     public void testEmptyRealm()
     {
-        Assert.assertEquals( "", NamespaceTools.inferLdapName( "" ) );
+        assertEquals( "", NamespaceTools.inferLdapName( "" ) );
     }
 
 
+    @Test
     public void testSingleElemRealm()
     {
-        Assert.assertEquals( "dc=test", NamespaceTools.inferLdapName( "test" ) );
+        assertEquals( "dc=test", NamespaceTools.inferLdapName( "test" ) );
     }
 
 
+    @Test
     public void testTwoElemsRealm()
     {
-        Assert.assertEquals( "dc=test,dc=com", NamespaceTools.inferLdapName( "test.com" ) );
+        assertEquals( "dc=test,dc=com", NamespaceTools.inferLdapName( "test.com" ) );
     }
 
 
+    @Test
     public void testFullRealm()
     {
-        Assert.assertEquals( "dc=CS,dc=UCL,dc=AC,dc=UK", NamespaceTools.inferLdapName( "CS.UCL.AC.UK" ) );
+        assertEquals( "dc=CS,dc=UCL,dc=AC,dc=UK", NamespaceTools.inferLdapName( "CS.UCL.AC.UK" ) );
     }
 
 
+    @Test
     public void testHasCompositeComponents() throws NamingException
     {
         assertTrue( NamespaceTools.hasCompositeComponents( "givenName=Alex+sn=Karasulu" ) );
@@ -76,6 +83,7 @@
     }
 
 
+    @Test
     public void testGetCompositeComponents() throws NamingException
     {
         String[] args = NamespaceTools.getCompositeComponents( "givenName=Alex+sn=Karasulu" );
@@ -99,6 +107,7 @@
     }
     
     
+    @Test
     public void testGetRelativeName() throws NamingException
     {
         // test the basis case first with the root

Modified: directory/shared/branches/shared-replication/ldap/src/test/java/org/apache/directory/shared/ldap/util/StringToolsTest.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-replication/ldap/src/test/java/org/apache/directory/shared/ldap/util/StringToolsTest.java?rev=754728&r1=754727&r2=754728&view=diff
==============================================================================
--- directory/shared/branches/shared-replication/ldap/src/test/java/org/apache/directory/shared/ldap/util/StringToolsTest.java (original)
+++ directory/shared/branches/shared-replication/ldap/src/test/java/org/apache/directory/shared/ldap/util/StringToolsTest.java Sun Mar 15 19:17:57 2009
@@ -29,9 +29,12 @@
 import javax.naming.NamingException;
 
 import org.apache.directory.shared.ldap.util.StringTools;
+import org.junit.Test;
 
-import junit.framework.Assert;
-import junit.framework.TestCase;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.fail;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.assertFalse;
 
 
 /**
@@ -40,8 +43,9 @@
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  * @version $Rev$
  */
-public class StringToolsTest extends TestCase
+public class StringToolsTest
 {
+    @Test
     public void testDecodeEscapedHex() throws Exception
     {
         assertEquals( "Ferry", StringTools.decodeEscapedHex( "\\46\\65\\72\\72\\79" ) );
@@ -50,6 +54,7 @@
         assertEquals( "Ferry", StringTools.decodeEscapedHex( "Fe\\72ry" ) );
     }
     
+    @Test
     public void testDecodeHexString() throws Exception
     {
         // weird stuff - corner cases
@@ -62,6 +67,7 @@
     }
     
     
+    @Test
     public void testTrimConsecutiveToOne()
     {
         String input = null;
@@ -94,77 +100,86 @@
     }
 
 
+    @Test
     public void testOneByteChar()
     {
         char res = StringTools.bytesToChar( new byte[]
             { 0x30 } );
 
-        Assert.assertEquals( '0', res );
+        assertEquals( '0', res );
     }
 
 
+    @Test
     public void testOneByteChar00()
     {
         char res = StringTools.bytesToChar( new byte[]
             { 0x00 } );
 
-        Assert.assertEquals( 0x00, res );
+        assertEquals( 0x00, res );
     }
 
 
+    @Test
     public void testOneByteChar7F()
     {
         char res = StringTools.bytesToChar( new byte[]
             { 0x7F } );
 
-        Assert.assertEquals( 0x7F, res );
+        assertEquals( 0x7F, res );
     }
 
 
+    @Test
     public void testTwoBytesChar()
     {
         char res = StringTools.bytesToChar( new byte[]
             { ( byte ) 0xCE, ( byte ) 0x91 } );
 
-        Assert.assertEquals( 0x0391, res );
+        assertEquals( 0x0391, res );
     }
 
 
+    @Test
     public void testThreeBytesChar()
     {
         char res = StringTools.bytesToChar( new byte[]
             { ( byte ) 0xE2, ( byte ) 0x89, ( byte ) 0xA2 } );
 
-        Assert.assertEquals( 0x2262, res );
+        assertEquals( 0x2262, res );
     }
 
 
+    @Test
     public void testcharToBytesOne()
     {
-        Assert.assertEquals( "0x00 ", StringTools.dumpBytes( StringTools.charToBytes( ( char ) 0x0000 ) ) );
-        Assert.assertEquals( "0x61 ", StringTools.dumpBytes( StringTools.charToBytes( 'a' ) ) );
-        Assert.assertEquals( "0x7F ", StringTools.dumpBytes( StringTools.charToBytes( ( char ) 0x007F ) ) );
+        assertEquals( "0x00 ", StringTools.dumpBytes( StringTools.charToBytes( ( char ) 0x0000 ) ) );
+        assertEquals( "0x61 ", StringTools.dumpBytes( StringTools.charToBytes( 'a' ) ) );
+        assertEquals( "0x7F ", StringTools.dumpBytes( StringTools.charToBytes( ( char ) 0x007F ) ) );
     }
 
 
+    @Test
     public void testcharToBytesTwo()
     {
-        Assert.assertEquals( "0xC2 0x80 ", StringTools.dumpBytes( StringTools.charToBytes( ( char ) 0x0080 ) ) );
-        Assert.assertEquals( "0xC3 0xBF ", StringTools.dumpBytes( StringTools.charToBytes( ( char ) 0x00FF ) ) );
-        Assert.assertEquals( "0xC4 0x80 ", StringTools.dumpBytes( StringTools.charToBytes( ( char ) 0x0100 ) ) );
-        Assert.assertEquals( "0xDF 0xBF ", StringTools.dumpBytes( StringTools.charToBytes( ( char ) 0x07FF ) ) );
+        assertEquals( "0xC2 0x80 ", StringTools.dumpBytes( StringTools.charToBytes( ( char ) 0x0080 ) ) );
+        assertEquals( "0xC3 0xBF ", StringTools.dumpBytes( StringTools.charToBytes( ( char ) 0x00FF ) ) );
+        assertEquals( "0xC4 0x80 ", StringTools.dumpBytes( StringTools.charToBytes( ( char ) 0x0100 ) ) );
+        assertEquals( "0xDF 0xBF ", StringTools.dumpBytes( StringTools.charToBytes( ( char ) 0x07FF ) ) );
     }
 
 
+    @Test
     public void testcharToBytesThree()
     {
-        Assert.assertEquals( "0xE0 0xA0 0x80 ", StringTools.dumpBytes( StringTools.charToBytes( ( char ) 0x0800 ) ) );
-        Assert.assertEquals( "0xE0 0xBF 0xBF ", StringTools.dumpBytes( StringTools.charToBytes( ( char ) 0x0FFF ) ) );
-        Assert.assertEquals( "0xE1 0x80 0x80 ", StringTools.dumpBytes( StringTools.charToBytes( ( char ) 0x1000 ) ) );
-        Assert.assertEquals( "0xEF 0xBF 0xBF ", StringTools.dumpBytes( StringTools.charToBytes( ( char ) 0xFFFF ) ) );
+        assertEquals( "0xE0 0xA0 0x80 ", StringTools.dumpBytes( StringTools.charToBytes( ( char ) 0x0800 ) ) );
+        assertEquals( "0xE0 0xBF 0xBF ", StringTools.dumpBytes( StringTools.charToBytes( ( char ) 0x0FFF ) ) );
+        assertEquals( "0xE1 0x80 0x80 ", StringTools.dumpBytes( StringTools.charToBytes( ( char ) 0x1000 ) ) );
+        assertEquals( "0xEF 0xBF 0xBF ", StringTools.dumpBytes( StringTools.charToBytes( ( char ) 0xFFFF ) ) );
     }
 
 
+    @Test
     public void testListToString()
     {
         List<String> list = new ArrayList<String>();
@@ -173,10 +188,11 @@
         list.add( "elem2" );
         list.add( "elem3" );
 
-        Assert.assertEquals( "elem1, elem2, elem3", StringTools.listToString( list ) );
+        assertEquals( "elem1, elem2, elem3", StringTools.listToString( list ) );
     }
 
 
+    @Test
     public void testMapToString()
     {
         class Value
@@ -214,10 +230,11 @@
             || "elem3 = '[name3, 3]', elem1 = '[name1, 1]', elem2 = '[name2, 2]'".equals( result )
             || "elem3 = '[name3, 3]', elem2 = '[name2, 2]', elem1 = '[name1, 1]'".equals( result );
 
-        Assert.assertTrue( res );
+        assertTrue( res );
     }
 
 
+    @Test
     public void testGetRegexpEmpty() throws Exception
     {
         Pattern pattern = StringTools.getRegex( "", new String[]
@@ -229,6 +246,7 @@
     }
 
 
+    @Test
     public void testGetRegexpInitial() throws Exception
     {
         Pattern pattern = StringTools.getRegex( "Test", new String[]
@@ -244,6 +262,7 @@
     }
 
 
+    @Test
     public void testGetRegexpFinal() throws Exception
     {
         Pattern pattern = StringTools.getRegex( "", new String[]
@@ -259,6 +278,7 @@
     }
 
 
+    @Test
     public void testGetRegexpAny() throws Exception
     {
         Pattern pattern = StringTools.getRegex( "", new String[]
@@ -274,6 +294,7 @@
     }
 
 
+    @Test
     public void testGetRegexpFull() throws Exception
     {
         Pattern pattern = StringTools.getRegex( "Test", new String[]
@@ -292,6 +313,7 @@
     /**
      * Tests StringTools.getRegex() with some LDAP filter special characters.
      */
+    @Test
     public void testGetRegexpWithLdapFilterSpecialChars() throws Exception
     {
         Pattern[] patterns = new Pattern[]
@@ -312,6 +334,7 @@
     }
 
 
+    @Test
     public void testDeepTrim()
     {
         assertEquals( "", StringTools.deepTrim( " ", false ) );
@@ -329,6 +352,7 @@
         assertEquals( "a b", StringTools.deepTrim( "a b ", false ) );
     }
 
+    @Test
     public void testTrim()
     {
         assertEquals( "", StringTools.trim( (String)null ) );
@@ -340,6 +364,7 @@
         assertEquals( "a", StringTools.trim( "  a  " ) );
     }
 
+    @Test
     public void testTrimLeft()
     {
         assertEquals( "", StringTools.trimLeft( (String)null ) );
@@ -351,6 +376,7 @@
         assertEquals( "a  ", StringTools.trimLeft( "  a  " ) );
     }
 
+    @Test
     public void testTrimRight()
     {
         assertEquals( "", StringTools.trimRight( (String)null ) );



Mime
View raw message