Skip to content
master
Go to file
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
src
 
 
 
 
 
 
 
 
 
 
 
 

README.md

junit-parameters

Build Status

junit-parameters enables adding parameters to JUnit 4 test methods.

Code examples

  • Annotate your test class with the JUnitParameters test runner:
@RunWith(JUnitParameters.class)
public class ParametersGeneratorTest {
}
  • Implement the interface ParameterGenerator:
public class OneParameterGenerator implements ParameterGenerator {

    @Override
    public Iterable<Object[]> parameters() {
        return Arrays.asList(new Object[][] { { "foo" }, { "bar" }, 
                                              { "baz" }, { "code" },
                                              { "java" } });
    }
}
  • Use it in your test with the @ParameterProvider annotation
@Test
@ParameterProvider(OneParameterGenerator.class)
public void injectSingleParam(String parameter) {
}

The JUnit test method will be invoked with each parameter created by the ParameterGenerator factory used in the test.

Tests

There are some tests available at src/test/java. It's possible to run the JUnitParametersTest test class and see the results.

License

junit-parameters is licensed under the The MIT License (MIT)

About

junit-parameters enables adding parameters to JUnit 4 test methods

Resources

License

Releases

No releases published

Packages

No packages published

Languages

You can’t perform that action at this time.