commit | c5e60baa72d4b5118c13cb7f7a73f7e969e85157 | [log] [tgz] |
---|---|---|
author | Neil Fuller <[email protected]> | Tue Sep 25 08:22:58 2018 -0700 |
committer | android-build-merger <[email protected]> | Tue Sep 25 08:22:58 2018 -0700 |
tree | c2059c17ecad6859b8e2f9c376984d3f4cc92f77 | |
parent | 7ba476aa1568b2e9cb9fe17964ef20cd79855f7a [diff] | |
parent | 1ca4444fe14735b9fcfd366caa81f6e2a0ec9200 [diff] |
Compile against core public SDK APIs only am: f78c7816cd am: d4c2ffb2d9 am: 1ca4444fe1 Change-Id: Ib0e8c38a8931ea93aa36aeefa2876cfacad1f3be
Parameterised tests that don't suck
@RunWith(JUnitParamsRunner.class) public class PersonTest { @Test @Parameters({"17, false", "22, true" }) public void personIsAdult(int age, boolean valid) throws Exception { assertThat(new Person(age).isAdult(), is(valid)); } }
See more examples
JUnitParams project adds a new runner to JUnit and provides much easier and readable parametrised tests for JUnit >=4.6.
Main differences to standard JUnit Parametrised runner:
JUnitParams is available as Maven artifact:
<dependency> <groupId>pl.pragmatists</groupId> <artifactId>JUnitParams</artifactId> <version>1.0.4</version> <scope>test</scope> </dependency>
If you want to see just one simple test class with all main ways to use JUnitParams see here: https://github.com/Pragmatists/junitparams/tree/master/src/test/java/junitparams/usage
You can also have a look at Wiki:Quickstart
Note: We are currently moving the project from Google Code to Github. Some information may still be accessible only at https://code.google.com/p/junitparams/