However when using the nromal junit assertions, the failures are reported correctly.
import static org.junit.Assert.assertEquals;
Correctly shows up as a failure.
is there anything I can do to make sure spring Assert shows up as failure as well as the normal junit asserts ?
To clarify this
Assert.notNull(null);
Shows as an error in test report, and not a failure.
You are using the wrong
Assertclass in your unit tests:the
org.junit.Assertclass is for use in unit teststhe
org.springframework.util.Assertclass is for use in runtime code.And the practical difference is that they throw different exceptions.
If your unit test is testing whether (say) your bean’s
afterPropertiesSet()method is callingorg.springframework.util.Assertcorrectly, then this is not a simple JUnit style assertion. Rather, it is a test thatIllegalArgumentExceptionis being thrown, and should be tested in the same way that you would test for (say)IOExceptionbeing thrown at the appropriate point.