I have a method and wish to test it with different values. My question is: how can I write a JUnit test that would test the same method with different values?
You can take a look at parametrized tests like in example.
You can also use theories which is more convenient in a lot of cases.
JUnit4 supports parameterized tests for just this purpose.
See this tutorial.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With