In Python, I often have tests that look something like this:
tests = [
(2, 4),
(3, 9),
(10, 100),
]
for (input, expected_output) in tests:
assert f(input) == expected_output
What is the “correct” way to write such tests (where a set of test cases is given, then the loop starts each of them) in Java using JUnit?
Thanks!
Proactive response . I understand that I can do something like:
assertEquals(4, f(2))
assertEquals(9, f(3))
....
But ... I hope there is a better way.
source
share