assertThatIllegalArgumentException().isThrownBy(() -> adder.addToSum("foo", value));
}
- @Test
+ @ParameterizedTest(name = "{index}: Adding {0}")
@DisplayName("Can add a positive value to an existing sum")
- public void testAddSumWithPositiveValuePossibleIfSumExists()
+ @ValueSource(ints = { 1, 3, 6, 66, 7, 9 })
+ public void testAddSumWithPositiveValuePossibleIfSumExists(int value)
{
AdderBusinessLogic adder = new AdderBusinessLogic();
adder.startSum("foo");
- assertThatIllegalArgumentException().isThrownBy(() -> adder.addToSum("foo", -1));
+ assertThatNoException().isThrownBy(() -> adder.addToSum("foo", value));
}
@ParameterizedTest(name = "{index}: Summing up {0}")