Your suggestion is probably how I would have done it, because I'm lazy.
I'd add output from a try/catch if I thought that I had more
meaningful information to add. is there a fail() that also shows the
stacktrace for the throw exception?
geir
Mikhail Loenko wrote:
I'm evaluating failures caused by intagration of H-88 tests and found out
that that style which is used in some tests is not very convinient for me.
I'd like to hear others' opinion.
So for example here is a failure
test: tests.api.java.security.AlgorithmParameterGeneratorTest
test case: test_initLjava_security_spec_AlgorithmParameterSpec
InvalidAlgorithmParameterException getting spec
junit.framework.AssertionFailedError:
InvalidAlgorithmParameterException getting spec at
tests.api.java.security.AlgorithmParameterGeneratorTest.test_initLjava_security_spec_AlgorithmParameterSpec(AlgorithmParameterGeneratorTest.java:207)
at
java.lang.reflect.AccessibleObject.invokeV(AccessibleObject.java:205)
This is how the test currently looks like:
public void test_initLjava_security_spec_AlgorithmParameterSpec() {
....
try {
DSAParameterSpec spec = new DSAParameterSpec(
BigInteger.ONE, BigInteger.ONE, BigInteger.ONE);
AlgorithmParameterGenerator gen = AlgorithmParameterGenerator
.getInstance("DSA");
gen.init(spec);
} catch (NoSuchAlgorithmException e) {
fail("getInstance did not find algorithm DSA");
} catch (InvalidAlgorithmParameterException e) {
fail("InvalidAlgorithmParameterException getting spec");
}
}
This is how I would rewrite the test:
public void test_initLjava_security_spec_AlgorithmParameterSpec()
throws Exception {
...
// checks that no exception is thrown
DSAParameterSpec spec = new DSAParameterSpec(BigInteger.ONE,
BigInteger.ONE, BigInteger.ONE);
AlgorithmParameterGenerator gen = AlgorithmParameterGenerator
.getInstance("DSA");
gen.init(spec);
}
And here is new output:
No supported AlgorithmParameterSpec for DSA parameter generation.
java.security.InvalidAlgorithmParameterException: No supported
AlgorithmParameterSpec for DSA parameter generation. at
org.bouncycastle.jce.provider.JDKAlgorithmParameterGenerator$DSA.engineInit(Unknown
Source) at
java.security.AlgorithmParameterGenerator.init(AlgorithmParameterGenerator.java:164)
at
tests.api.java.security.AlgorithmParameterGeneratorTest.test_initLjava_security_spec_AlgorithmParameterSpec(AlgorithmParameterGeneratorTest.java:203)
at java.lang.reflect.AccessibleObject.invokeV(AccessibleObject.java:205)
I can see where the failure occurs and its reason (missing
functionality rather then
invalid parameter spec)
Comments?
Thanks,
Mikhail
---------------------------------------------------------------------
Terms of use : http://incubator.apache.org/harmony/mailing.html
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
Terms of use : http://incubator.apache.org/harmony/mailing.html
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]