class MyTestClass { /* Parse JSON with Jackson */ @Rule public JsonResource<Map<String, Object>> jsonAsMap = givenResource() .json("/com/adelean/junit/jupiter/sponge-bob.json") .parseWith(new ObjectMapper()); /* Parse JSON lines with Gson */ @Rule public JsonLinesResource<Collection<Log>> logsAsCollection = givenResource() .jsonLines("/com/adelean/junit/jupiter/logs.jsonl") .parseWith(new Gson()); }
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter