harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From smish...@apache.org
Subject svn commit: r393431 - /incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/java/common/org/apache/harmony/security/asn1/der/BooleanTest.java
Date Wed, 12 Apr 2006 10:36:22 GMT
Author: smishura
Date: Wed Apr 12 03:36:17 2006
New Revision: 393431

URL: http://svn.apache.org/viewcvs?rev=393431&view=rev
Log:
Minor update for ASN.1 BooleanTest

Modified:
    incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/java/common/org/apache/harmony/security/asn1/der/BooleanTest.java

Modified: incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/java/common/org/apache/harmony/security/asn1/der/BooleanTest.java
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/java/common/org/apache/harmony/security/asn1/der/BooleanTest.java?rev=393431&r1=393430&r2=393431&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/java/common/org/apache/harmony/security/asn1/der/BooleanTest.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/java/common/org/apache/harmony/security/asn1/der/BooleanTest.java
Wed Apr 12 03:36:17 2006
@@ -39,14 +39,6 @@
  */
 public class BooleanTest extends TestCase {
 
-    /**
-     * Constructor for BooleanTest.
-     * @param arg0
-     */
-    public BooleanTest(String arg0) {
-        super(arg0);
-    }
-
     public static void main(String[] args) {
         junit.textui.TestRunner.run(BooleanTest.class);
     }
@@ -55,16 +47,26 @@
 
     private static byte[] eTrue = new byte[] { 0x01, 0x01, (byte) 0xFF };
 
-    public void testDecode_Valid() throws IOException {
+    public void test_Decode_Encode() throws IOException {
+
+        // oid decoder/encoder for testing
+        ASN1Boolean asn1 = ASN1Boolean.getInstance();
 
         // decoding false
         DerInputStream in = new DerInputStream(eFalse);
-        assertEquals("False", Boolean.FALSE, ASN1Boolean.getInstance().decode(
-                in));
+        assertEquals("Decoding false value", Boolean.FALSE, asn1.decode(in));
 
         // decoding true
         in = new DerInputStream(eTrue);
-        assertEquals("True", Boolean.TRUE, ASN1Boolean.getInstance().decode(in));
+        assertEquals("Decoding true value", Boolean.TRUE, asn1.decode(in));
+
+        // encoding false
+        DerOutputStream out = new DerOutputStream(asn1, Boolean.FALSE);
+        assertTrue("Encoding false value", Arrays.equals(eFalse, out.encoded));
+
+        // encoding true
+        out = new DerOutputStream(asn1, Boolean.TRUE);
+        assertTrue("Encoding true value", Arrays.equals(eTrue, out.encoded));
     }
 
     public void testDecode_Invalid() throws IOException {
@@ -86,16 +88,4 @@
             }
         }
     }
-
-    public void testEncode() throws IOException {
-
-        // encoding false
-        DerOutputStream out = new DerOutputStream(ASN1Boolean.getInstance(),
-                Boolean.FALSE);
-        assertTrue("False", Arrays.equals(eFalse, out.encoded));
-
-        // encoding true
-        out = new DerOutputStream(ASN1Boolean.getInstance(), Boolean.TRUE);
-        assertTrue("True", Arrays.equals(eTrue, out.encoded));
-    }
-}
\ No newline at end of file
+}



Mime
View raw message