junit-json-params icon indicating copy to clipboard operation
junit-json-params copied to clipboard

Suport method automatic parameter conversions

Open joshka opened this issue 7 years ago • 1 comments

I'm of two minds on this on whether to shade the JsonP library.

Rather than having to manually pull keys and values out of a JsonObject parameter, It might be neat to support automatically filling parameters. E.g:

@ParameterizedTest
@JsonSource("{'itemA':'1','itemB':'2'}")
void test(int itemA, String itemB) {
  assertEquals(1, itemA);
  assertEquals("2", itemB);
}

This would require pulling the parameter names of the test method from the execution context, and a major version bump to 2.0.0 due to a non compatible change in the public interface.

joshka avatar Sep 02 '18 02:09 joshka

Decided not to shade the library for now, as I assume a test dependency is usually fairly simple to satisfy (where a production one might be less so). I will do the other part of this (enable automatically filling parameters, but currently have to resort to annotations for this to work.

joshka avatar Dec 01 '18 09:12 joshka

See https://github.com/joshka/junit-json-params/issues/177

joshka avatar Aug 20 '24 10:08 joshka