harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mloe...@apache.org
Subject svn commit: r512225 - in /harmony/enhanced/classlib/trunk/modules/jndi/src: main/java/javax/naming/ldap/ test/java/org/apache/harmony/jndi/tests/javax/naming/ldap/ test/java/org/apache/harmony/jndi/tests/javax/naming/ldap/main/
Date Tue, 27 Feb 2007 11:50:28 GMT
Author: mloenko
Date: Tue Feb 27 03:50:21 2007
New Revision: 512225

URL: http://svn.apache.org/viewvc?view=rev&rev=512225
Log:
fix style; merge the tests

Removed:
    harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/org/apache/harmony/jndi/tests/javax/naming/ldap/TestBasicControl.java
Modified:
    harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/javax/naming/ldap/BasicControl.java
    harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/org/apache/harmony/jndi/tests/javax/naming/ldap/BasicControlTest.java
    harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/org/apache/harmony/jndi/tests/javax/naming/ldap/main/AllTestLdap.java

Modified: harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/javax/naming/ldap/BasicControl.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/javax/naming/ldap/BasicControl.java?view=diff&rev=512225&r1=512224&r2=512225
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/javax/naming/ldap/BasicControl.java
(original)
+++ harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/javax/naming/ldap/BasicControl.java
Tue Feb 27 03:50:21 2007
@@ -14,6 +14,7 @@
  *  See the License for the specific language governing permissions and 
  *  limitations under the License. 
  */ 
+
 package javax.naming.ldap;
 
 import javax.naming.ldap.Control;

Modified: harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/org/apache/harmony/jndi/tests/javax/naming/ldap/BasicControlTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/org/apache/harmony/jndi/tests/javax/naming/ldap/BasicControlTest.java?view=diff&rev=512225&r1=512224&r2=512225
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/org/apache/harmony/jndi/tests/javax/naming/ldap/BasicControlTest.java
(original)
+++ harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/org/apache/harmony/jndi/tests/javax/naming/ldap/BasicControlTest.java
Tue Feb 27 03:50:21 2007
@@ -18,78 +18,71 @@
 package org.apache.harmony.jndi.tests.javax.naming.ldap;
 
 import javax.naming.ldap.BasicControl;
-import javax.naming.ldap.Control;
+
 import junit.framework.TestCase;
 
 public class BasicControlTest extends TestCase {
-    /**
-     * Test method for
-     * {@link javax.naming.ldap.BasicControl#BasicControl(java.lang.String)}.
-     */
-    public void testBasicControlString() {
-        BasicControl bc = new BasicControl("fixture");
-        assertEquals("fixture", bc.getID());
-    }
 
     /**
-     * Test method for
-     * {@link javax.naming.ldap.BasicControl#BasicControl(java.lang.String, boolean, byte[])}.
+     * <p>
+     * Test method for 'javax.naming.ldap.BasicControl.BasicControl'
+     * </p>
      */
-    public void testBasicControlStringBooleanByteArray() {
-        byte[] fixture = new byte[] { 0, 1 };
-        BasicControl bc = new BasicControl("fixture", Control.CRITICAL, fixture);
-        assertEquals("fixture", bc.getID());
-        assertEquals(Control.CRITICAL, bc.isCritical());
-        // spec says the byte[] is NOT copied
-        assertSame(fixture, bc.getEncodedValue());
+    public void testBasicControl() {
+        // no exceptions expected
+        new BasicControl(null);
+        new BasicControl("");
+        new BasicControl("1.2.3.333");
+        new BasicControl("", true, null);
+        new BasicControl("", false, new byte[0]);
+        new BasicControl(null, false, null);
     }
 
     /**
-     * Test method for {@link javax.naming.ldap.BasicControl#getEncodedValue()}.
+     * Test method for {@link javax.naming.ldap.BasicControl#isCritical()}.
      */
-    public void testGetEncodedValue() {
+    public void testIsCritical() {
         BasicControl bc = new BasicControl("fixture");
-        assertNull(bc.getEncodedValue());
-        byte[] fixture = new byte[] { 0, 1 };
-        bc = new BasicControl("fixture", Control.CRITICAL, fixture);
-        // spec says the byte[] is NOT copied
-        assertSame(fixture, bc.getEncodedValue());
-        
-        // spec says that byte[] isn't copied and can be changed
-        fixture[0] = Byte.MIN_VALUE;
-        fixture[1] = Byte.MAX_VALUE;
-        assertEquals(Byte.MIN_VALUE, bc.getEncodedValue()[0]);
-        assertEquals(Byte.MAX_VALUE, bc.getEncodedValue()[1]);
+        assertFalse(bc.isCritical());
+
+        bc = new BasicControl(null, false, null);
+        assertFalse(bc.isCritical());
+
+        bc = new BasicControl(null, true, null);
+        assertTrue(bc.isCritical());
     }
 
     /**
-     * Test method for {@link javax.naming.ldap.BasicControl#getID()}.
+     * @tests javax.naming.ldap.BasicControl#getID()
      */
     public void testGetID() {
-        BasicControl bc = new BasicControl("fixture");
-        assertEquals("fixture", bc.getID());
-        
-        bc = new BasicControl(null);
-        assertNull(bc.getID());
-        
-        bc = new BasicControl("");
-        assertEquals("", bc.getID());
-        
-        bc = new BasicControl(null, false, null);
-        assertNull(bc.getID());
+        String ID = "somestring";
+        assertSame(ID, new BasicControl(ID).getID());
+
+        assertNull(new BasicControl(null).getID());
+
+        assertNull(new BasicControl(null, false, new byte[1]).getID());
     }
 
     /**
-     * Test method for {@link javax.naming.ldap.BasicControl#isCritical()}.
+     * <p>
+     * Test method for 'javax.naming.ldap.BasicControl.getEncodedValue()'
+     * </p>
+     * <p>
+     * Here we are testing the return method of the encoded value of
+     * BasicControl. In this case we send an encoded value null.
+     * </p>
+     * <p>
+     * The expected result is a null encoded value.
+     * </p>
      */
-    public void testIsCritical() {
-        BasicControl bc = new BasicControl("fixture");
-        assertFalse(bc.isCritical());
-        
-        bc = new BasicControl(null, false, null);
-        assertFalse(bc.isCritical());
-        
-        bc = new BasicControl(null, true, null);
-        assertTrue(bc.isCritical());
+    public void testGetEncodedValue() {
+        assertNull(new BasicControl("control", true, null).getEncodedValue());
+
+        // spec says the byte[] is NOT copied
+        byte[] test = new byte[15];
+        BasicControl bc = new BasicControl("control", true, test);
+        assertSame(test, bc.getEncodedValue());
     }
+
 }

Modified: harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/org/apache/harmony/jndi/tests/javax/naming/ldap/main/AllTestLdap.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/org/apache/harmony/jndi/tests/javax/naming/ldap/main/AllTestLdap.java?view=diff&rev=512225&r1=512224&r2=512225
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/org/apache/harmony/jndi/tests/javax/naming/ldap/main/AllTestLdap.java
(original)
+++ harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/org/apache/harmony/jndi/tests/javax/naming/ldap/main/AllTestLdap.java
Tue Feb 27 03:50:21 2007
@@ -22,14 +22,16 @@
  */
 package org.apache.harmony.jndi.tests.javax.naming.ldap.main;
 
+import junit.framework.Test;
+import junit.framework.TestSuite;
+
 import org.apache.harmony.jndi.tests.javax.naming.ldap.LdapNameTest;
-import org.apache.harmony.jndi.tests.javax.naming.ldap.TestBasicControl;
+import org.apache.harmony.jndi.tests.javax.naming.ldap.RdnTest;
 import org.apache.harmony.jndi.tests.javax.naming.ldap.TestControlFactory;
 import org.apache.harmony.jndi.tests.javax.naming.ldap.TestInitialLdapContext;
 import org.apache.harmony.jndi.tests.javax.naming.ldap.TestManageReferralControl;
 import org.apache.harmony.jndi.tests.javax.naming.ldap.TestPagedResultsControls;
 import org.apache.harmony.jndi.tests.javax.naming.ldap.TestPagedResultsResponseControl;
-import org.apache.harmony.jndi.tests.javax.naming.ldap.RdnTest;
 import org.apache.harmony.jndi.tests.javax.naming.ldap.TestSortControl;
 import org.apache.harmony.jndi.tests.javax.naming.ldap.TestSortKey;
 import org.apache.harmony.jndi.tests.javax.naming.ldap.TestSortResponseControl;
@@ -44,8 +46,6 @@
 import org.apache.harmony.jndi.tests.javax.naming.ldap.whitebox.TestLdapReferralException;
 import org.apache.harmony.jndi.tests.javax.naming.ldap.whitebox.TestRdnWhiteBoxDevelopment;
 import org.apache.harmony.jndi.tests.javax.naming.ldap.whitebox.TestStartTlsRequestWhiteBoxDevelopment;
-import junit.framework.Test;
-import junit.framework.TestSuite;
 
 /**
  * <p>This class runs all test of the package javax.naming.ldap</p>
@@ -67,7 +67,6 @@
 	     */
 	    public static Test suite() {
 	        TestSuite suite = new TestSuite("Test for javax.naming.ldap");
-	        suite.addTest(new TestSuite(TestBasicControl.class));
 	        suite.addTest(new TestSuite(TestControlFactory.class));
 	        suite.addTest(new TestSuite(TestInitialLdapContext.class));
 	        suite.addTest(new TestSuite(TestManageReferralControl.class));



Mime
View raw message