Another reason why I think, that multiple assersasserts in one method is not a bad thing is described in following code:
class Service { Result process(); } class Result { Inner inner; } class Inner { int number; } In my test I simply want to test that service.process() returns the correct number in Inner class instanceinstances.
Instead of testing...
@Test public void test() { Result res = service.process(); if ( res != null && res.getInner() != null ) Assert.assertEquals( ..., res.getInner() ); } I'm doing
@Test public void test() { Result res = service.process(); Assert.notNull(res); Assert.notNull(res.getInner()); Assert.assertEquals( ..., res.getInner() ); }