commit | fe726a1ab7e9f23c8e2dbba37d4e02944aef15b2 | [log] [tgz] |
---|---|---|
author | Paul Duffin <[email protected]> | Fri Nov 25 15:27:13 2016 +0000 |
committer | Paul Duffin <[email protected]> | Fri Nov 25 15:27:13 2016 +0000 |
tree | 67f656a90b9320f24b1dfda54b77e9dfb52952fb | |
parent | 630c32b92bf3cc6179c211290016089d40319119 [diff] |
Use junit-hostdex instead of core-junit-hostdex/junit4-target-hostdex A recent change in external/junit changes junit-hostdex so it includes all JUnit classes not just the ones not in core-junit-hostdex and not in junit4-target-hostdex. This change updates this project to use junit-hostdex instead of either of or even both of the other two. Bug: 30188076 Test: make checkbuild and art/tools/run-libcore-tests.sh '--mode=host' '--variant=X32' Change-Id: I046c394b2174567dd933105497d784ca3477ef0f
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/