harmony-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Mark Hindess" <mark.hind...@googlemail.com>
Subject Re: reporting failure
Date Tue, 11 Apr 2006 10:51:55 GMT
Mikhail,

I came across one of these the other day, when looking at the
integration of the security tests from HARMNOY-88 IIRC.  It did seem
to result in particularly unhelpful output.  I think we should fix
them to give more helpful errors in the event of problems.

-Mark.

On 4/11/06, Mikhail Loenko <mloenko@gmail.com> wrote:
> There is code that prints exception name but not the trace.
>
>         } catch (Exception e) {
>                 fail("Exception while creating policy file : " + e);
>         }
>
> Thanks,
> Mikhail
>
> 2006/4/11, Geir Magnusson Jr <geir@pobox.com>:
> > 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: harmony-dev-unsubscribe@incubator.apache.org
> > > For additional commands, e-mail: harmony-dev-help@incubator.apache.org
> > >
> > >
> >
> > ---------------------------------------------------------------------
> > Terms of use : http://incubator.apache.org/harmony/mailing.html
> > To unsubscribe, e-mail: harmony-dev-unsubscribe@incubator.apache.org
> > For additional commands, e-mail: harmony-dev-help@incubator.apache.org
> >
> >
>
> ---------------------------------------------------------------------
> Terms of use : http://incubator.apache.org/harmony/mailing.html
> To unsubscribe, e-mail: harmony-dev-unsubscribe@incubator.apache.org
> For additional commands, e-mail: harmony-dev-help@incubator.apache.org
>
>


--
Mark Hindess <mark.hindess@googlemail.com>
IBM Java Technology Centre, UK.

---------------------------------------------------------------------
Terms of use : http://incubator.apache.org/harmony/mailing.html
To unsubscribe, e-mail: harmony-dev-unsubscribe@incubator.apache.org
For additional commands, e-mail: harmony-dev-help@incubator.apache.org


Mime
View raw message