0 points

Load YAML with JUnit 4 extension


dashboard

Thu Aug 27 2020 11:25:11 GMT+0000 (UTC)

Posted by @hosuaby #java

class MyTestClass {

    /* Load and parse YAML resource */
    @Rule
    public YamlResource<Person> spongeBob = givenResource()
            .yaml("/com/adelean/junit/jupiter/sponge-bob.yaml")
            .parseWith(new Yaml());

    /* Load and parse YAML documents resource */
    @Rule
    public YamlDocumentsResource<Log[]> logsAsArray = givenResource()
            .yamlDocuments("/com/adelean/junit/jupiter/logs.yml")
            .parseWith(new Yaml(new Constructor(Log.class)));
}
content_copy Copy