javax.swing.SwingUtilities - new tests

Stephen Crawley crawley@dstc.edu.au
Wed Nov 17 23:27:00 GMT 2004


david.gilbert@object-refinery.com said:
> 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... 

I cannot.  

My two cents worth is that if a testcase is explicitly catching
unexpected exceptions it should at least tell us what exception it
has caught! For example:

....
}
catch (Exception e)  {
  harness.check(false, "Caught an unexpected exception"); 
  harness.debug(e);
}



More information about the Mauve-patches mailing list