I would like to write a test in which I pass in as an argument a list of values, and I assert that 4 different methods are called using each value. For example
@ParameterizedTest
@SomeKindOfSource
public void runTest(List<Integer> ints){
for (int i : ints){
assertAll(
() -> verify(myMock, times(1)).method1(eq(i)),
() -> verify(myMock, times(1)).method2(eq(i)),
() -> verify(myMock, times(1)).method3(eq(i)),
() -> verify(myMock, times(1)).method4(eq(i))
);
}
}
This asserts that, for each element, all 4 methods are called once. However, if the first element fails, the test short-circuits and the remainder are not called.
How can I pass a single list of executables into the assertAll method, such that the test verifies all for assertions for all 4 values before failing if there are any failures?
verifyfails?