Guten morgen, > What do you mean with mixing behavior? myMethod(null, someParam) and > myMethod(someParam, null), both throwing NPE is essentially the same, isn't > it?
sure, but while one success, the other fails, so to achieve your purpose that doesn't help ;) all the best, -Simo http://people.apache.org/~simonetripodi/ http://simonetripodi.livejournal.com/ http://twitter.com/simonetripodi http://www.99soft.org/ On Sun, Jan 22, 2012 at 11:17 PM, Benedikt Ritter <b...@systemoutprintln.de> wrote: > Am 22.01.2012 21:56, schrieb Simone Tripodi: > >> Hallo Benedikt >> >>> >>> No it isn't. As far as I know, your test will pass, when the first >>> NullPointerException is thrown (this also applies to @Rule >>> ExpectedException). If you have a method that takes two arguments that >>> are >>> not nullable and you write: >>> >>> @Test(expected = NullPointerException.class) >>> public void testMyMethod(){ >>> // this will throw NPE >>> myObject.myMethod(null, someParam) >>> // test passes, because NPE was thrown, execution ends here >>> >>> // this will never be executed >>> myObject.myMethod(someParam, null) >>> } >> >> >> mixing different behaviors inside test methods is IMHO not good, keep >> it simple and straightforward (but not stupid) as Christian suggested >> ;) >> >> -Simo > > > What do you mean with mixing behavior? myMethod(null, someParam) and > myMethod(someParam, null), both throwing NPE is essentially the same, isn't > it? > But as I said earlier, I see the benefits of small test methods, that really > do only one thing. I will keep that in mind for future contributions. Also, > I will refactor the existing unit tests, when I have the time. > > good night! > Benedikt > >> >> http://people.apache.org/~simonetripodi/ >> http://simonetripodi.livejournal.com/ >> http://twitter.com/simonetripodi >> http://www.99soft.org/ >> >> --------------------------------------------------------------------- >> To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org >> For additional commands, e-mail: dev-h...@commons.apache.org > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org > For additional commands, e-mail: dev-h...@commons.apache.org > --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org For additional commands, e-mail: dev-h...@commons.apache.org