dev@jax-ws.java.net

Re: [HEADS UP] Don't catch exceptions in unit tests

From: Kohsuke Kawaguchi <kohsuke.kawaguchi_at_sun.com>
Date: Mon, 30 Jan 2006 10:18:47 -0800

Kohsuke Kawaguchi wrote:
> I see many tests written like this:
>
> public void testParameterOrder() throws Exception{
> try{
> ... real test code ...
> }catch(Exception e){
> e.printStackTrace();
> assertTrue(false);
> }
> }

Even worse, some tests are written as:

      public void testParameterOrder() throws Exception{
          try{
              ... real test code ...
          }catch(Exception e){
              e.printStackTrace();
          }
      }

which masks a test failure. Another reason why this catch block is a bad
  idea.

-- 
Kohsuke Kawaguchi
Sun Microsystems                   kohsuke.kawaguchi_at_sun.com