You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by te...@apache.org on 2006/01/31 12:04:50 UTC
svn commit: r373789 [6/9] - in
/incubator/harmony/enhanced/classlib/trunk/modules/security2/test:
common/unit/java/security/ common/unit/java/security/cert/
common/unit/java/security/interfaces/ common/unit/java/security/spec/
common/unit/javax/crypto/...
Modified: incubator/harmony/enhanced/classlib/trunk/modules/security2/test/common/unit/java/security/interfaces/ECPrivateKeyTest.java
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/modules/security2/test/common/unit/java/security/interfaces/ECPrivateKeyTest.java?rev=373789&r1=373788&r2=373789&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/security2/test/common/unit/java/security/interfaces/ECPrivateKeyTest.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/security2/test/common/unit/java/security/interfaces/ECPrivateKeyTest.java Tue Jan 31 03:01:12 2006
@@ -26,13 +26,13 @@
import java.security.interfaces.ECPrivateKey;
import java.security.spec.ECParameterSpec;
-import org.apache.harmony.security.test.PerformanceTest;
+import junit.framework.TestCase;
/**
* Tests for <code>ECPrivateKey</code> class field
*
*/
-public class ECPrivateKeyTest extends PerformanceTest {
+public class ECPrivateKeyTest extends TestCase {
/**
* Constructor for ECPrivateKeyTest.
@@ -73,4 +73,4 @@
return serialVersionUID;
}
}
-}
\ No newline at end of file
+}
Modified: incubator/harmony/enhanced/classlib/trunk/modules/security2/test/common/unit/java/security/interfaces/ECPublicKeyTest.java
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/modules/security2/test/common/unit/java/security/interfaces/ECPublicKeyTest.java?rev=373789&r1=373788&r2=373789&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/security2/test/common/unit/java/security/interfaces/ECPublicKeyTest.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/security2/test/common/unit/java/security/interfaces/ECPublicKeyTest.java Tue Jan 31 03:01:12 2006
@@ -26,13 +26,13 @@
import java.security.interfaces.ECPublicKey;
import java.security.spec.ECParameterSpec;
-import org.apache.harmony.security.test.PerformanceTest;
+import junit.framework.TestCase;
/**
* Tests for <code>ECPublicKey</code> class field
*
*/
-public class ECPublicKeyTest extends PerformanceTest {
+public class ECPublicKeyTest extends TestCase {
/**
* Constructor for ECPublicKeyTest.
@@ -72,4 +72,4 @@
return serialVersionUID;
}
}
-}
\ No newline at end of file
+}
Modified: incubator/harmony/enhanced/classlib/trunk/modules/security2/test/common/unit/java/security/interfaces/RSAMultiPrimePrivateCrtKeyTest.java
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/modules/security2/test/common/unit/java/security/interfaces/RSAMultiPrimePrivateCrtKeyTest.java?rev=373789&r1=373788&r2=373789&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/security2/test/common/unit/java/security/interfaces/RSAMultiPrimePrivateCrtKeyTest.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/security2/test/common/unit/java/security/interfaces/RSAMultiPrimePrivateCrtKeyTest.java Tue Jan 31 03:01:12 2006
@@ -26,13 +26,13 @@
import java.security.interfaces.RSAMultiPrimePrivateCrtKey;
import java.security.spec.RSAOtherPrimeInfo;
-import org.apache.harmony.security.test.PerformanceTest;
+import junit.framework.TestCase;
/**
* Tests for <code>RSAMultiPrimePrivateCrtKey</code> class field
*
*/
-public class RSAMultiPrimePrivateCrtKeyTest extends PerformanceTest {
+public class RSAMultiPrimePrivateCrtKeyTest extends TestCase {
/**
* Constructor for RSAMultiPrimePrivateCrtKeyTest.
@@ -94,4 +94,4 @@
return serialVersionUID;
}
}
-}
\ No newline at end of file
+}
Modified: incubator/harmony/enhanced/classlib/trunk/modules/security2/test/common/unit/java/security/interfaces/RSAPrivateCrtKeyTest.java
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/modules/security2/test/common/unit/java/security/interfaces/RSAPrivateCrtKeyTest.java?rev=373789&r1=373788&r2=373789&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/security2/test/common/unit/java/security/interfaces/RSAPrivateCrtKeyTest.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/security2/test/common/unit/java/security/interfaces/RSAPrivateCrtKeyTest.java Tue Jan 31 03:01:12 2006
@@ -25,13 +25,13 @@
import java.math.BigInteger;
import java.security.interfaces.RSAPrivateCrtKey;
-import org.apache.harmony.security.test.PerformanceTest;
+import junit.framework.TestCase;
/**
* Tests for <code>RSAPrivateCrtKey</code> class field
*
*/
-public class RSAPrivateCrtKeyTest extends PerformanceTest {
+public class RSAPrivateCrtKeyTest extends TestCase {
/**
* Constructor for RSAPrivateCrtKeyTest.
@@ -90,4 +90,4 @@
}
}
-}
\ No newline at end of file
+}
Modified: incubator/harmony/enhanced/classlib/trunk/modules/security2/test/common/unit/java/security/interfaces/RSAPrivateKeyTest.java
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/modules/security2/test/common/unit/java/security/interfaces/RSAPrivateKeyTest.java?rev=373789&r1=373788&r2=373789&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/security2/test/common/unit/java/security/interfaces/RSAPrivateKeyTest.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/security2/test/common/unit/java/security/interfaces/RSAPrivateKeyTest.java Tue Jan 31 03:01:12 2006
@@ -25,13 +25,13 @@
import java.math.BigInteger;
import java.security.interfaces.RSAPrivateKey;
-import org.apache.harmony.security.test.PerformanceTest;
+import junit.framework.TestCase;
/**
* Tests for <code>RSAPrivateKey</code> class field
*
*/
-public class RSAPrivateKeyTest extends PerformanceTest {
+public class RSAPrivateKeyTest extends TestCase {
/**
* Constructor for RSAPrivateKeyTest.
@@ -71,4 +71,4 @@
return null;
}
}
-}
\ No newline at end of file
+}
Modified: incubator/harmony/enhanced/classlib/trunk/modules/security2/test/common/unit/java/security/interfaces/RSAPublicKeyTest.java
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/modules/security2/test/common/unit/java/security/interfaces/RSAPublicKeyTest.java?rev=373789&r1=373788&r2=373789&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/security2/test/common/unit/java/security/interfaces/RSAPublicKeyTest.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/security2/test/common/unit/java/security/interfaces/RSAPublicKeyTest.java Tue Jan 31 03:01:12 2006
@@ -25,13 +25,13 @@
import java.math.BigInteger;
import java.security.interfaces.RSAPublicKey;
-import org.apache.harmony.security.test.PerformanceTest;
+import junit.framework.TestCase;
/**
* Tests for <code>RSAPublicKey</code> class field
*
*/
-public class RSAPublicKeyTest extends PerformanceTest {
+public class RSAPublicKeyTest extends TestCase {
/**
* Constructor for RSAPublicKeyTest.
@@ -72,4 +72,4 @@
return null;
}
}
-}
\ No newline at end of file
+}
Modified: incubator/harmony/enhanced/classlib/trunk/modules/security2/test/common/unit/java/security/spec/DSAParameterSpecTest.java
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/modules/security2/test/common/unit/java/security/spec/DSAParameterSpecTest.java?rev=373789&r1=373788&r2=373789&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/security2/test/common/unit/java/security/spec/DSAParameterSpecTest.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/security2/test/common/unit/java/security/spec/DSAParameterSpecTest.java Tue Jan 31 03:01:12 2006
@@ -23,14 +23,14 @@
import java.math.BigInteger;
-import org.apache.harmony.security.test.PerformanceTest;
+import junit.framework.TestCase;
/**
* Tests for <code>DSAParameterSpec</code>
*
*/
-public class DSAParameterSpecTest extends PerformanceTest {
+public class DSAParameterSpecTest extends TestCase {
/**
* @see TestCase#setUp()
Modified: incubator/harmony/enhanced/classlib/trunk/modules/security2/test/common/unit/java/security/spec/DSAPrivateKeySpecTest.java
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/modules/security2/test/common/unit/java/security/spec/DSAPrivateKeySpecTest.java?rev=373789&r1=373788&r2=373789&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/security2/test/common/unit/java/security/spec/DSAPrivateKeySpecTest.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/security2/test/common/unit/java/security/spec/DSAPrivateKeySpecTest.java Tue Jan 31 03:01:12 2006
@@ -23,14 +23,14 @@
import java.math.BigInteger;
-import org.apache.harmony.security.test.PerformanceTest;
+import junit.framework.TestCase;
/**
* Tests for <code>DSAPrivateKeySpec</code>
*
*/
-public class DSAPrivateKeySpecTest extends PerformanceTest {
+public class DSAPrivateKeySpecTest extends TestCase {
/**
* @see TestCase#setUp()
Modified: incubator/harmony/enhanced/classlib/trunk/modules/security2/test/common/unit/java/security/spec/DSAPublicKeySpecTest.java
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/modules/security2/test/common/unit/java/security/spec/DSAPublicKeySpecTest.java?rev=373789&r1=373788&r2=373789&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/security2/test/common/unit/java/security/spec/DSAPublicKeySpecTest.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/security2/test/common/unit/java/security/spec/DSAPublicKeySpecTest.java Tue Jan 31 03:01:12 2006
@@ -23,14 +23,14 @@
import java.math.BigInteger;
-import org.apache.harmony.security.test.PerformanceTest;
+import junit.framework.TestCase;
/**
* Tests for <code>DSAPublicKeySpec</code>
*
*/
-public class DSAPublicKeySpecTest extends PerformanceTest {
+public class DSAPublicKeySpecTest extends TestCase {
/**
* @see TestCase#setUp()
Modified: incubator/harmony/enhanced/classlib/trunk/modules/security2/test/common/unit/java/security/spec/ECFieldF2mTest.java
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/modules/security2/test/common/unit/java/security/spec/ECFieldF2mTest.java?rev=373789&r1=373788&r2=373789&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/security2/test/common/unit/java/security/spec/ECFieldF2mTest.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/security2/test/common/unit/java/security/spec/ECFieldF2mTest.java Tue Jan 31 03:01:12 2006
@@ -24,23 +24,14 @@
import java.math.BigInteger;
import java.util.Arrays;
-import org.apache.harmony.security.test.PerformanceTest;
+import junit.framework.TestCase;
/**
* Tests for <code>ECFieldF2m</code> class fields and methods.
*
*/
-public class ECFieldF2mTest extends PerformanceTest {
-
- /**
- * <code>PASSED</code> - test status 'passed'
- */
- private static final long PASSED = 0L;
- /**
- * <code>FAILED</code> - test status 'failed'
- */
- private static final long FAILED = 1L;
+public class ECFieldF2mTest extends TestCase {
/**
* Support class for this test.
@@ -156,36 +147,27 @@
* Assertion: IllegalArgumentException if m is not positive.
*/
public final void testECFieldF2mint() {
- long result = PASSED;
for(int i=0; i<intCtorTestParameters.length; i++) {
ECFieldF2mDomainParams tp = intCtorTestParameters[i];
try {
// perform test
- ECField f = new ECFieldF2m(tp.m);
+ new ECFieldF2m(tp.m);
- if (tp.x == null) {
- // passed
- } else {
+ if (tp.x != null) {
// exception has been expected
- result |= (FAILED << i);
- loglnError(getName() + ", set " + i +
+ fail(getName() + ", set " + i +
" FAILED: expected exception has not been thrown");
}
} catch (Exception e){
- if (tp.x != null && e.getClass().isInstance(tp.x)) {
- // passed
- logln(getName() + ", set " + i + ": " + e);
- } else {
+ if (tp.x == null || !e.getClass().isInstance(tp.x)) {
// exception: failure
// if it has not been expected
// or wrong one has been thrown
- result |= (FAILED << i);
- loglnError(getName() + ", set " + i +
+ fail(getName() + ", set " + i +
" FAILED: unexpected " + e);
}
}
}
- assertTrue(result == PASSED);
}
/**
@@ -286,36 +268,27 @@
* Assertion: IllegalArgumentException if rp is invalid.
*/
public final void testECFieldF2mintBigInteger() {
- long result = PASSED;
for(int i=0; i<intBigIntegerCtorTestParameters.length; i++) {
ECFieldF2mDomainParams tp = intBigIntegerCtorTestParameters[i];
try {
// perform test
- ECField f = new ECFieldF2m(tp.m, tp.rp);
+ new ECFieldF2m(tp.m, tp.rp);
- if (tp.x == null) {
- // passed
- } else {
+ if (tp.x != null) {
// exception has been expected
- result |= (FAILED << i);
- loglnError(getName() + ", set " + i +
+ fail(getName() + ", set " + i +
" FAILED: expected exception has not been thrown");
}
} catch (Exception e){
- if (tp.x != null && e.getClass().isInstance(tp.x)) {
- // passed
- logln(getName() + ", set " + i + ": " + e);
- } else {
+ if (tp.x == null || !e.getClass().isInstance(tp.x)) {
// exception: failure
// if it has not been expected
// or wrong one has been thrown
- result |= (FAILED << i);
- loglnError(getName() + ", set " + i +
+ fail(getName() + ", set " + i +
" FAILED: unexpected " + e);
}
}
}
- assertTrue(result == PASSED);
}
/**
@@ -420,36 +393,27 @@
* Assertion: IllegalArgumentException if ks is invalid.
*/
public final void testECFieldF2mintintArray() {
- long result = PASSED;
for(int i=0; i<intIntArrayCtorTestParameters.length; i++) {
ECFieldF2mDomainParams tp = intIntArrayCtorTestParameters[i];
try {
// perform test
- ECField f = new ECFieldF2m(tp.m, tp.ks);
+ new ECFieldF2m(tp.m, tp.ks);
- if (tp.x == null) {
- // passed
- } else {
+ if (tp.x != null) {
// exception has been expected
- result |= (FAILED << i);
- loglnError(getName() + ", set " + i +
+ fail(getName() + ", set " + i +
" FAILED: expected exception has not been thrown");
}
} catch (Exception e){
- if (tp.x != null && e.getClass().isInstance(tp.x)) {
- // passed
- logln(getName() + ", set " + i + ": " + e);
- } else {
+ if (tp.x == null || !e.getClass().isInstance(tp.x)) {
// exception: failure
// if it has not been expected
// or wrong one has been thrown
- result |= (FAILED << i);
- loglnError(getName() + ", set " + i +
+ fail(getName() + ", set " + i +
" FAILED: unexpected " + e);
}
}
}
- assertTrue(result == PASSED);
}
/**
Modified: incubator/harmony/enhanced/classlib/trunk/modules/security2/test/common/unit/java/security/spec/ECFieldFpTest.java
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/modules/security2/test/common/unit/java/security/spec/ECFieldFpTest.java?rev=373789&r1=373788&r2=373789&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/security2/test/common/unit/java/security/spec/ECFieldFpTest.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/security2/test/common/unit/java/security/spec/ECFieldFpTest.java Tue Jan 31 03:01:12 2006
@@ -23,14 +23,14 @@
import java.math.BigInteger;
-import org.apache.harmony.security.test.PerformanceTest;
+import junit.framework.TestCase;
/**
* Tests for <code>ECFieldFp</code> class fields and methods.
*
*/
-public class ECFieldFpTest extends PerformanceTest {
+public class ECFieldFpTest extends TestCase {
/**
* @see TestCase#setUp()
*/
@@ -64,7 +64,7 @@
* using valid <code>p</code> (odd prime)
*/
public final void testECFieldFp01() {
- assertTrue(new ECFieldFp(BigInteger.valueOf(23L)) instanceof ECFieldFp);
+ new ECFieldFp(BigInteger.valueOf(23L));
}
/**
@@ -74,7 +74,7 @@
* using valid <code>p</code> (odd but not prime)
*/
public final void testECFieldFp02() {
- assertTrue(new ECFieldFp(BigInteger.valueOf(21L)) instanceof ECFieldFp);
+ new ECFieldFp(BigInteger.valueOf(21L));
}
/**
@@ -83,20 +83,12 @@
* Assertion: IllegalArgumentException if <code>p</code> is not positive
*/
public final void testECFieldFp03() {
- boolean passed = false;
try {
- ECFieldFp f = new ECFieldFp(BigInteger.valueOf(-1L));
- loglnError(getName() +
+ new ECFieldFp(BigInteger.valueOf(-1L));
+ fail(getName() +
" FAILED: expected exception has not been thrown");
- } catch (Exception e) {
- if (e instanceof IllegalArgumentException) {
- passed = true;
- logln(getName() + ": " + e);
- } else {
- loglnError(getName() + " FAILED: unexpected exception " + e);
- }
+ } catch (IllegalArgumentException e) {
}
- assertTrue(passed);
}
/**
@@ -105,20 +97,12 @@
* Assertion: IllegalArgumentException if <code>p</code> is not positive
*/
public final void testECFieldFp04() {
- boolean passed = false;
try {
- ECFieldFp f = new ECFieldFp(BigInteger.valueOf(0L));
- loglnError(getName() +
+ new ECFieldFp(BigInteger.valueOf(0L));
+ fail(getName() +
" FAILED: expected exception has not been thrown");
- } catch (Exception e) {
- if (e instanceof IllegalArgumentException) {
- passed = true;
- logln(getName() + ": " + e);
- } else {
- loglnError(getName() + " FAILED: unexpected exception " + e);
- }
+ } catch (IllegalArgumentException e) {
}
- assertTrue(passed);
}
/**
@@ -127,20 +111,12 @@
* Assertion: NullPointerException if <code>p</code> is null
*/
public final void testECFieldFp05() {
- boolean passed = false;
try {
- ECFieldFp f = new ECFieldFp(null);
- loglnError(getName() +
+ new ECFieldFp(null);
+ fail(getName() +
" FAILED: expected exception has not been thrown");
- } catch (Exception e) {
- if (e instanceof NullPointerException) {
- passed = true;
- logln(getName() + ": " + e);
- } else {
- loglnError(getName() + " FAILED: unexpected exception " + e);
- }
+ } catch (NullPointerException e) {
}
- assertTrue(passed);
}
/**
Modified: incubator/harmony/enhanced/classlib/trunk/modules/security2/test/common/unit/java/security/spec/ECGenParameterSpecTest.java
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/modules/security2/test/common/unit/java/security/spec/ECGenParameterSpecTest.java?rev=373789&r1=373788&r2=373789&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/security2/test/common/unit/java/security/spec/ECGenParameterSpecTest.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/security2/test/common/unit/java/security/spec/ECGenParameterSpecTest.java Tue Jan 31 03:01:12 2006
@@ -21,13 +21,13 @@
package java.security.spec;
-import org.apache.harmony.security.test.PerformanceTest;
+import junit.framework.TestCase;
/**
* Tests for <code>ECGenParameterSpec</code> class fields and methods.
*
*/
-public class ECGenParameterSpecTest extends PerformanceTest {
+public class ECGenParameterSpecTest extends TestCase {
/**
* @see TestCase#setUp()
Modified: incubator/harmony/enhanced/classlib/trunk/modules/security2/test/common/unit/java/security/spec/ECParameterSpecTest.java
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/modules/security2/test/common/unit/java/security/spec/ECParameterSpecTest.java?rev=373789&r1=373788&r2=373789&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/security2/test/common/unit/java/security/spec/ECParameterSpecTest.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/security2/test/common/unit/java/security/spec/ECParameterSpecTest.java Tue Jan 31 03:01:12 2006
@@ -23,14 +23,14 @@
import java.math.BigInteger;
-import org.apache.harmony.security.test.PerformanceTest;
+import junit.framework.TestCase;
/**
* Tests for <code>ECParameterSpec</code> class fields and methods.
*
*/
-public class ECParameterSpecTest extends PerformanceTest {
+public class ECParameterSpecTest extends TestCase {
/*
* @see TestCase#setUp()
@@ -76,8 +76,7 @@
BigInteger.ZERO,
BigInteger.valueOf(4L));
ECPoint g = new ECPoint(BigInteger.ZERO, BigInteger.valueOf(2L));
- AlgorithmParameterSpec ps =
- new ECParameterSpec(c, g, BigInteger.valueOf(5L), 10);
+ new ECParameterSpec(c, g, BigInteger.valueOf(5L), 10);
}
/**
@@ -95,49 +94,37 @@
BigInteger.valueOf(4L));
ECPoint generator = new ECPoint(BigInteger.ZERO, BigInteger.valueOf(2L));
BigInteger order = BigInteger.valueOf(5L);
+
// Test case 1: curve is null
- boolean passed = false;
try {
- AlgorithmParameterSpec ps =
- new ECParameterSpec(null, generator, order, 10);
+ new ECParameterSpec(null, generator, order, 10);
+ fail("#1: Expected NPE not thrown");
} catch (NullPointerException ok) {
- passed = true;
- logln(getName() + ": " + ok);
}
- assertTrue(passed);
+
// Test case 2: generator is null
- passed = false;
try {
- AlgorithmParameterSpec ps =
- new ECParameterSpec(curve, null, order, 10);
+ new ECParameterSpec(curve, null, order, 10);
+ fail("#2: Expected NPE not thrown");
} catch (NullPointerException ok) {
- passed = true;
- logln(getName() + ": " + ok);
}
- assertTrue(passed);
+
// Test case 3: order is null
- passed = false;
try {
- AlgorithmParameterSpec ps =
- new ECParameterSpec(curve, generator, null, 10);
+ new ECParameterSpec(curve, generator, null, 10);
+ fail("#3: Expected NPE not thrown");
} catch (NullPointerException ok) {
- passed = true;
- logln(getName() + ": " + ok);
}
- assertTrue(passed);
+
// Test case 4: all above are null
- passed = false;
try {
- AlgorithmParameterSpec ps =
- new ECParameterSpec(null, null, null, 10);
+ new ECParameterSpec(null, null, null, 10);
+ fail("#4: Expected NPE not thrown");
} catch (NullPointerException ok) {
- passed = true;
- logln(getName() + ": " + ok);
}
- assertTrue(passed);
}
/**
@@ -154,65 +141,46 @@
BigInteger.ZERO,
BigInteger.valueOf(4L));
ECPoint generator = new ECPoint(BigInteger.ZERO, BigInteger.valueOf(2L));
+
+
// Test case 1: order is negative
- boolean passed = false;
try {
- AlgorithmParameterSpec ps =
- new ECParameterSpec(curve, generator,
- BigInteger.valueOf(-5L), 10);
+ new ECParameterSpec(curve, generator, BigInteger.valueOf(-5L), 10);
+ fail("#1: Expected IAE not thrown");
} catch (IllegalArgumentException ok) {
- passed = true;
- logln(getName() + ": " + ok);
}
- assertTrue(passed);
+
// Test case 2: order == 0
- passed = false;
try {
- AlgorithmParameterSpec ps =
- new ECParameterSpec(curve, generator,
- BigInteger.ZERO, 10);
+ new ECParameterSpec(curve, generator, BigInteger.ZERO, 10);
+ fail("#2: Expected IAE not thrown");
} catch (IllegalArgumentException ok) {
- passed = true;
- logln(getName() + ": " + ok);
}
- assertTrue(passed);
+
// Test case 3: cofactor is negative
- passed = false;
try {
- AlgorithmParameterSpec ps =
- new ECParameterSpec(curve, generator,
- BigInteger.valueOf(5L), -10);
+ new ECParameterSpec(curve, generator, BigInteger.valueOf(5L), -10);
+ fail("#3: Expected IAE not thrown");
} catch (IllegalArgumentException ok) {
- passed = true;
- logln(getName() + ": " + ok);
}
- assertTrue(passed);
+
// Test case 4: cofactor == 0
- passed = false;
try {
- AlgorithmParameterSpec ps =
- new ECParameterSpec(curve, generator,
- BigInteger.valueOf(5L), 0);
+ new ECParameterSpec(curve, generator, BigInteger.valueOf(5L), 0);
+ fail("#4: Expected IAE not thrown");
} catch (IllegalArgumentException ok) {
- passed = true;
- logln(getName() + ": " + ok);
}
- assertTrue(passed);
+
// Test case 5: both order and cofactor are not positive
- passed = false;
try {
- AlgorithmParameterSpec ps =
- new ECParameterSpec(curve, generator,
- BigInteger.valueOf(-5L), 0);
+ new ECParameterSpec(curve, generator, BigInteger.valueOf(-5L), 0);
+ fail("#5: Expected IAE not thrown");
} catch (IllegalArgumentException ok) {
- passed = true;
- logln(getName() + ": " + ok);
}
- assertTrue(passed);
}
/**
Modified: incubator/harmony/enhanced/classlib/trunk/modules/security2/test/common/unit/java/security/spec/ECPointTest.java
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/modules/security2/test/common/unit/java/security/spec/ECPointTest.java?rev=373789&r1=373788&r2=373789&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/security2/test/common/unit/java/security/spec/ECPointTest.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/security2/test/common/unit/java/security/spec/ECPointTest.java Tue Jan 31 03:01:12 2006
@@ -23,14 +23,14 @@
import java.math.BigInteger;
-import org.apache.harmony.security.test.PerformanceTest;
+import junit.framework.TestCase;
/**
* Tests for <code>ECPoint</code> class fields and methods.
*
*/
-public class ECPointTest extends PerformanceTest {
+public class ECPointTest extends TestCase {
/*
* @see TestCase#setUp()
@@ -65,11 +65,11 @@
* Expected: must pass without any exceptions
*/
public final void testECPoint01() {
- ECPoint p = new ECPoint(BigInteger.ZERO, BigInteger.ZERO);
- p = new ECPoint(BigInteger.valueOf(-23456L), BigInteger.valueOf(-23456L));
- p = new ECPoint(BigInteger.valueOf(123456L), BigInteger.valueOf(123456L));
- p = new ECPoint(BigInteger.valueOf(-56L), BigInteger.valueOf(234L));
- p = new ECPoint(BigInteger.valueOf(3456L), BigInteger.valueOf(-2344L));
+ 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));
}
/**
@@ -80,35 +80,28 @@
* Expected: must throw <code>NullPointerException</code>
*/
public final void testECPoint02() {
- boolean passed=false;
// test case 1: x is null
try {
- ECPoint p = new ECPoint(null, BigInteger.ZERO);
+ new ECPoint(null, BigInteger.ZERO);
+ fail("#1: Expected NPE not thrown");
} catch (NullPointerException ok) {
- passed=true;
- logln(getName() + ": " + ok);
}
- assertTrue(passed);
- passed=false;
+
// test case 2: y is null
try {
- ECPoint p = new ECPoint(BigInteger.ZERO, null);
+ new ECPoint(BigInteger.ZERO, null);
+ fail("#2: Expected NPE not thrown");
} catch (NullPointerException ok) {
- passed=true;
- logln(getName() + ": " + ok);
}
- assertTrue(passed);
- passed=false;
+
// test case 3: both : x and y are null
try {
- ECPoint p = new ECPoint(null, null);
+ new ECPoint(null, null);
+ fail("#3: Expected NPE not thrown");
} catch (NullPointerException ok) {
- passed=true;
- logln(getName() + ": " + ok);
}
- assertTrue(passed);
}
/**
@@ -227,7 +220,6 @@
public final void testHashCode01() {
ECPoint f = new ECPoint(BigInteger.valueOf(-23457L), BigInteger.ONE);
int hc = f.hashCode();
- logln(getName() + ": " + hc);
assertTrue(hc == f.hashCode() &&
hc == f.hashCode() &&
hc == f.hashCode() &&
@@ -236,10 +228,10 @@
hc == f.hashCode() &&
hc == f.hashCode() &&
hc == f.hashCode());
+
// the same for POINT_INFINITY
hc = ECPoint.POINT_INFINITY.hashCode();
- logln(getName() + ": " + hc);
assertTrue(hc == ECPoint.POINT_INFINITY.hashCode() &&
hc == ECPoint.POINT_INFINITY.hashCode() &&
hc == ECPoint.POINT_INFINITY.hashCode() &&
Modified: incubator/harmony/enhanced/classlib/trunk/modules/security2/test/common/unit/java/security/spec/ECPrivateKeySpecTest.java
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/modules/security2/test/common/unit/java/security/spec/ECPrivateKeySpecTest.java?rev=373789&r1=373788&r2=373789&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/security2/test/common/unit/java/security/spec/ECPrivateKeySpecTest.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/security2/test/common/unit/java/security/spec/ECPrivateKeySpecTest.java Tue Jan 31 03:01:12 2006
@@ -23,14 +23,14 @@
import java.math.BigInteger;
-import org.apache.harmony.security.test.PerformanceTest;
+import junit.framework.TestCase;
/**
* Tests for <code>ECPrivateKeySpec</code> class fields and methods.
*
*/
-public class ECPrivateKeySpecTest extends PerformanceTest {
+public class ECPrivateKeySpecTest extends TestCase {
/*
* @see TestCase#setUp()
@@ -76,9 +76,8 @@
BigInteger.ZERO,
BigInteger.valueOf(4L));
ECPoint g = new ECPoint(BigInteger.ZERO, BigInteger.valueOf(2L));
- ECPrivateKeySpec ks =
- new ECPrivateKeySpec(BigInteger.ZERO,
- new ECParameterSpec(c, g, BigInteger.valueOf(5L), 10));
+ new ECPrivateKeySpec(BigInteger.ZERO,
+ new ECParameterSpec(c, g, BigInteger.valueOf(5L), 10));
}
@@ -98,36 +97,28 @@
ECPoint g = new ECPoint(BigInteger.ZERO, BigInteger.valueOf(2L));
// Test case 1: s is null
- boolean passed = false;
try {
- ECPrivateKeySpec ks = new ECPrivateKeySpec(null,
+ new ECPrivateKeySpec(null,
new ECParameterSpec(c, g, BigInteger.valueOf(5L), 10));
+ fail("#1: Expected NPE not thrown");
} catch (NullPointerException ok) {
- passed = true;
- logln(getName() + ": " + ok);
}
- assertTrue(passed);
+
// Test case 2: params is null
- passed = false;
try {
- ECPrivateKeySpec ks = new ECPrivateKeySpec(BigInteger.valueOf(0L),
- null);
+ new ECPrivateKeySpec(BigInteger.valueOf(0L), null);
+ fail("#2: Expected NPE not thrown");
} catch (NullPointerException ok) {
- passed = true;
- logln(getName() + ": " + ok);
}
- assertTrue(passed);
+
// Test case 3: both s and params are null
- passed = false;
try {
- ECPrivateKeySpec ks = new ECPrivateKeySpec(null, null);
+ new ECPrivateKeySpec(null, null);
+ fail("#3: Expected NPE not thrown");
} catch (NullPointerException ok) {
- passed = true;
- logln(getName() + ": " + ok);
}
- assertTrue(passed);
}
/**
Modified: incubator/harmony/enhanced/classlib/trunk/modules/security2/test/common/unit/java/security/spec/ECPublicKeySpecTest.java
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/modules/security2/test/common/unit/java/security/spec/ECPublicKeySpecTest.java?rev=373789&r1=373788&r2=373789&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/security2/test/common/unit/java/security/spec/ECPublicKeySpecTest.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/security2/test/common/unit/java/security/spec/ECPublicKeySpecTest.java Tue Jan 31 03:01:12 2006
@@ -23,14 +23,14 @@
import java.math.BigInteger;
-import org.apache.harmony.security.test.PerformanceTest;
+import junit.framework.TestCase;
/**
* Tests for <code>ECPublicKeySpec</code> class fields and methods.
*
*/
-public class ECPublicKeySpecTest extends PerformanceTest {
+public class ECPublicKeySpecTest extends TestCase {
/*
* @see TestCase#setUp()
@@ -76,9 +76,8 @@
BigInteger.ZERO,
BigInteger.valueOf(4L));
ECPoint g = new ECPoint(BigInteger.ZERO, BigInteger.valueOf(2L));
- ECPublicKeySpec ks =
- new ECPublicKeySpec(g,
- new ECParameterSpec(c, g, BigInteger.valueOf(5L), 10));
+ new ECPublicKeySpec(g,
+ new ECParameterSpec(c, g, BigInteger.valueOf(5L), 10));
}
@@ -98,35 +97,28 @@
ECPoint g = new ECPoint(BigInteger.ZERO, BigInteger.valueOf(2L));
// Test case 1: w is null
- boolean passed = false;
try {
- ECPublicKeySpec ks = new ECPublicKeySpec(null,
+ new ECPublicKeySpec(null,
new ECParameterSpec(c, g, BigInteger.valueOf(5L), 10));
+ fail("#1: Expected NPE not thrown");
} catch (NullPointerException ok) {
- passed = true;
- logln(getName() + ": " + ok);
}
- assertTrue(passed);
+
// Test case 2: params is null
- passed = false;
try {
- ECPublicKeySpec ks = new ECPublicKeySpec(g, null);
+ new ECPublicKeySpec(g, null);
+ fail("#2: Expected NPE not thrown");
} catch (NullPointerException ok) {
- passed = true;
- logln(getName() + ": " + ok);
}
- assertTrue(passed);
+
// Test case 3: both w and params are null
- passed = false;
try {
- ECPublicKeySpec ks = new ECPublicKeySpec(null, null);
+ new ECPublicKeySpec(null, null);
+ fail("#3: Expected NPE not thrown");
} catch (NullPointerException ok) {
- passed = true;
- logln(getName() + ": " + ok);
}
- assertTrue(passed);
}
/**
@@ -144,16 +136,13 @@
BigInteger.ZERO,
BigInteger.valueOf(4L));
ECPoint g = new ECPoint(BigInteger.ZERO, BigInteger.valueOf(2L));
- boolean passed = false;
+
try {
- ECPublicKeySpec ks =
- new ECPublicKeySpec(ECPoint.POINT_INFINITY,
- new ECParameterSpec(c, g, BigInteger.valueOf(5L), 10));
+ new ECPublicKeySpec(ECPoint.POINT_INFINITY,
+ new ECParameterSpec(c, g, BigInteger.valueOf(5L), 10));
+ fail("Expected IAE not thrown");
} catch (IllegalArgumentException ok) {
- passed = true;
- logln(getName() + ": " + ok);
}
- assertTrue(passed);
}
/**
Modified: incubator/harmony/enhanced/classlib/trunk/modules/security2/test/common/unit/java/security/spec/EllipticCurveTest.java
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/modules/security2/test/common/unit/java/security/spec/EllipticCurveTest.java?rev=373789&r1=373788&r2=373789&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/security2/test/common/unit/java/security/spec/EllipticCurveTest.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/security2/test/common/unit/java/security/spec/EllipticCurveTest.java Tue Jan 31 03:01:12 2006
@@ -24,14 +24,14 @@
import java.math.BigInteger;
import java.util.Arrays;
-import org.apache.harmony.security.test.PerformanceTest;
+import junit.framework.TestCase;
/**
* Tests for <code>EllipticCurve</code> class fields and methods.
*
*/
-public class EllipticCurveTest extends PerformanceTest {
+public class EllipticCurveTest extends TestCase {
/*
* @see TestCase#setUp()
@@ -73,14 +73,14 @@
BigInteger b = BigInteger.valueOf(19L);
byte[] seed = new byte[24];
// perform test case 1
- EllipticCurve c = new EllipticCurve(f, a, b, seed);
+ new EllipticCurve(f, a, b, seed);
// test case 2 parameters set
ECFieldF2m f1 = new ECFieldF2m(5);
a = BigInteger.ZERO;
b = BigInteger.valueOf(23L);
// perform test case 2
- c = new EllipticCurve(f1, a, b, seed);
+ new EllipticCurve(f1, a, b, seed);
// test case 3 parameters set,
// the seed parameter may be null
@@ -89,7 +89,7 @@
b = BigInteger.valueOf(19L);
seed = null;
// perform test case 3
- c = new EllipticCurve(f, a, b, seed);
+ new EllipticCurve(f, a, b, seed);
}
/**
@@ -101,22 +101,20 @@
* Expected: must throw <code>NullPointerException</code>
*/
public final void testEllipticCurveECFieldBigIntegerBigIntegerbyteArray02() {
- boolean passed=false;
// test case 1 parameters set
ECFieldFp f = null;
BigInteger a = BigInteger.ONE;
BigInteger b = BigInteger.valueOf(19L);
byte[] seed = new byte[24];
+
// perform test case 1
try {
- EllipticCurve c = new EllipticCurve(f, a, b, seed);
+ new EllipticCurve(f, a, b, seed);
+ fail("#1: Expected NPE not thrown");
} catch (NullPointerException ok) {
- passed=true;
- logln(getName() + ": " + ok);
}
- assertTrue(passed);
- passed=false;
+
// test case 2 parameters set,
f = new ECFieldFp(BigInteger.valueOf(23L));
a = null;
@@ -124,28 +122,23 @@
seed = new byte[24];
// perform test case 2
try {
- EllipticCurve c = new EllipticCurve(f, a, b, seed);
+ new EllipticCurve(f, a, b, seed);
+ fail("#2: Expected NPE not thrown");
} catch (NullPointerException ok) {
- passed=true;
- logln(getName() + ": " + ok);
}
- assertTrue(passed);
// test case 3 parameters set,
- passed=false;
f = new ECFieldFp(BigInteger.valueOf(23L));
a = BigInteger.ONE;
b = null;
seed = new byte[24];
// perform test case 2
try {
- EllipticCurve c = new EllipticCurve(f, a, b, seed);
+ new EllipticCurve(f, a, b, seed);
+ fail("#3: Expected NPE not thrown");
} catch (NullPointerException ok) {
- passed=true;
- logln(getName() + ": " + ok);
}
- assertTrue(passed);
}
/**
@@ -159,69 +152,60 @@
* Expected: must throw <code>IllegalArgumentException</code>
*/
public final void testEllipticCurveECFieldBigIntegerBigIntegerbyteArray03() {
- boolean passed=false;
// test case 1 parameters set,
// a is not in field
ECFieldFp f = new ECFieldFp(BigInteger.valueOf(23L));
BigInteger a = BigInteger.valueOf(24L);
BigInteger b = BigInteger.valueOf(19L);
byte[] seed = new byte[24];
+
// perform test case 1
try {
- EllipticCurve c = new EllipticCurve(f, a, b, seed);
+ new EllipticCurve(f, a, b, seed);
+ fail("#1: Expected IAE not thrown");
} catch (IllegalArgumentException ok) {
- passed=true;
- logln(getName() + ": " + ok);
}
- assertTrue(passed);
- passed=false;
+
// test case 1.1 parameters set,
// b is not in field
f = new ECFieldFp(BigInteger.valueOf(23L));
a = BigInteger.valueOf(1L);
b = BigInteger.valueOf(23L);
seed = new byte[24];
- // perform test case 1
+ // perform test case 1.1
try {
- EllipticCurve c = new EllipticCurve(f, a, b, seed);
+ new EllipticCurve(f, a, b, seed);
+ fail("#1.1: Expected IAE not thrown");
} catch (IllegalArgumentException ok) {
- passed=true;
- logln(getName() + ": " + ok);
}
- assertTrue(passed);
// test case 2 parameters set,
// b is not in field
- passed=false;
f = new ECFieldFp(BigInteger.valueOf(23L));
a = BigInteger.valueOf(19L);
b = BigInteger.valueOf(24L);
seed = new byte[24];
// perform test case 2
try {
- EllipticCurve c = new EllipticCurve(f, a, b, seed);
+ new EllipticCurve(f, a, b, seed);
+ fail("#2: Expected IAE not thrown");
} catch (IllegalArgumentException ok) {
- passed=true;
- logln(getName() + ": " + ok);
}
- assertTrue(passed);
+
// test case 3 parameters set,
// both a and b are not in field
- passed=false;
f = new ECFieldFp(BigInteger.valueOf(23L));
a = BigInteger.valueOf(25L);
b = BigInteger.valueOf(240L);
seed = new byte[24];
// perform test case 3
try {
- EllipticCurve c = new EllipticCurve(f, a, b, seed);
+ new EllipticCurve(f, a, b, seed);
+ fail("#3: Expected IAE not thrown");
} catch (IllegalArgumentException ok) {
- passed=true;
- logln(getName() + ": " + ok);
}
- assertTrue(passed);
}
/**
@@ -235,53 +219,48 @@
* Expected: must throw <code>IllegalArgumentException</code>
*/
public final void testEllipticCurveECFieldBigIntegerBigIntegerbyteArray04() {
- boolean passed=false;
// test case 1 parameters set,
// a is not in field
ECFieldF2m f = new ECFieldF2m(5);
BigInteger a = BigInteger.valueOf(32L);
BigInteger b = BigInteger.valueOf(19L);
byte[] seed = new byte[24];
+
+
// perform test case 1
try {
- EllipticCurve c = new EllipticCurve(f, a, b, seed);
+ new EllipticCurve(f, a, b, seed);
+ fail("#1: Expected IAE not thrown");
} catch (IllegalArgumentException ok) {
- passed=true;
- logln(getName() + ": " + ok);
}
- assertTrue(passed);
+
// test case 2 parameters set,
// b is not in field
- passed=false;
f = new ECFieldF2m(5);
a = BigInteger.valueOf(19L);
b = BigInteger.valueOf(32L);
seed = new byte[24];
// perform test case 2
try {
- EllipticCurve c = new EllipticCurve(f, a, b, seed);
+ new EllipticCurve(f, a, b, seed);
+ fail("#2: Expected IAE not thrown");
} catch (IllegalArgumentException ok) {
- passed=true;
- logln(getName() + ": " + ok);
}
- assertTrue(passed);
+
// test case 3 parameters set,
// both a and b are not in field
- passed=false;
f = new ECFieldF2m(5);
a = BigInteger.valueOf(32L);
b = BigInteger.valueOf(43L);
seed = new byte[24];
// perform test case 3
try {
- EllipticCurve c = new EllipticCurve(f, a, b, seed);
+ new EllipticCurve(f, a, b, seed);
+ fail("#3: Expected IAE not thrown");
} catch (IllegalArgumentException ok) {
- passed=true;
- logln(getName() + ": " + ok);
}
- assertTrue(passed);
}
/**
@@ -318,14 +297,14 @@
BigInteger a = BigInteger.ONE;
BigInteger b = BigInteger.valueOf(19L);
// perform test case 1
- EllipticCurve c = new EllipticCurve(f, a, b);
+ new EllipticCurve(f, a, b);
// test case 2 parameters set
ECFieldF2m f1 = new ECFieldF2m(5);
a = BigInteger.ZERO;
b = BigInteger.valueOf(23L);
// perform test case 2
- c = new EllipticCurve(f1, a, b);
+ new EllipticCurve(f1, a, b);
// test case 3 parameters set,
// the seed parameter may be null
@@ -333,7 +312,7 @@
a = BigInteger.ONE;
b = BigInteger.valueOf(19L);
// perform test case 3
- c = new EllipticCurve(f, a, b);
+ new EllipticCurve(f, a, b);
}
/**
@@ -345,48 +324,41 @@
* Expected: must throw <code>NullPointerException</code>
*/
public final void testEllipticCurveECFieldBigIntegerBigInteger02() {
- boolean passed=false;
// test case 1 parameters set
ECFieldFp f = null;
BigInteger a = BigInteger.ONE;
BigInteger b = BigInteger.valueOf(19L);
+
// perform test case 1
try {
- EllipticCurve c = new EllipticCurve(f, a, b);
+ new EllipticCurve(f, a, b);
+ fail("#1: Expected NPE not thrown");
} catch (NullPointerException ok) {
- passed=true;
- logln(getName() + ": " + ok);
}
- assertTrue(passed);
- passed=false;
+
// test case 2 parameters set,
f = new ECFieldFp(BigInteger.valueOf(23L));
a = null;
b = BigInteger.valueOf(19L);
// perform test case 2
try {
- EllipticCurve c = new EllipticCurve(f, a, b);
+ new EllipticCurve(f, a, b);
+ fail("#2: Expected NPE not thrown");
} catch (NullPointerException ok) {
- passed=true;
- logln(getName() + ": " + ok);
}
- assertTrue(passed);
// test case 3 parameters set,
- passed=false;
f = new ECFieldFp(BigInteger.valueOf(23L));
a = BigInteger.ONE;
b = null;
- // perform test case 2
+ // perform test case 3
try {
- EllipticCurve c = new EllipticCurve(f, a, b);
+ new EllipticCurve(f, a, b);
+ fail("#3: Expected NPE not thrown");
} catch (NullPointerException ok) {
- passed=true;
- logln(getName() + ": " + ok);
}
- assertTrue(passed);
}
/**
@@ -400,65 +372,57 @@
* Expected: must throw <code>IllegalArgumentException</code>
*/
public final void testEllipticCurveECFieldBigIntegerBigInteger03() {
- boolean passed=false;
// test case 1 parameters set,
// a is not in field
ECFieldFp f = new ECFieldFp(BigInteger.valueOf(23L));
BigInteger a = BigInteger.valueOf(24L);
BigInteger b = BigInteger.valueOf(19L);
+
// perform test case 1
try {
- EllipticCurve c = new EllipticCurve(f, a, b);
+ new EllipticCurve(f, a, b);
+ fail("#1: Expected IAE not thrown");
} catch (IllegalArgumentException ok) {
- passed=true;
- logln(getName() + ": " + ok);
}
- assertTrue(passed);
- passed=false;
+
// test case 1.1 parameters set,
// a is not in field
f = new ECFieldFp(BigInteger.valueOf(23L));
a = BigInteger.valueOf(23L);
b = BigInteger.valueOf(19L);
- // perform test case 1
+ // perform test case 1.1
try {
- EllipticCurve c = new EllipticCurve(f, a, b);
+ new EllipticCurve(f, a, b);
+ fail("#1.1: Expected IAE not thrown");
} catch (IllegalArgumentException ok) {
- passed=true;
- logln(getName() + ": " + ok);
}
- assertTrue(passed);
+
// test case 2 parameters set,
// b is not in field
- passed=false;
f = new ECFieldFp(BigInteger.valueOf(23L));
a = BigInteger.valueOf(19L);
b = BigInteger.valueOf(24L);
// perform test case 2
try {
- EllipticCurve c = new EllipticCurve(f, a, b);
+ new EllipticCurve(f, a, b);
+ fail("#2: Expected IAE not thrown");
} catch (IllegalArgumentException ok) {
- passed=true;
- logln(getName() + ": " + ok);
}
- assertTrue(passed);
+
// test case 3 parameters set,
// both a and b are not in field
- passed=false;
f = new ECFieldFp(BigInteger.valueOf(23L));
a = BigInteger.valueOf(25L);
b = BigInteger.valueOf(240L);
// perform test case 3
try {
- EllipticCurve c = new EllipticCurve(f, a, b);
+ new EllipticCurve(f, a, b);
+ fail("#3: Expected IAE not thrown");
} catch (IllegalArgumentException ok) {
- passed=true;
- logln(getName() + ": " + ok);
}
- assertTrue(passed);
}
/**
@@ -472,7 +436,6 @@
* Expected: must throw <code>IllegalArgumentException</code>
*/
public final void testEllipticCurveECFieldBigIntegerBigInteger04() {
- boolean passed=false;
// test case 1 parameters set,
// a is not in field
ECFieldF2m f = new ECFieldF2m(5);
@@ -480,42 +443,36 @@
BigInteger b = BigInteger.valueOf(19L);
// perform test case 1
try {
- EllipticCurve c = new EllipticCurve(f, a, b);
+ new EllipticCurve(f, a, b);
+ fail("#1: Expected IAE not thrown");
} catch (IllegalArgumentException ok) {
- passed=true;
- logln(getName() + ": " + ok);
}
- assertTrue(passed);
+
// test case 2 parameters set,
// b is not in field
- passed=false;
f = new ECFieldF2m(5);
a = BigInteger.valueOf(19L);
b = BigInteger.valueOf(32L);
// perform test case 2
try {
- EllipticCurve c = new EllipticCurve(f, a, b);
+ new EllipticCurve(f, a, b);
+ fail("#2: Expected IAE not thrown");
} catch (IllegalArgumentException ok) {
- passed=true;
- logln(getName() + ": " + ok);
}
- assertTrue(passed);
+
// test case 3 parameters set,
// both a and b are not in field
- passed=false;
f = new ECFieldF2m(5);
a = BigInteger.valueOf(32L);
b = BigInteger.valueOf(43L);
// perform test case 3
try {
- EllipticCurve c = new EllipticCurve(f, a, b);
+ new EllipticCurve(f, a, b);
+ fail("#3: Expected IAE not thrown");
} catch (IllegalArgumentException ok) {
- passed=true;
- logln(getName() + ": " + ok);
}
- assertTrue(passed);
}
/**
@@ -626,7 +583,7 @@
BigInteger b = BigInteger.valueOf(19L);
byte[] seed = new byte[24];
EllipticCurve c = new EllipticCurve(f, a, b, seed);
- byte[] seedRet = c.getSeed();
+ c.getSeed();
assertNotSame(c.getSeed(), c.getSeed());
}
@@ -775,7 +732,6 @@
BigInteger.valueOf(19L),
new byte[24]);
hc = f.hashCode();
- logln(getName() + ": " + hc);
assertTrue(hc == f.hashCode() &&
hc == f.hashCode() &&
hc == f.hashCode() &&
Modified: incubator/harmony/enhanced/classlib/trunk/modules/security2/test/common/unit/java/security/spec/EncodedKeySpecTest.java
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/modules/security2/test/common/unit/java/security/spec/EncodedKeySpecTest.java?rev=373789&r1=373788&r2=373789&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/security2/test/common/unit/java/security/spec/EncodedKeySpecTest.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/security2/test/common/unit/java/security/spec/EncodedKeySpecTest.java Tue Jan 31 03:01:12 2006
@@ -22,7 +22,7 @@
package java.security.spec;
import org.apache.harmony.security.spec.MyEncodedKeySpec;
-import org.apache.harmony.security.test.PerformanceTest;
+import junit.framework.TestCase;
/**
@@ -30,7 +30,7 @@
*
*/
-public class EncodedKeySpecTest extends PerformanceTest {
+public class EncodedKeySpecTest extends TestCase {
/*
* @see TestCase#setUp()
Modified: incubator/harmony/enhanced/classlib/trunk/modules/security2/test/common/unit/java/security/spec/InvalidKeySpecExceptionTest.java
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/modules/security2/test/common/unit/java/security/spec/InvalidKeySpecExceptionTest.java?rev=373789&r1=373788&r2=373789&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/security2/test/common/unit/java/security/spec/InvalidKeySpecExceptionTest.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/security2/test/common/unit/java/security/spec/InvalidKeySpecExceptionTest.java Tue Jan 31 03:01:12 2006
@@ -23,7 +23,7 @@
import java.security.spec.InvalidKeySpecException;
-import org.apache.harmony.security.test.PerformanceTest;
+import junit.framework.TestCase;
/**
@@ -31,7 +31,7 @@
* methods.
*
*/
-public class InvalidKeySpecExceptionTest extends PerformanceTest {
+public class InvalidKeySpecExceptionTest extends TestCase {
public static void main(String[] args) {
}
@@ -79,7 +79,6 @@
*/
public void testInvalidKeySpecException01() {
InvalidKeySpecException tE = new InvalidKeySpecException();
- assertTrue(errNotExc, tE instanceof InvalidKeySpecException);
assertNull("getMessage() must return null.", tE.getMessage());
assertNull("getCause() must return null", tE.getCause());
try {
@@ -98,8 +97,6 @@
InvalidKeySpecException tE;
for (int i = 0; i < msgs.length; i++) {
tE = new InvalidKeySpecException(msgs[i]);
- assertTrue(errNotExc.concat(" (msg: ").concat(msgs[i]).concat(")"),
- tE instanceof InvalidKeySpecException);
assertEquals("getMessage() must return: ".concat(msgs[i]), tE
.getMessage(), msgs[i]);
assertNull("getCause() must return null", tE.getCause());
@@ -119,7 +116,6 @@
public void testInvalidKeySpecException03() {
String msg = null;
InvalidKeySpecException tE = new InvalidKeySpecException(msg);
- assertTrue(errNotExc, tE instanceof InvalidKeySpecException);
assertNull("getMessage() must return null.", tE.getMessage());
assertNull("getCause() must return null", tE.getCause());
try {
@@ -137,7 +133,6 @@
public void testInvalidKeySpecException04() {
Throwable cause = null;
InvalidKeySpecException tE = new InvalidKeySpecException(cause);
- assertTrue(errNotExc, tE instanceof InvalidKeySpecException);
assertNull("getMessage() must return null.", tE.getMessage());
assertNull("getCause() must return null", tE.getCause());
try {
@@ -154,7 +149,6 @@
*/
public void testInvalidKeySpecException05() {
InvalidKeySpecException tE = new InvalidKeySpecException(tCause);
- assertTrue(errNotExc, tE instanceof InvalidKeySpecException);
if (tE.getMessage() != null) {
String toS = tCause.toString();
String getM = tE.getMessage();
@@ -178,7 +172,6 @@
*/
public void testInvalidKeySpecException06() {
InvalidKeySpecException tE = new InvalidKeySpecException(null, null);
- assertTrue(errNotExc, tE instanceof InvalidKeySpecException);
assertNull("getMessage() must return null", tE.getMessage());
assertNull("getCause() must return null", tE.getCause());
try {
@@ -197,8 +190,6 @@
InvalidKeySpecException tE;
for (int i = 0; i < msgs.length; i++) {
tE = new InvalidKeySpecException(msgs[i], null);
- assertTrue(errNotExc.concat(" (msg: ").concat(msgs[i]).concat(")"),
- tE instanceof InvalidKeySpecException);
assertEquals("getMessage() must return: ".concat(msgs[i]), tE
.getMessage(), msgs[i]);
assertNull("getCause() must return null", tE.getCause());
@@ -217,7 +208,6 @@
*/
public void testInvalidKeySpecException08() {
InvalidKeySpecException tE = new InvalidKeySpecException(null, tCause);
- assertTrue(errNotExc, tE instanceof InvalidKeySpecException);
if (tE.getMessage() != null) {
String toS = tCause.toString();
String getM = tE.getMessage();
@@ -243,8 +233,6 @@
InvalidKeySpecException tE;
for (int i = 0; i < msgs.length; i++) {
tE = new InvalidKeySpecException(msgs[i], tCause);
- assertTrue(errNotExc.concat(" (msg: ").concat(msgs[i]).concat(")"),
- tE instanceof InvalidKeySpecException);
String getM = tE.getMessage();
String toS = tCause.toString();
if (msgs[i].length() > 0) {
@@ -266,4 +254,4 @@
}
}
}
-}
\ No newline at end of file
+}
Modified: incubator/harmony/enhanced/classlib/trunk/modules/security2/test/common/unit/java/security/spec/InvalidParameterSpecExceptionTest.java
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/modules/security2/test/common/unit/java/security/spec/InvalidParameterSpecExceptionTest.java?rev=373789&r1=373788&r2=373789&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/security2/test/common/unit/java/security/spec/InvalidParameterSpecExceptionTest.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/security2/test/common/unit/java/security/spec/InvalidParameterSpecExceptionTest.java Tue Jan 31 03:01:12 2006
@@ -23,7 +23,7 @@
import java.security.spec.InvalidParameterSpecException;
-import org.apache.harmony.security.test.PerformanceTest;
+import junit.framework.TestCase;
/**
@@ -31,7 +31,7 @@
* methods.
*
*/
-public class InvalidParameterSpecExceptionTest extends PerformanceTest {
+public class InvalidParameterSpecExceptionTest extends TestCase {
public static void main(String[] args) {
}
@@ -80,7 +80,6 @@
*/
public void testInvalidParameterSpecException01() {
InvalidParameterSpecException tE = new InvalidParameterSpecException();
- assertTrue(errNotExc, tE instanceof InvalidParameterSpecException);
assertNull("getMessage() must return null.", tE.getMessage());
assertNull("getCause() must return null", tE.getCause());
try {
@@ -99,8 +98,6 @@
InvalidParameterSpecException tE;
for (int i = 0; i < msgs.length; i++) {
tE = new InvalidParameterSpecException(msgs[i]);
- assertTrue(errNotExc.concat(" (msg: ").concat(msgs[i]).concat(")"),
- tE instanceof InvalidParameterSpecException);
assertEquals("getMessage() must return: ".concat(msgs[i]), tE
.getMessage(), msgs[i]);
assertNull("getCause() must return null", tE.getCause());
@@ -121,7 +118,6 @@
String msg = null;
InvalidParameterSpecException tE = new InvalidParameterSpecException(
msg);
- assertTrue(errNotExc, tE instanceof InvalidParameterSpecException);
assertNull("getMessage() must return null.", tE.getMessage());
assertNull("getCause() must return null", tE.getCause());
try {
@@ -131,4 +127,4 @@
}
}
-}
\ No newline at end of file
+}
Modified: incubator/harmony/enhanced/classlib/trunk/modules/security2/test/common/unit/java/security/spec/MGF1ParameterSpecTest.java
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/modules/security2/test/common/unit/java/security/spec/MGF1ParameterSpecTest.java?rev=373789&r1=373788&r2=373789&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/security2/test/common/unit/java/security/spec/MGF1ParameterSpecTest.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/security2/test/common/unit/java/security/spec/MGF1ParameterSpecTest.java Tue Jan 31 03:01:12 2006
@@ -21,13 +21,13 @@
package java.security.spec;
-import org.apache.harmony.security.test.PerformanceTest;
+import junit.framework.TestCase;
/**
* Test for MGF1ParameterSpec class
*
*/
-public class MGF1ParameterSpecTest extends PerformanceTest {
+public class MGF1ParameterSpecTest extends TestCase {
/**
* Meaningless algorithm name just for testing purposes
@@ -66,7 +66,7 @@
* object using valid parameter
*/
public final void testMGF1ParameterSpec01() {
- AlgorithmParameterSpec aps = new MGF1ParameterSpec(testAlgName);
+ new MGF1ParameterSpec(testAlgName);
}
/**
@@ -75,10 +75,9 @@
*/
public final void testMGF1ParameterSpec02() {
try {
- AlgorithmParameterSpec aps = new MGF1ParameterSpec(null);
+ new MGF1ParameterSpec(null);
fail("NullPointerException has not been thrown");
} catch (NullPointerException ok) {
- logln(getName() + ": " + ok);
}
}
Modified: incubator/harmony/enhanced/classlib/trunk/modules/security2/test/common/unit/java/security/spec/PKCS8EncodedKeySpecTest.java
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/modules/security2/test/common/unit/java/security/spec/PKCS8EncodedKeySpecTest.java?rev=373789&r1=373788&r2=373789&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/security2/test/common/unit/java/security/spec/PKCS8EncodedKeySpecTest.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/security2/test/common/unit/java/security/spec/PKCS8EncodedKeySpecTest.java Tue Jan 31 03:01:12 2006
@@ -23,14 +23,14 @@
import java.util.Arrays;
-import org.apache.harmony.security.test.PerformanceTest;
+import junit.framework.TestCase;
/**
* Tests for <code>PKCS8EncodedKeySpec</code> class fields and methods.
*
*/
-public class PKCS8EncodedKeySpecTest extends PerformanceTest {
+public class PKCS8EncodedKeySpecTest extends TestCase {
/*
* @see TestCase#setUp()
Modified: incubator/harmony/enhanced/classlib/trunk/modules/security2/test/common/unit/java/security/spec/PSSParameterSpecTest.java
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/modules/security2/test/common/unit/java/security/spec/PSSParameterSpecTest.java?rev=373789&r1=373788&r2=373789&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/security2/test/common/unit/java/security/spec/PSSParameterSpecTest.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/security2/test/common/unit/java/security/spec/PSSParameterSpecTest.java Tue Jan 31 03:01:12 2006
@@ -21,13 +21,13 @@
package java.security.spec;
-import org.apache.harmony.security.test.PerformanceTest;
+import junit.framework.TestCase;
/**
* Tests for <code>PSSParameterSpec</code> class (1.5)
*
*/
-public class PSSParameterSpecTest extends PerformanceTest {
+public class PSSParameterSpecTest extends TestCase {
/*
* @see TestCase#setUp()
@@ -69,16 +69,11 @@
* if <code>saltLen</code> less than 0
*/
public final void testPSSParameterSpec0102() {
- boolean passed = false;
try {
- AlgorithmParameterSpec aps = new PSSParameterSpec(-1);
- } catch (Exception e) {
- if (e instanceof IllegalArgumentException) {
- passed = true;
- }
- logln(getName() + ": " + e);
+ new PSSParameterSpec(-1);
+ fail("Expected IAE not thrown");
+ } catch (IllegalArgumentException e) {
}
- assertTrue(passed);
}
/**
@@ -105,17 +100,11 @@
* if <code>mdName</code> is null
*/
public final void testPSSParameterSpec0202() {
- boolean passed = false;
try {
- AlgorithmParameterSpec aps = new PSSParameterSpec(null, "MGF1",
- MGF1ParameterSpec.SHA1, 20, 1);
- } catch (Exception e) {
- if (e instanceof NullPointerException) {
- passed = true;
- }
- logln(getName() + ": " + e);
+ new PSSParameterSpec(null, "MGF1", MGF1ParameterSpec.SHA1, 20, 1);
+ fail("Expected NPE not thrown");
+ } catch (NullPointerException e) {
}
- assertTrue(passed);
}
/**
@@ -128,17 +117,11 @@
* if <code>mgfName</code> is null
*/
public final void testPSSParameterSpec0203() {
- boolean passed = false;
try {
- AlgorithmParameterSpec aps = new PSSParameterSpec("SHA-1", null,
- MGF1ParameterSpec.SHA1, 20, 1);
- } catch (Exception e) {
- if (e instanceof NullPointerException) {
- passed = true;
- }
- logln(getName() + ": " + e);
+ new PSSParameterSpec("SHA-1", null, MGF1ParameterSpec.SHA1, 20, 1);
+ fail("Expected NPE not thrown");
+ } catch (NullPointerException e) {
}
- assertTrue(passed);
}
/**
@@ -151,17 +134,12 @@
* if <code>saltLen<code> less than 0
*/
public final void testPSSParameterSpec0204() {
- boolean passed = false;
try {
- AlgorithmParameterSpec aps = new PSSParameterSpec("SHA-1", "MGF1",
+ new PSSParameterSpec("SHA-1", "MGF1",
MGF1ParameterSpec.SHA1, -20, 1);
- } catch (Exception e) {
- if (e instanceof IllegalArgumentException) {
- passed = true;
- }
- logln(getName() + ": " + e);
+ fail("Expected IAE not thrown");
+ } catch (IllegalArgumentException e) {
}
- assertTrue(passed);
}
/**
@@ -174,17 +152,12 @@
* if <code>trailerField</code> less than 0
*/
public final void testPSSParameterSpec0205() {
- boolean passed = false;
try {
- AlgorithmParameterSpec aps = new PSSParameterSpec("SHA-1", "MGF1",
+ new PSSParameterSpec("SHA-1", "MGF1",
MGF1ParameterSpec.SHA1, 20, -1);
- } catch (Exception e) {
- if (e instanceof IllegalArgumentException) {
- passed = true;
- }
- logln(getName() + ": " + e);
+ fail("Expected IAE not thrown");
+ } catch (IllegalArgumentException e) {
}
- assertTrue(passed);
}
/**
@@ -196,15 +169,7 @@
*
*/
public final void testPSSParameterSpec0206() {
- boolean passed = true;
- try {
- AlgorithmParameterSpec aps = new PSSParameterSpec("SHA-1", "MGF1",
- null, 20, 1);
- } catch (Exception e) {
- passed = false;
- logln(getName() + ": " + e);
- }
- assertTrue(passed);
+ new PSSParameterSpec("SHA-1", "MGF1", null, 20, 1);
}
/**
@@ -309,4 +274,4 @@
public final void testDEFAULTtrailerField() {
assertTrue(PSSParameterSpec.DEFAULT.getTrailerField() == 1);
}
-}
\ No newline at end of file
+}
Modified: incubator/harmony/enhanced/classlib/trunk/modules/security2/test/common/unit/java/security/spec/RSAKeyGenParameterSpecTest.java
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/modules/security2/test/common/unit/java/security/spec/RSAKeyGenParameterSpecTest.java?rev=373789&r1=373788&r2=373789&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/security2/test/common/unit/java/security/spec/RSAKeyGenParameterSpecTest.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/security2/test/common/unit/java/security/spec/RSAKeyGenParameterSpecTest.java Tue Jan 31 03:01:12 2006
@@ -23,14 +23,14 @@
import java.math.BigInteger;
-import org.apache.harmony.security.test.PerformanceTest;
+import junit.framework.TestCase;
/**
* Tests for <code>RSAKeyGenParameterSpec</code> class fields and methods.
*
*/
-public class RSAKeyGenParameterSpecTest extends PerformanceTest {
+public class RSAKeyGenParameterSpecTest extends TestCase {
/*
* @see TestCase#setUp()
Modified: incubator/harmony/enhanced/classlib/trunk/modules/security2/test/common/unit/java/security/spec/RSAMultiPrimePrivateCrtKeySpecTest.java
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/modules/security2/test/common/unit/java/security/spec/RSAMultiPrimePrivateCrtKeySpecTest.java?rev=373789&r1=373788&r2=373789&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/security2/test/common/unit/java/security/spec/RSAMultiPrimePrivateCrtKeySpecTest.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/security2/test/common/unit/java/security/spec/RSAMultiPrimePrivateCrtKeySpecTest.java Tue Jan 31 03:01:12 2006
@@ -23,14 +23,14 @@
import java.math.BigInteger;
-import org.apache.harmony.security.test.PerformanceTest;
+import junit.framework.TestCase;
/**
* Tests for <code>RSAMultiPrimePrivateCrtKeySpec</code> class fields and methods.
*
*/
-public class RSAMultiPrimePrivateCrtKeySpecTest extends PerformanceTest {
+public class RSAMultiPrimePrivateCrtKeySpecTest extends TestCase {
/**
* Reference array of RSAOtherPrimeInfo. DO NOT MODIFY
*/
@@ -108,9 +108,8 @@
* Assertion: NullPointerException if modulus is null
*/
public final void testRSAMultiPrimePrivateCrtKeySpec02() {
- boolean passed = false;
try {
- KeySpec ks = new RSAMultiPrimePrivateCrtKeySpec(
+ new RSAMultiPrimePrivateCrtKeySpec(
null,
BigInteger.ONE,
BigInteger.ONE,
@@ -120,13 +119,9 @@
BigInteger.ONE,
BigInteger.ONE,
opi);
- } catch (Exception e) {
- if (e instanceof NullPointerException) {
- passed = true;
- logln(getName() + ": " + e);
- }
+ fail("Expected NPE not thrown");
+ } catch (NullPointerException e) {
}
- assertTrue(passed);
}
/**
@@ -144,9 +139,8 @@
* Assertion: NullPointerException if publicExponent is null
*/
public final void testRSAMultiPrimePrivateCrtKeySpec03() {
- boolean passed = false;
try {
- KeySpec ks = new RSAMultiPrimePrivateCrtKeySpec(
+ new RSAMultiPrimePrivateCrtKeySpec(
BigInteger.ONE,
null,
BigInteger.ONE,
@@ -156,13 +150,9 @@
BigInteger.ONE,
BigInteger.ONE,
opi);
- } catch (Exception e) {
- if (e instanceof NullPointerException) {
- passed = true;
- logln(getName() + ": " + e);
- }
+ fail("Expected NPE not thrown");
+ } catch (NullPointerException e) {
}
- assertTrue(passed);
}
/**
@@ -180,9 +170,8 @@
* Assertion: NullPointerException if privateExponent is null
*/
public final void testRSAMultiPrimePrivateCrtKeySpec04() {
- boolean passed = false;
try {
- KeySpec ks = new RSAMultiPrimePrivateCrtKeySpec(
+ new RSAMultiPrimePrivateCrtKeySpec(
BigInteger.ONE,
BigInteger.ONE,
null,
@@ -192,13 +181,9 @@
BigInteger.ONE,
BigInteger.ONE,
opi);
- } catch (Exception e) {
- if (e instanceof NullPointerException) {
- passed = true;
- logln(getName() + ": " + e);
- }
+ fail("Expected NPE not thrown");
+ } catch (NullPointerException e) {
}
- assertTrue(passed);
}
/**
@@ -216,9 +201,8 @@
* Assertion: NullPointerException if primeP is null
*/
public final void testRSAMultiPrimePrivateCrtKeySpec05() {
- boolean passed = false;
try {
- KeySpec ks = new RSAMultiPrimePrivateCrtKeySpec(
+ new RSAMultiPrimePrivateCrtKeySpec(
BigInteger.ONE,
BigInteger.ONE,
BigInteger.ONE,
@@ -228,13 +212,9 @@
BigInteger.ONE,
BigInteger.ONE,
opi);
- } catch (Exception e) {
- if (e instanceof NullPointerException) {
- passed = true;
- logln(getName() + ": " + e);
- }
+ fail("Expected NPE not thrown");
+ } catch (NullPointerException e) {
}
- assertTrue(passed);
}
/**
@@ -252,9 +232,8 @@
* Assertion: NullPointerException if primeQ is null
*/
public final void testRSAMultiPrimePrivateCrtKeySpec06() {
- boolean passed = false;
try {
- KeySpec ks = new RSAMultiPrimePrivateCrtKeySpec(
+ new RSAMultiPrimePrivateCrtKeySpec(
BigInteger.ONE,
BigInteger.ONE,
BigInteger.ONE,
@@ -264,13 +243,9 @@
BigInteger.ONE,
BigInteger.ONE,
opi);
- } catch (Exception e) {
- if (e instanceof NullPointerException) {
- passed = true;
- logln(getName() + ": " + e);
- }
+ fail("Expected NPE not thrown");
+ } catch (NullPointerException e) {
}
- assertTrue(passed);
}
/**
@@ -288,9 +263,8 @@
* Assertion: NullPointerException if primeExponentP is null
*/
public final void testRSAMultiPrimePrivateCrtKeySpec07() {
- boolean passed = false;
try {
- KeySpec ks = new RSAMultiPrimePrivateCrtKeySpec(
+ new RSAMultiPrimePrivateCrtKeySpec(
BigInteger.ONE,
BigInteger.ONE,
BigInteger.ONE,
@@ -300,13 +274,9 @@
BigInteger.ONE,
BigInteger.ONE,
opi);
- } catch (Exception e) {
- if (e instanceof NullPointerException) {
- passed = true;
- logln(getName() + ": " + e);
- }
+ fail("Expected NPE not thrown");
+ } catch (NullPointerException e) {
}
- assertTrue(passed);
}
/**
@@ -324,9 +294,8 @@
* Assertion: NullPointerException if primeExponentQ is null
*/
public final void testRSAMultiPrimePrivateCrtKeySpec08() {
- boolean passed = false;
try {
- KeySpec ks = new RSAMultiPrimePrivateCrtKeySpec(
+ new RSAMultiPrimePrivateCrtKeySpec(
BigInteger.ONE,
BigInteger.ONE,
BigInteger.ONE,
@@ -336,13 +305,9 @@
null,
BigInteger.ONE,
opi);
- } catch (Exception e) {
- if (e instanceof NullPointerException) {
- passed = true;
- logln(getName() + ": " + e);
- }
+ fail("Expected NPE not thrown");
+ } catch (NullPointerException e) {
}
- assertTrue(passed);
}
/**
@@ -360,9 +325,8 @@
* Assertion: NullPointerException if crtCoefficient is null
*/
public final void testRSAMultiPrimePrivateCrtKeySpec09() {
- boolean passed = false;
try {
- KeySpec ks = new RSAMultiPrimePrivateCrtKeySpec(
+ new RSAMultiPrimePrivateCrtKeySpec(
BigInteger.ONE,
BigInteger.ONE,
BigInteger.ONE,
@@ -372,13 +336,9 @@
BigInteger.ONE,
null,
opi);
- } catch (Exception e) {
- if (e instanceof NullPointerException) {
- passed = true;
- logln(getName() + ": " + e);
- }
+ fail("Expected NPE not thrown");
+ } catch (NullPointerException e) {
}
- assertTrue(passed);
}
/**
@@ -396,22 +356,16 @@
* Assertion: otherPrimeInfo can be null
*/
public final void testRSAMultiPrimePrivateCrtKeySpec10() {
- boolean passed = false;
- try {
- KeySpec ks = new RSAMultiPrimePrivateCrtKeySpec(
- BigInteger.ONE,
- BigInteger.ONE,
- BigInteger.ONE,
- BigInteger.ONE,
- BigInteger.ONE,
- BigInteger.ONE,
- BigInteger.ONE,
- BigInteger.ONE,
- null);
- passed = true;
- } catch (Exception e) {
- }
- assertTrue(passed);
+ new RSAMultiPrimePrivateCrtKeySpec(
+ BigInteger.ONE,
+ BigInteger.ONE,
+ BigInteger.ONE,
+ BigInteger.ONE,
+ BigInteger.ONE,
+ BigInteger.ONE,
+ BigInteger.ONE,
+ BigInteger.ONE,
+ null);
}
/**
@@ -429,9 +383,8 @@
* Assertion: IllegalArgumentException if otherPrimeInfo length is 0
*/
public final void testRSAMultiPrimePrivateCrtKeySpec11() {
- boolean passed = false;
try {
- KeySpec ks = new RSAMultiPrimePrivateCrtKeySpec(
+ new RSAMultiPrimePrivateCrtKeySpec(
BigInteger.ONE,
BigInteger.ONE,
BigInteger.ONE,
@@ -441,13 +394,9 @@
BigInteger.ONE,
BigInteger.ONE,
new RSAOtherPrimeInfo[0]);
- } catch (Exception e) {
- if (e instanceof IllegalArgumentException) {
- passed = true;
- logln(getName() + ": " + e);
- }
+ fail("Expected IAE not thrown");
+ } catch (IllegalArgumentException e) {
}
- assertTrue(passed);
}
/**
Modified: incubator/harmony/enhanced/classlib/trunk/modules/security2/test/common/unit/java/security/spec/RSAOtherPrimeInfoTest.java
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/modules/security2/test/common/unit/java/security/spec/RSAOtherPrimeInfoTest.java?rev=373789&r1=373788&r2=373789&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/security2/test/common/unit/java/security/spec/RSAOtherPrimeInfoTest.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/security2/test/common/unit/java/security/spec/RSAOtherPrimeInfoTest.java Tue Jan 31 03:01:12 2006
@@ -23,14 +23,14 @@
import java.math.BigInteger;
-import org.apache.harmony.security.test.PerformanceTest;
+import junit.framework.TestCase;
/**
* Tests for <code>RSAOtherPrimeInfo</code> class fields and methods.
*
*/
-public class RSAOtherPrimeInfoTest extends PerformanceTest {
+public class RSAOtherPrimeInfoTest extends TestCase {
/*
* @see TestCase#setUp()
@@ -72,19 +72,13 @@
* Assertion: NullPointerException if prime is null
*/
public final void testRSAOtherPrimeInfo02() {
- boolean passed = false;
try {
- RSAOtherPrimeInfo ropi =
- new RSAOtherPrimeInfo(null,
- BigInteger.valueOf(2L),
- BigInteger.valueOf(3L));
- } catch (Exception e) {
- if (e instanceof NullPointerException) {
- passed = true;
- logln(getName() + ": " + e);
- }
+ new RSAOtherPrimeInfo(null,
+ BigInteger.valueOf(2L),
+ BigInteger.valueOf(3L));
+ fail("Expected NPE not thrown");
+ } catch (NullPointerException e) {
}
- assertTrue(passed);
}
/**
@@ -92,19 +86,13 @@
* Assertion: NullPointerException if primeExponent is null
*/
public final void testRSAOtherPrimeInfo03() {
- boolean passed = false;
try {
- RSAOtherPrimeInfo ropi =
- new RSAOtherPrimeInfo(BigInteger.valueOf(1L),
- null,
- BigInteger.valueOf(3L));
- } catch (Exception e) {
- if (e instanceof NullPointerException) {
- passed = true;
- logln(getName() + ": " + e);
- }
+ new RSAOtherPrimeInfo(BigInteger.valueOf(1L),
+ null,
+ BigInteger.valueOf(3L));
+ fail("Expected NPE not thrown");
+ } catch (NullPointerException e) {
}
- assertTrue(passed);
}
/**
@@ -112,19 +100,13 @@
* Assertion: NullPointerException if crtCoefficient is null
*/
public final void testRSAOtherPrimeInfo04() {
- boolean passed = false;
try {
- RSAOtherPrimeInfo ropi =
- new RSAOtherPrimeInfo(BigInteger.valueOf(1L),
- BigInteger.valueOf(2L),
- null);
- } catch (Exception e) {
- if (e instanceof NullPointerException) {
- passed = true;
- logln(getName() + ": " + e);
- }
+ new RSAOtherPrimeInfo(BigInteger.valueOf(1L),
+ BigInteger.valueOf(2L),
+ null);
+ fail("Expected NPE not thrown");
+ } catch (NullPointerException e) {
}
- assertTrue(passed);
}
/**
@@ -132,19 +114,13 @@
* Assertion: NullPointerException if prime and crtCoefficient is null
*/
public final void testRSAOtherPrimeInfo05() {
- boolean passed = false;
try {
- RSAOtherPrimeInfo ropi =
- new RSAOtherPrimeInfo(null,
- BigInteger.valueOf(2L),
- null);
- } catch (Exception e) {
- if (e instanceof NullPointerException) {
- passed = true;
- logln(getName() + ": " + e);
- }
+ new RSAOtherPrimeInfo(null,
+ BigInteger.valueOf(2L),
+ null);
+ fail("Expected NPE not thrown");
+ } catch (NullPointerException e) {
}
- assertTrue(passed);
}
/**
Modified: incubator/harmony/enhanced/classlib/trunk/modules/security2/test/common/unit/java/security/spec/RSAPrivateCrtKeySpecTest.java
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/modules/security2/test/common/unit/java/security/spec/RSAPrivateCrtKeySpecTest.java?rev=373789&r1=373788&r2=373789&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/security2/test/common/unit/java/security/spec/RSAPrivateCrtKeySpecTest.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/security2/test/common/unit/java/security/spec/RSAPrivateCrtKeySpecTest.java Tue Jan 31 03:01:12 2006
@@ -23,14 +23,14 @@
import java.math.BigInteger;
-import org.apache.harmony.security.test.PerformanceTest;
+import junit.framework.TestCase;
/**
* Tests for <code>RSAPrivateCrtKeySpec</code> class fields and methods
*
*/
-public class RSAPrivateCrtKeySpecTest extends PerformanceTest {
+public class RSAPrivateCrtKeySpecTest extends TestCase {
/*
* @see TestCase#setUp()