You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by ml...@apache.org on 2006/06/20 10:11:19 UTC
svn commit: r415555 [11/17] - in
/incubator/harmony/enhanced/classlib/trunk/modules/security: make/common/
src/test/api/java.injected/java/security/acl/
src/test/api/java.injected/java/security/cert/
src/test/api/java.injected/java/security/interfaces/...
Copied: incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/api/java/org/apache/harmony/security/tests/java/security/interfaces/RSAPublicKeyTest.java (from r414728, incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/api/java.injected/java/security/interfaces/RSAPublicKeyTest.java)
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/api/java/org/apache/harmony/security/tests/java/security/interfaces/RSAPublicKeyTest.java?p2=incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/api/java/org/apache/harmony/security/tests/java/security/interfaces/RSAPublicKeyTest.java&p1=incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/api/java.injected/java/security/interfaces/RSAPublicKeyTest.java&r1=414728&r2=415555&rev=415555&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/api/java.injected/java/security/interfaces/RSAPublicKeyTest.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/api/java/org/apache/harmony/security/tests/java/security/interfaces/RSAPublicKeyTest.java Tue Jun 20 01:11:04 2006
@@ -1,75 +1,75 @@
-/*
- * Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/**
-* @author Vera Y. Petrashkova
-* @version $Revision$
-*/
-
-package java.security.interfaces;
-
-
-import java.math.BigInteger;
-import java.security.interfaces.RSAPublicKey;
-
-import junit.framework.TestCase;
-
-/**
- * Tests for <code>RSAPublicKey</code> class field
- *
- */
-public class RSAPublicKeyTest extends TestCase {
-
- /**
- * Constructor for RSAPublicKeyTest.
- *
- * @param arg0
- */
- public RSAPublicKeyTest(String arg0) {
- super(arg0);
- }
-
- /**
- * Test for <code>serialVersionUID</code> field
- */
- public void testField() {
- checkRSAPublicKey key = new checkRSAPublicKey();
- assertEquals("Incorrect serialVersionUID",
- key.getSerVerUID(), //RSAPublicKey.serialVersionUID
- -8727434096241101194L);
- }
-
- public class checkRSAPublicKey implements RSAPublicKey {
- public String getAlgorithm() {
- return "RSAPublicKey";
- }
- public String getFormat() {
- return "Format";
- }
- public byte[] getEncoded() {
- return new byte[0];
- }
- public long getSerVerUID() {
- return serialVersionUID;
- }
- public BigInteger getModulus() {
- return null;
- }
- public BigInteger getPublicExponent() {
- return null;
- }
- }
-}
+/*
+ * Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+* @author Vera Y. Petrashkova
+* @version $Revision$
+*/
+
+package org.apache.harmony.security.tests.java.security.interfaces;
+
+
+import java.math.BigInteger;
+import java.security.interfaces.RSAPublicKey;
+
+import junit.framework.TestCase;
+
+/**
+ * Tests for <code>RSAPublicKey</code> class field
+ *
+ */
+public class RSAPublicKeyTest extends TestCase {
+
+ /**
+ * Constructor for RSAPublicKeyTest.
+ *
+ * @param arg0
+ */
+ public RSAPublicKeyTest(String arg0) {
+ super(arg0);
+ }
+
+ /**
+ * Test for <code>serialVersionUID</code> field
+ */
+ public void testField() {
+ checkRSAPublicKey key = new checkRSAPublicKey();
+ assertEquals("Incorrect serialVersionUID",
+ key.getSerVerUID(), //RSAPublicKey.serialVersionUID
+ -8727434096241101194L);
+ }
+
+ public class checkRSAPublicKey implements RSAPublicKey {
+ public String getAlgorithm() {
+ return "RSAPublicKey";
+ }
+ public String getFormat() {
+ return "Format";
+ }
+ public byte[] getEncoded() {
+ return new byte[0];
+ }
+ public long getSerVerUID() {
+ return serialVersionUID;
+ }
+ public BigInteger getModulus() {
+ return null;
+ }
+ public BigInteger getPublicExponent() {
+ return null;
+ }
+ }
+}
Copied: incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/api/java/org/apache/harmony/security/tests/java/security/spec/DSAParameterSpecTest.java (from r414728, incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/api/java.injected/java/security/spec/DSAParameterSpecTest.java)
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/api/java/org/apache/harmony/security/tests/java/security/spec/DSAParameterSpecTest.java?p2=incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/api/java/org/apache/harmony/security/tests/java/security/spec/DSAParameterSpecTest.java&p1=incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/api/java.injected/java/security/spec/DSAParameterSpecTest.java&r1=414728&r2=415555&rev=415555&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/api/java.injected/java/security/spec/DSAParameterSpecTest.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/api/java/org/apache/harmony/security/tests/java/security/spec/DSAParameterSpecTest.java Tue Jun 20 01:11:04 2006
@@ -19,12 +19,13 @@
* @version $Revision$
*/
-package java.security.spec;
+package org.apache.harmony.security.tests.java.security.spec;
import java.math.BigInteger;
+import java.security.spec.AlgorithmParameterSpec;
+import java.security.spec.DSAParameterSpec;
import junit.framework.TestCase;
-
/**
* Tests for <code>DSAParameterSpec</code>
Copied: incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/api/java/org/apache/harmony/security/tests/java/security/spec/DSAPrivateKeySpecTest.java (from r414728, incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/api/java.injected/java/security/spec/DSAPrivateKeySpecTest.java)
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/api/java/org/apache/harmony/security/tests/java/security/spec/DSAPrivateKeySpecTest.java?p2=incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/api/java/org/apache/harmony/security/tests/java/security/spec/DSAPrivateKeySpecTest.java&p1=incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/api/java.injected/java/security/spec/DSAPrivateKeySpecTest.java&r1=414728&r2=415555&rev=415555&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/api/java.injected/java/security/spec/DSAPrivateKeySpecTest.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/api/java/org/apache/harmony/security/tests/java/security/spec/DSAPrivateKeySpecTest.java Tue Jun 20 01:11:04 2006
@@ -19,12 +19,13 @@
* @version $Revision$
*/
-package java.security.spec;
+package org.apache.harmony.security.tests.java.security.spec;
import java.math.BigInteger;
+import java.security.spec.DSAPrivateKeySpec;
+import java.security.spec.KeySpec;
import junit.framework.TestCase;
-
/**
* Tests for <code>DSAPrivateKeySpec</code>
Copied: incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/api/java/org/apache/harmony/security/tests/java/security/spec/DSAPublicKeySpecTest.java (from r414728, incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/api/java.injected/java/security/spec/DSAPublicKeySpecTest.java)
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/api/java/org/apache/harmony/security/tests/java/security/spec/DSAPublicKeySpecTest.java?p2=incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/api/java/org/apache/harmony/security/tests/java/security/spec/DSAPublicKeySpecTest.java&p1=incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/api/java.injected/java/security/spec/DSAPublicKeySpecTest.java&r1=414728&r2=415555&rev=415555&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/api/java.injected/java/security/spec/DSAPublicKeySpecTest.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/api/java/org/apache/harmony/security/tests/java/security/spec/DSAPublicKeySpecTest.java Tue Jun 20 01:11:04 2006
@@ -19,12 +19,13 @@
* @version $Revision$
*/
-package java.security.spec;
+package org.apache.harmony.security.tests.java.security.spec;
import java.math.BigInteger;
+import java.security.spec.DSAPublicKeySpec;
+import java.security.spec.KeySpec;
import junit.framework.TestCase;
-
/**
* Tests for <code>DSAPublicKeySpec</code>
Copied: incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/api/java/org/apache/harmony/security/tests/java/security/spec/ECFieldF2mTest.java (from r414728, incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/api/java.injected/java/security/spec/ECFieldF2mTest.java)
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/api/java/org/apache/harmony/security/tests/java/security/spec/ECFieldF2mTest.java?p2=incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/api/java/org/apache/harmony/security/tests/java/security/spec/ECFieldF2mTest.java&p1=incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/api/java.injected/java/security/spec/ECFieldF2mTest.java&r1=414728&r2=415555&rev=415555&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/api/java.injected/java/security/spec/ECFieldF2mTest.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/api/java/org/apache/harmony/security/tests/java/security/spec/ECFieldF2mTest.java Tue Jun 20 01:11:04 2006
@@ -19,14 +19,14 @@
* @version $Revision$
*/
-package java.security.spec;
+package org.apache.harmony.security.tests.java.security.spec;
import java.math.BigInteger;
+import java.security.spec.ECFieldF2m;
import java.util.Arrays;
import junit.framework.TestCase;
-
/**
* Tests for <code>ECFieldF2m</code> class fields and methods.
*
@@ -138,127 +138,6 @@
try {
// perform test
new ECFieldF2m(tp.m);
-
- if (tp.x != null) {
- // exception has been expected
- fail(getName() + ", set " + i +
- " FAILED: expected exception has not been thrown");
- }
- } catch (Exception e){
- if (tp.x == null || !e.getClass().isInstance(tp.x)) {
- // exception: failure
- // if it has not been expected
- // or wrong one has been thrown
- fail(getName() + ", set " + i +
- " FAILED: unexpected " + e);
- }
- }
- }
- }
-
- /**
- * Set of parameters used for <code>ECFieldF2m(int, BigInteger)</code>
- * constructor tests.
- */
- private final ECFieldF2mDomainParams[] intBigIntegerCtorTestParameters =
- new ECFieldF2mDomainParams[] {
- // set 0: valid m and rp - trinomial basis params
- new ECFieldF2mDomainParams(
- 1999,
- BigInteger.valueOf(0L).setBit(0).setBit(367).setBit(1999),
- null,
- null),
- // set 1: valid m and rp - pentanomial basis params
- new ECFieldF2mDomainParams(
- 2000,
- BigInteger.valueOf(0L).setBit(0).setBit(1).setBit(2).setBit(981).setBit(2000),
- null,
- null),
- // set 2: valid m, invalid (null) rp
- new ECFieldF2mDomainParams(
- 1963,
- (BigInteger)null,
- null,
- ECFieldF2mDomainParams.NPE),
- // set 3: valid m, invalid rp - bit 0 not set
- new ECFieldF2mDomainParams(
- 1999,
- BigInteger.valueOf(0L).setBit(1).setBit(367).setBit(1999),
- null,
- ECFieldF2mDomainParams.IArgE),
- // set 4: valid m, invalid rp - bit m not set
- new ECFieldF2mDomainParams(
- 1999,
- BigInteger.valueOf(0L).setBit(0).setBit(367).setBit(1998),
- null,
- ECFieldF2mDomainParams.IArgE),
- // set 5: valid m, invalid rp - bit k improperly set
- new ECFieldF2mDomainParams(
- 1999,
- BigInteger.valueOf(0L).setBit(0).setBit(2367).setBit(1999),
- null,
- ECFieldF2mDomainParams.IArgE),
- // set 6: valid m, invalid rp - k1 k2 k3
- new ECFieldF2mDomainParams(
- 2000,
- BigInteger.valueOf(0L).setBit(0).setBit(2001).setBit(2002).setBit(2003).setBit(2000),
- null,
- ECFieldF2mDomainParams.IArgE),
- // set 7: valid m, invalid rp - number of bits set
- new ECFieldF2mDomainParams(
- 2000,
- BigInteger.valueOf(0L).setBit(0).setBit(2000),
- null,
- ECFieldF2mDomainParams.IArgE),
- // set 8: valid m, invalid rp - number of bits set
- new ECFieldF2mDomainParams(
- 2000,
- BigInteger.valueOf(0L).setBit(0).setBit(1).setBit(2).setBit(2000),
- null,
- ECFieldF2mDomainParams.IArgE),
- // set 9: valid m, invalid rp - number of bits set
- new ECFieldF2mDomainParams(
- 2000,
- BigInteger.valueOf(0L).setBit(0).setBit(1).setBit(2).
- setBit(981).setBit(985).setBit(2000),
- null,
- ECFieldF2mDomainParams.IArgE),
- // set 10: valid m, invalid rp
- new ECFieldF2mDomainParams(
- 2000,
- BigInteger.valueOf(0L),
- null,
- ECFieldF2mDomainParams.IArgE),
- // set 11: invalid m
- new ECFieldF2mDomainParams(
- -2000,
- BigInteger.valueOf(0L).setBit(0).setBit(1).setBit(2).
- setBit(981).setBit(2000),
- null,
- ECFieldF2mDomainParams.IArgE),
- };
-
- /**
- * Tests for constructor <code>ECFieldF2m(int, BigInteger)</code><br>
- *
- * Assertion: constructs new <code>ECFieldF2m</code> object
- * using valid parameters m and rp. rp represents trinomial basis.
- *
- * Assertion: constructs new <code>ECFieldF2m</code> object
- * using valid parameters m and rp. rp represents pentanomial basis.
- *
- * Assertion: IllegalArgumentException if m is not positive.
- *
- * Assertion: NullPointerException if rp is null.
- *
- * Assertion: IllegalArgumentException if rp is invalid.
- */
- public final void testECFieldF2mintBigInteger() {
- for(int i=0; i<intBigIntegerCtorTestParameters.length; i++) {
- ECFieldF2mDomainParams tp = intBigIntegerCtorTestParameters[i];
- try {
- // perform test
- new ECFieldF2m(tp.m, tp.rp);
if (tp.x != null) {
// exception has been expected
Copied: incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/api/java/org/apache/harmony/security/tests/java/security/spec/ECFieldFpTest.java (from r414728, incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/api/java.injected/java/security/spec/ECFieldFpTest.java)
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/api/java/org/apache/harmony/security/tests/java/security/spec/ECFieldFpTest.java?p2=incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/api/java/org/apache/harmony/security/tests/java/security/spec/ECFieldFpTest.java&p1=incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/api/java.injected/java/security/spec/ECFieldFpTest.java&r1=414728&r2=415555&rev=415555&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/api/java.injected/java/security/spec/ECFieldFpTest.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/api/java/org/apache/harmony/security/tests/java/security/spec/ECFieldFpTest.java Tue Jun 20 01:11:04 2006
@@ -19,12 +19,12 @@
* @version $Revision$
*/
-package java.security.spec;
+package org.apache.harmony.security.tests.java.security.spec;
import java.math.BigInteger;
+import java.security.spec.ECFieldFp;
import junit.framework.TestCase;
-
/**
* Tests for <code>ECFieldFp</code> class fields and methods.
Copied: incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/api/java/org/apache/harmony/security/tests/java/security/spec/ECGenParameterSpecTest.java (from r414728, incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/api/java.injected/java/security/spec/ECGenParameterSpecTest.java)
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/api/java/org/apache/harmony/security/tests/java/security/spec/ECGenParameterSpecTest.java?p2=incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/api/java/org/apache/harmony/security/tests/java/security/spec/ECGenParameterSpecTest.java&p1=incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/api/java.injected/java/security/spec/ECGenParameterSpecTest.java&r1=414728&r2=415555&rev=415555&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/api/java.injected/java/security/spec/ECGenParameterSpecTest.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/api/java/org/apache/harmony/security/tests/java/security/spec/ECGenParameterSpecTest.java Tue Jun 20 01:11:04 2006
@@ -1,78 +1,80 @@
-/*
- * Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/**
-* @author Vladimir N. Molotkov
-* @version $Revision$
-*/
-
-package java.security.spec;
-
-import junit.framework.TestCase;
-
-/**
- * Tests for <code>ECGenParameterSpec</code> class fields and methods.
- *
- */
-public class ECGenParameterSpecTest extends TestCase {
-
- /**
- * Constructor for ECGenParameterSpecTest.
- * @param name
- */
- public ECGenParameterSpecTest(String name) {
- super(name);
- }
-
- //
- // Tests
- //
-
- /**
- * Test #1 for <code>ECGenParameterSpec</code> constructor<br>
- *
- * Assertion: creates new object of <code>ECGenParameterSpec</code> class
- * using valid <code>name</code>
- */
- public final void testECGenParameterSpec01() {
- new ECGenParameterSpec("someName");
- }
-
- /**
- * Test #2 for <code>ECGenParameterSpec</code> constructor<br>
- *
- * Assertion: throws NullPointerException
- * if <code>name</code> is <code>null</code>
- */
- public final void testECGenParameterSpec02() {
- try {
- new ECGenParameterSpec(null);
- fail("NPE expected");
- } catch (NullPointerException ok) {}
- }
-
- /**
- * Test for <code>getName()</code> method<br>
- *
- * Assertion: returns the <code>name</code>
- */
- public final void testGetName() {
- String name = "someName";
- ECGenParameterSpec ps = new ECGenParameterSpec(name);
- assertEquals(name, ps.getName());
- }
-
-}
+/*
+ * Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+* @author Vladimir N. Molotkov
+* @version $Revision$
+*/
+
+package org.apache.harmony.security.tests.java.security.spec;
+
+import java.security.spec.ECGenParameterSpec;
+
+import junit.framework.TestCase;
+
+/**
+ * Tests for <code>ECGenParameterSpec</code> class fields and methods.
+ *
+ */
+public class ECGenParameterSpecTest extends TestCase {
+
+ /**
+ * Constructor for ECGenParameterSpecTest.
+ * @param name
+ */
+ public ECGenParameterSpecTest(String name) {
+ super(name);
+ }
+
+ //
+ // Tests
+ //
+
+ /**
+ * Test #1 for <code>ECGenParameterSpec</code> constructor<br>
+ *
+ * Assertion: creates new object of <code>ECGenParameterSpec</code> class
+ * using valid <code>name</code>
+ */
+ public final void testECGenParameterSpec01() {
+ new ECGenParameterSpec("someName");
+ }
+
+ /**
+ * Test #2 for <code>ECGenParameterSpec</code> constructor<br>
+ *
+ * Assertion: throws NullPointerException
+ * if <code>name</code> is <code>null</code>
+ */
+ public final void testECGenParameterSpec02() {
+ try {
+ new ECGenParameterSpec(null);
+ fail("NPE expected");
+ } catch (NullPointerException ok) {}
+ }
+
+ /**
+ * Test for <code>getName()</code> method<br>
+ *
+ * Assertion: returns the <code>name</code>
+ */
+ public final void testGetName() {
+ String name = "someName";
+ ECGenParameterSpec ps = new ECGenParameterSpec(name);
+ assertEquals(name, ps.getName());
+ }
+
+}
Copied: incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/api/java/org/apache/harmony/security/tests/java/security/spec/ECPointTest.java (from r414728, incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/api/java.injected/java/security/spec/ECPointTest.java)
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/api/java/org/apache/harmony/security/tests/java/security/spec/ECPointTest.java?p2=incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/api/java/org/apache/harmony/security/tests/java/security/spec/ECPointTest.java&p1=incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/api/java.injected/java/security/spec/ECPointTest.java&r1=414728&r2=415555&rev=415555&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/api/java.injected/java/security/spec/ECPointTest.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/api/java/org/apache/harmony/security/tests/java/security/spec/ECPointTest.java Tue Jun 20 01:11:04 2006
@@ -1,243 +1,243 @@
-/*
- * Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/**
-* @author Vladimir N. Molotkov
-* @version $Revision$
-*/
-
-package java.security.spec;
-
-import java.math.BigInteger;
-
-import junit.framework.TestCase;
-
-
-/**
- * Tests for <code>ECPoint</code> class fields and methods.
- *
- */
-public class ECPointTest extends TestCase {
-
- /**
- * Constructor for ECPointTest.
- * @param name
- */
- public ECPointTest(String name) {
- super(name);
- }
-
- //
- // Tests
- //
-
- /**
- * Test #1 for <code>ECPoint(BigInteger, BigInteger)</code> constructor<br>
- * Assertion: creates <code>ECPoint</code> instance<br>
- * Test preconditions: valid parameters passed<br>
- * Expected: must pass without any exceptions
- */
- public final void testECPoint01() {
- new ECPoint(BigInteger.ZERO, BigInteger.ZERO);
- new ECPoint(BigInteger.valueOf(-23456L), BigInteger.valueOf(-23456L));
- new ECPoint(BigInteger.valueOf(123456L), BigInteger.valueOf(123456L));
- new ECPoint(BigInteger.valueOf(-56L), BigInteger.valueOf(234L));
- new ECPoint(BigInteger.valueOf(3456L), BigInteger.valueOf(-2344L));
- }
-
- /**
- * Test #2 for <code>ECPoint(BigInteger x, BigInteger y)</code> constructor<br>
- * Assertion: throws <code>NullPointerException</code> if <code>x</code>or
- * <code>y</code> is <code>null</code><br>
- * Test preconditions: pass <code>null</code> as mentioned parameters<br>
- * Expected: must throw <code>NullPointerException</code>
- */
- public final void testECPoint02() {
- // test case 1: x is null
- try {
- new ECPoint(null, BigInteger.ZERO);
- fail("#1: Expected NPE not thrown");
- } catch (NullPointerException ok) {
- }
-
-
- // test case 2: y is null
- try {
- new ECPoint(BigInteger.ZERO, null);
- fail("#2: Expected NPE not thrown");
- } catch (NullPointerException ok) {
- }
-
-
- // test case 3: both : x and y are null
- try {
- new ECPoint(null, null);
- fail("#3: Expected NPE not thrown");
- } catch (NullPointerException ok) {
- }
- }
-
- /**
- * Test #1 for <code>getAffineX()</code> method<br>
- * Assertion: returns affine <code>x</code> coordinate<br>
- * Test preconditions: <code>ECPoint</code> instance
- * created using valid parameters<br>
- * Expected: must return affine <code>x</code> coordinate
- * which is equal to the one passed to the constructor;
- * (both must refer the same object)
- */
- public final void testGetAffineX01() {
- BigInteger x = BigInteger.valueOf(-23456L);
- ECPoint p = new ECPoint(x, BigInteger.valueOf(23456L));
- BigInteger xRet = p.getAffineX();
- assertEquals(x, xRet);
- assertSame(x, xRet);
- }
-
- /**
- * Test #2 for <code>getAffineX()</code> method<br>
- * Assertion: returns <code>null</code> for <code>ECPoint.POINT_INFINITY</code><br>
- * Test preconditions: none<br>
- * Expected: must return <code>null</code> for
- * <code>ECPoint.POINT_INFINITY</code>
- */
- public final void testGetAffineX02() {
- assertNull(ECPoint.POINT_INFINITY.getAffineX());
- }
-
- /**
- * Test #1 for <code>getAffineY()</code> method<br>
- * Assertion: returns affine <code>y</code> coordinate<br>
- * Test preconditions: <code>ECPoint</code> instance
- * created using valid parameters<br>
- * Expected: must return affine <code>y</code> coordinate
- * which is equal to the one passed to the constructor;
- * (both must refer the same object)
- */
- public final void testGetAffineY01() {
- BigInteger y = BigInteger.valueOf(23456L);
- ECPoint p = new ECPoint(BigInteger.valueOf(-23456L), y);
- BigInteger yRet = p.getAffineY();
- assertEquals(y, yRet);
- assertSame(y, yRet);
- }
-
- /**
- * Test #2 for <code>getAffineX()</code> method<br>
- * Assertion: returns <code>null</code> for <code>ECPoint.POINT_INFINITY</code><br>
- * Test preconditions: none<br>
- * Expected: must return <code>null</code> for
- * <code>ECPoint.POINT_INFINITY</code>
- */
- public final void testGetAffineY02() {
- assertNull(ECPoint.POINT_INFINITY.getAffineY());
- }
-
- /**
- * Test #1 for <code>equals(Object other)</code> method<br>
- * Assertion: return true if this and other objects are equal<br>
- * Test preconditions: see test comments<br>
- * Expected: all objects in this test must be equal
- */
- public final void testEqualsObject01() {
- // test case 1: must be equal to itself
- ECPoint p2=null, p1 =
- new ECPoint(BigInteger.valueOf(-23456L), BigInteger.ONE);
- assertTrue(p1.equals(p1));
-
- // test case 2: equal objects
- p1 = new ECPoint(BigInteger.valueOf(-23456L), BigInteger.ONE);
- p2 = new ECPoint(BigInteger.valueOf(-23456L), BigInteger.valueOf(1L));
- assertTrue(p1.equals(p2) && p2.equals(p1));
-
- // test case 3: equal POINT_INFINITY object(s)
- p1 = ECPoint.POINT_INFINITY;
- p2 = ECPoint.POINT_INFINITY;
- assertTrue(p1.equals(p2) && p2.equals(p1));
- }
-
- /**
- * Test #2 for <code>equals(Object other)</code> method<br>
- * Assertion: return false if this and other objects are not equal<br>
- * Test preconditions: see test comments<br>
- * Expected: all objects in this test must be not equal
- */
- public final void testEqualsObject02() {
- // test case 1: must be not equal to null
- ECPoint p2=null, p1 =
- new ECPoint(BigInteger.valueOf(-23456L), BigInteger.ONE);
- assertFalse(p1.equals(p2));
-
- // test case 2: not equal objects - x
- p1 = new ECPoint(BigInteger.valueOf(-23457L), BigInteger.ONE);
- p2 = new ECPoint(BigInteger.valueOf(-23456L), BigInteger.valueOf(1L));
- assertFalse(p1.equals(p2) || p2.equals(p1));
-
- // test case 3: not equal objects - y
- p1 = new ECPoint(BigInteger.valueOf(-23457L), BigInteger.ONE);
- p2 = new ECPoint(BigInteger.valueOf(-23456L), BigInteger.ZERO);
- assertFalse(p1.equals(p2) || p2.equals(p1));
-
- // test case 4: not equal - some point and POINT_INFINITY
- p1 = ECPoint.POINT_INFINITY;
- p2 = new ECPoint(BigInteger.valueOf(-23456L), BigInteger.ZERO);
- assertFalse(p1.equals(p2) || p2.equals(p1));
- }
-
- /**
- * Test #1 for <code>hashCode()</code> method.<br>
- *
- * Assertion: must return the same value if invoked
- * repeatedly on the same object.
- */
- public final void testHashCode01() {
- ECPoint f = new ECPoint(BigInteger.valueOf(-23457L), BigInteger.ONE);
- int hc = f.hashCode();
- assertTrue(hc == f.hashCode() &&
- hc == f.hashCode() &&
- hc == f.hashCode() &&
- hc == f.hashCode() &&
- hc == f.hashCode() &&
- hc == f.hashCode() &&
- hc == f.hashCode() &&
- hc == f.hashCode());
-
-
- // the same for POINT_INFINITY
- hc = ECPoint.POINT_INFINITY.hashCode();
- assertTrue(hc == ECPoint.POINT_INFINITY.hashCode() &&
- hc == ECPoint.POINT_INFINITY.hashCode() &&
- hc == ECPoint.POINT_INFINITY.hashCode() &&
- hc == ECPoint.POINT_INFINITY.hashCode() &&
- hc == ECPoint.POINT_INFINITY.hashCode() &&
- hc == ECPoint.POINT_INFINITY.hashCode() &&
- hc == ECPoint.POINT_INFINITY.hashCode() &&
- hc == ECPoint.POINT_INFINITY.hashCode());
- }
-
- /**
- * Test #2 for <code>hashCode()</code> method.<br>
- *
- * Assertion: must return the same value if invoked
- * on equal (according to the <code>equals(Object)</code> method) objects.
- */
- public final void testHashCode02() {
- ECPoint p1 = new ECPoint(BigInteger.valueOf(-23456L), BigInteger.ONE);
- ECPoint p2 = new ECPoint(BigInteger.valueOf(-23456L), BigInteger.valueOf(1L));
- assertEquals(p1.hashCode(), p2.hashCode());
- }
-
-}
+/*
+ * Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+* @author Vladimir N. Molotkov
+* @version $Revision$
+*/
+
+package org.apache.harmony.security.tests.java.security.spec;
+
+import java.math.BigInteger;
+import java.security.spec.ECPoint;
+
+import junit.framework.TestCase;
+
+/**
+ * Tests for <code>ECPoint</code> class fields and methods.
+ *
+ */
+public class ECPointTest extends TestCase {
+
+ /**
+ * Constructor for ECPointTest.
+ * @param name
+ */
+ public ECPointTest(String name) {
+ super(name);
+ }
+
+ //
+ // Tests
+ //
+
+ /**
+ * Test #1 for <code>ECPoint(BigInteger, BigInteger)</code> constructor<br>
+ * Assertion: creates <code>ECPoint</code> instance<br>
+ * Test preconditions: valid parameters passed<br>
+ * Expected: must pass without any exceptions
+ */
+ public final void testECPoint01() {
+ new ECPoint(BigInteger.ZERO, BigInteger.ZERO);
+ new ECPoint(BigInteger.valueOf(-23456L), BigInteger.valueOf(-23456L));
+ new ECPoint(BigInteger.valueOf(123456L), BigInteger.valueOf(123456L));
+ new ECPoint(BigInteger.valueOf(-56L), BigInteger.valueOf(234L));
+ new ECPoint(BigInteger.valueOf(3456L), BigInteger.valueOf(-2344L));
+ }
+
+ /**
+ * Test #2 for <code>ECPoint(BigInteger x, BigInteger y)</code> constructor<br>
+ * Assertion: throws <code>NullPointerException</code> if <code>x</code>or
+ * <code>y</code> is <code>null</code><br>
+ * Test preconditions: pass <code>null</code> as mentioned parameters<br>
+ * Expected: must throw <code>NullPointerException</code>
+ */
+ public final void testECPoint02() {
+ // test case 1: x is null
+ try {
+ new ECPoint(null, BigInteger.ZERO);
+ fail("#1: Expected NPE not thrown");
+ } catch (NullPointerException ok) {
+ }
+
+
+ // test case 2: y is null
+ try {
+ new ECPoint(BigInteger.ZERO, null);
+ fail("#2: Expected NPE not thrown");
+ } catch (NullPointerException ok) {
+ }
+
+
+ // test case 3: both : x and y are null
+ try {
+ new ECPoint(null, null);
+ fail("#3: Expected NPE not thrown");
+ } catch (NullPointerException ok) {
+ }
+ }
+
+ /**
+ * Test #1 for <code>getAffineX()</code> method<br>
+ * Assertion: returns affine <code>x</code> coordinate<br>
+ * Test preconditions: <code>ECPoint</code> instance
+ * created using valid parameters<br>
+ * Expected: must return affine <code>x</code> coordinate
+ * which is equal to the one passed to the constructor;
+ * (both must refer the same object)
+ */
+ public final void testGetAffineX01() {
+ BigInteger x = BigInteger.valueOf(-23456L);
+ ECPoint p = new ECPoint(x, BigInteger.valueOf(23456L));
+ BigInteger xRet = p.getAffineX();
+ assertEquals(x, xRet);
+ assertSame(x, xRet);
+ }
+
+ /**
+ * Test #2 for <code>getAffineX()</code> method<br>
+ * Assertion: returns <code>null</code> for <code>ECPoint.POINT_INFINITY</code><br>
+ * Test preconditions: none<br>
+ * Expected: must return <code>null</code> for
+ * <code>ECPoint.POINT_INFINITY</code>
+ */
+ public final void testGetAffineX02() {
+ assertNull(ECPoint.POINT_INFINITY.getAffineX());
+ }
+
+ /**
+ * Test #1 for <code>getAffineY()</code> method<br>
+ * Assertion: returns affine <code>y</code> coordinate<br>
+ * Test preconditions: <code>ECPoint</code> instance
+ * created using valid parameters<br>
+ * Expected: must return affine <code>y</code> coordinate
+ * which is equal to the one passed to the constructor;
+ * (both must refer the same object)
+ */
+ public final void testGetAffineY01() {
+ BigInteger y = BigInteger.valueOf(23456L);
+ ECPoint p = new ECPoint(BigInteger.valueOf(-23456L), y);
+ BigInteger yRet = p.getAffineY();
+ assertEquals(y, yRet);
+ assertSame(y, yRet);
+ }
+
+ /**
+ * Test #2 for <code>getAffineX()</code> method<br>
+ * Assertion: returns <code>null</code> for <code>ECPoint.POINT_INFINITY</code><br>
+ * Test preconditions: none<br>
+ * Expected: must return <code>null</code> for
+ * <code>ECPoint.POINT_INFINITY</code>
+ */
+ public final void testGetAffineY02() {
+ assertNull(ECPoint.POINT_INFINITY.getAffineY());
+ }
+
+ /**
+ * Test #1 for <code>equals(Object other)</code> method<br>
+ * Assertion: return true if this and other objects are equal<br>
+ * Test preconditions: see test comments<br>
+ * Expected: all objects in this test must be equal
+ */
+ public final void testEqualsObject01() {
+ // test case 1: must be equal to itself
+ ECPoint p2=null, p1 =
+ new ECPoint(BigInteger.valueOf(-23456L), BigInteger.ONE);
+ assertTrue(p1.equals(p1));
+
+ // test case 2: equal objects
+ p1 = new ECPoint(BigInteger.valueOf(-23456L), BigInteger.ONE);
+ p2 = new ECPoint(BigInteger.valueOf(-23456L), BigInteger.valueOf(1L));
+ assertTrue(p1.equals(p2) && p2.equals(p1));
+
+ // test case 3: equal POINT_INFINITY object(s)
+ p1 = ECPoint.POINT_INFINITY;
+ p2 = ECPoint.POINT_INFINITY;
+ assertTrue(p1.equals(p2) && p2.equals(p1));
+ }
+
+ /**
+ * Test #2 for <code>equals(Object other)</code> method<br>
+ * Assertion: return false if this and other objects are not equal<br>
+ * Test preconditions: see test comments<br>
+ * Expected: all objects in this test must be not equal
+ */
+ public final void testEqualsObject02() {
+ // test case 1: must be not equal to null
+ ECPoint p2=null, p1 =
+ new ECPoint(BigInteger.valueOf(-23456L), BigInteger.ONE);
+ assertFalse(p1.equals(p2));
+
+ // test case 2: not equal objects - x
+ p1 = new ECPoint(BigInteger.valueOf(-23457L), BigInteger.ONE);
+ p2 = new ECPoint(BigInteger.valueOf(-23456L), BigInteger.valueOf(1L));
+ assertFalse(p1.equals(p2) || p2.equals(p1));
+
+ // test case 3: not equal objects - y
+ p1 = new ECPoint(BigInteger.valueOf(-23457L), BigInteger.ONE);
+ p2 = new ECPoint(BigInteger.valueOf(-23456L), BigInteger.ZERO);
+ assertFalse(p1.equals(p2) || p2.equals(p1));
+
+ // test case 4: not equal - some point and POINT_INFINITY
+ p1 = ECPoint.POINT_INFINITY;
+ p2 = new ECPoint(BigInteger.valueOf(-23456L), BigInteger.ZERO);
+ assertFalse(p1.equals(p2) || p2.equals(p1));
+ }
+
+ /**
+ * Test #1 for <code>hashCode()</code> method.<br>
+ *
+ * Assertion: must return the same value if invoked
+ * repeatedly on the same object.
+ */
+ public final void testHashCode01() {
+ ECPoint f = new ECPoint(BigInteger.valueOf(-23457L), BigInteger.ONE);
+ int hc = f.hashCode();
+ assertTrue(hc == f.hashCode() &&
+ hc == f.hashCode() &&
+ hc == f.hashCode() &&
+ hc == f.hashCode() &&
+ hc == f.hashCode() &&
+ hc == f.hashCode() &&
+ hc == f.hashCode() &&
+ hc == f.hashCode());
+
+
+ // the same for POINT_INFINITY
+ hc = ECPoint.POINT_INFINITY.hashCode();
+ assertTrue(hc == ECPoint.POINT_INFINITY.hashCode() &&
+ hc == ECPoint.POINT_INFINITY.hashCode() &&
+ hc == ECPoint.POINT_INFINITY.hashCode() &&
+ hc == ECPoint.POINT_INFINITY.hashCode() &&
+ hc == ECPoint.POINT_INFINITY.hashCode() &&
+ hc == ECPoint.POINT_INFINITY.hashCode() &&
+ hc == ECPoint.POINT_INFINITY.hashCode() &&
+ hc == ECPoint.POINT_INFINITY.hashCode());
+ }
+
+ /**
+ * Test #2 for <code>hashCode()</code> method.<br>
+ *
+ * Assertion: must return the same value if invoked
+ * on equal (according to the <code>equals(Object)</code> method) objects.
+ */
+ public final void testHashCode02() {
+ ECPoint p1 = new ECPoint(BigInteger.valueOf(-23456L), BigInteger.ONE);
+ ECPoint p2 = new ECPoint(BigInteger.valueOf(-23456L), BigInteger.valueOf(1L));
+ assertEquals(p1.hashCode(), p2.hashCode());
+ }
+
+}