Skip to content

Commit d43f2ad

Browse files
authored
simplify Junit parametrizable (closes #13) (#14)
1 parent 0c61878 commit d43f2ad

File tree

3 files changed

+12
-3
lines changed

3 files changed

+12
-3
lines changed

src/test/java/org/greenbytes/http/sfv/AbstractSpecificationTests.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,11 @@ public static class TestParams {
3434
public JsonValue expected_value;
3535
public JsonValue expected_params;
3636
public String canonical;
37+
38+
// provides the test name to Junit runner
39+
@Override public String toString() {
40+
return filename + ":" + name;
41+
}
3742
}
3843

3944
public static Collection<Object[]> makeParameters(String... filenames) {
@@ -51,7 +56,7 @@ private static Collection<Object[]> internalMakeParameters(String filename) {
5156
JsonReader reader = Json.createReader(AbstractSpecificationTests.class.getClassLoader().getResourceAsStream(filename));
5257
for (JsonValue vt : reader.readArray()) {
5358
TestParams p = makeOneTest(basename, vt);
54-
result.add(new Object[] { basename + ": " + p.name, p });
59+
result.add(new Object[] { p });
5560
}
5661

5762
return result;
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
package org.greenbytes.http.sfv;
2+
3+
public class SpecificationBinaryTests {
4+
}

src/test/java/org/greenbytes/http/sfv/SpecificationTests.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,8 @@ public static Collection<Object[]> parameters() {
4141
"param-listlist.json", "string.json", "string-generated.json", "token.json", "token-generated.json");
4242
}
4343

44-
public SpecificationTests(Object x, Object y) {
45-
this.p = (TestParams) y;
44+
public SpecificationTests(TestParams params) {
45+
this.p = params;
4646
}
4747

4848
@Test

0 commit comments

Comments
 (0)