I don't prefer one or the other. Both styles have their pros and cons. I
just don't want to mix them.

In JUnit 3 you would write something like:

public void testMyMethodNull() throws Exception {
   try {
      bean.myMethod(null);
      fail("Passing null to myMethod did not throw exception!");
   catch (NullPointException expected) {
      // expected, do nothing
   }
}

Where as in JUnit 4 you may write:

@Test(expected = NullPointerException.class)
public void passingNullToMyMethodThrowsNPE() throws Exception {
   bean.myMethod(null);
}

I have a slight preference for the second variant, but as I said for CSV I
would leave it as is for now.

Thanks for your comments.

Benedikt


2013/4/10 Gary Gregory <garydgreg...@gmail.com>

> On Apr 10, 2013, at 17:24, Emmanuel Bourg <ebo...@apache.org> wrote:
>
> > Le 10/04/2013 23:18, Benedikt Ritter a écrit :
> >
> >> Yes, I agree (I liked that in BU2) but CSV still uses the old JUnit 3.x
> >> convention of prefixing tests with "test". I'm not sure whether it's a
> good
> >> idea to start mixing this styles. WDYT?
> >
> > I agree. I always preferred the JUnit 3.x style anyway.
>
> +1
>
> Gary
>
> >
> > Emmanuel Bourg
> >
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org
> For additional commands, e-mail: dev-h...@commons.apache.org
>
>


-- 
http://people.apache.org/~britter/
http://www.systemoutprintln.de/
http://twitter.com/BenediktRitter
http://github.com/britter

Reply via email to