On 12 April 2013 07:30, Benedikt Ritter <brit...@apache.org> wrote:

> I don't prefer one or the other. Both styles have their pros and cons. I
> just don't want to mix them.
>
>
I don't mind too much if they are mixed - but obviously not in the same
class.


> 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);
> }
>
>
That works well if the only possible source of the NPE is the statement
under test, but JUnit4 does not detect which statement causes the NPE.

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

Tend to agree here.


> 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