I have a method that I need to test that has multiple cases that need to be tested, and each case requires a few lines of code to test. Before long the test function is 50 lines long and it is a bit difficult to find the failures. (No, this function is not able to be reasonably split into reasonably small and easily testable methods.)
Are test methods intended to be specifically for one method, and no other test cover that method, or is it ok to have multiple test methods cover differnt aspects of a function? Example:
@Test
public void testSomeComplexMethod() {
// lots of code
}
// or
@Test
public void testSomeComplexMethodAspect1() {
// a little code that just tests aspect 1
}
@Test
public void testSomeComplexMethodAspect2() {
// a little code that just tests aspect 2
}