@TestWithResources
class TestsWithYaml {
@WithSnakeYaml
Yaml yaml = new Yaml();
/* YAML resource with a single document */
@GivenYamlResource("/com/adelean/junit/jupiter/receipt.yml")
Map<String, Object> receipt;
@GivenYamlResource("/com/adelean/junit/jupiter/sponge-bob.yaml")
Person spongeBob;
/* YAML resource with multiple documents separated by '---' */
@GivenYamlDocumentsResource("/com/adelean/junit/jupiter/stacktrace.yaml")
List<Map<String, Object>> stacktraceAsList;
}
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