Annotation Type JsonSource


  • @Target({METHOD,PARAMETER})
    @Retention(RUNTIME)
    @Documented
    @ArgumentsSource(JsonInlineArgumentsProvider.class)
    public @interface JsonSource
    @JsonSource is an ArgumentsSource that parses inline JSON and passes it as arguments to a parametrized test.

    This annotation can be used on a method parameter, to make it usable with CartesianTest. If used with ParameterizedTest, the annotation has to be on the method itself as any other ArgumentsSource.

    Note that this extension requires a JSON parser to be available at run time, which may include adding it to the module graph with --add-modules. For details on that as well as how to use this extension, see the documentation on the JSON argument source.

    Since:
    1.7.0
    See Also:
    ArgumentsSource, ParameterizedTest, CartesianTest, Property, JsonFileSource, JsonClasspathSource
    • Required Element Summary

      Required Elements 
      Modifier and Type Required Element Description
      java.lang.String[] value
      The JSON values to use as the source of arguments; must not be empty.
    • Element Detail

      • value

        java.lang.String[] value
        The JSON values to use as the source of arguments; must not be empty.

        Each value can represent a single object, or a collection of objects.