The last annotation aimed to specify the source of arguments for parameterized tests in JUnit 5 is @ArgumentsSource. With this annotation, we can specify a custom (and reusable in different tests) class, which will contain the parameters for the test. This class must implement the interface org.junit.jupiter.params.provider.ArgumentsProvider.
Let’s see an example. The following class implements a Jupiter parameterized test, in which the arguments source will be defined in the class CustomArgumentsProvider1:
package io.github.bonigarcia;import static org.junit.jupiter.api.Assertions.assertNotNull;import static org.junit.jupiter.api.Assertions.assertTrue;import org.junit.jupiter.params.ParameterizedTest;import org.junit.jupiter.params.provider.ArgumentsSource; ...