@TestWithResources
public class TestsWithJackson {
@WithJacksonMapper
ObjectMapper objectMapper = new ObjectMapper()
.registerModule(new JavaTimeModule());
/* JSON */
@GivenJsonResource("/com/adelean/junit/jupiter/sponge-bob.json")
Map<String, Object> jsonAsMap;
@GivenJsonResource("/com/adelean/junit/jupiter/sponge-bob.json")
JsonNode jsonNode;
@GivenJsonResource("/com/adelean/junit/jupiter/sponge-bob.json")
Person spongeBob;
/* JSONL */
@GivenJsonLinesResource("/com/adelean/junit/jupiter/logs.jsonl")
Log[] logsAsArray;
@GivenJsonLinesResource("/com/adelean/junit/jupiter/logs.jsonl")
Collection<Log> logsAsCollection;
}
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