Interface JsonProvider

All Known Implementing Classes:
Jackson2JsonProvider, Jackson3JsonProvider

public interface JsonProvider
A dependency-aware Json provider.

Cucumber creates reports using JSON but Java doesn't have a standard JSON implementation and the JSR 353 jsonb-api doesn't seem to be going anywhere yet. As a testing library Cucumber also can't just depend on Jackson, Gson or any other library. It might influence the system under test. As such Cucumber has to use what is available.

A JsonProvider can be used through SPI and may optionally provide a Json implementation if the dependencies for that implementation are available on the class or module path.

  • Method Details

    • instance

      Optional<Json> instance()
      Provides a Json instance if the dependencies() are available on the class or module path. Otherwise, empty.
    • dependencies

      List<JsonProvider.Dependency> dependencies()
      The dependencies that should be available on the class or module path required to provide a working Json instance.
      Returns:
      dependencies that should be available on the class or module path.
    • name

      String name()
      Name of the Json library used. E.g. Jackson 2 or Jackson 3.