This is the mail archive of the mauve-patches@sources.redhat.com mailing list for the Mauve project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: javax.swing.SwingUtilities - new tests


On Wed, 2004-11-17 at 23:59, Michael Koch wrote:
> Am Donnerstag, 18. November 2004 00:52 schrieb Michael Koch:
> > Am Mittwoch, 17. November 2004 23:46 schrieb David Gilbert:
> > > I've committed these new tests:
> > >
> > > 2004-11-17  David Gilbert  <david.gilbert@object-refinery.com>
> > >
> > >  *
> > > gnu/testlet/javax/swing/SwingUtilities/computeIntersection.java,
> > > gnu/testlet/javax/swing/SwingUtilities/computeUnion.java,
> > > gnu/testlet/javax/swing/SwingUtilities/isRectangleContainingRecta
> > >n gle.java: New tests.
> > >
> > > See the attached patch.
> >
> > +    harness.checkPoint("Null arguments");
> > +    // test null argument - the API spec doesn't specify what
> > should +    // happen, but a NullPointerException is the usual
> > result elsewhere
> > +    try
> > +    {
> > +      /* Rectangle r2 = */ SwingUtilities.computeIntersection(1,
> > 2, 3, 4, null);
> > +      harness.check(false);
> > +    }
> > +    catch (NullPointerException e)
> > +    {
> > +      harness.check(true);
> > +    }
> >
> > We spoke about it in private mail. This test gets silently ignored
> > when some exception other then NullPointerException gets thrown.
> Well, wrong again. The framework catches and unexpected exception. 
> Letting the testcase just fail would be more nice.

The only way I can see to do that is to add a second catch block:

try
{
  // something that should throw a NullPointerException
  harness.check(false);
}
catch (NullPointerException e)
{
  harness.check(true);
}
catch (Exception e) 
{
  harness.check(false);
}

Perhaps someone can think of a more compact way to test for an expected
exception...

Regards,
Dave

> Michael 


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]