I am somewhat new to TDD and JUnit, I know that I can write test cases for methods I am implementing in my code.
And obviously, there are methods in my code which need several corner cases to be tested in order to verify that method implementation is OK. Since generally the good practice is keeping one test method per one method in code, I have to add multiple assertions for that kind of a method as explained in this answer. https://stackoverflow.com/a/762582/5715934
public void testValueOf() {
assertEquals(1, Integer.valueOf("1").intValue());
assertEquals(0, Integer.valueOf("0").intValue());
assertEquals(-1, Integer.valueOf("-1").intValue());
assertEquals(Integer.MAX_VALUE, Integer.valueOf("2147483647").intValue());
assertEquals(Integer.MIN_VALUE, Integer.valueOf("-2147483648").intValue());
....
}
But when I am executing the test case, I am not getting test status (pass/fail) for each assertion inside the test method. Instead, it shows 'red' even if one assertion is failed and green if all are passed.
Isn't it easier to have the track of each assertion to make debugging easier? And is there any formal way/tool/workaround to do that (JUnit 4)?