Skip to content

Commit

Permalink
test
Browse files Browse the repository at this point in the history
  • Loading branch information
amihaiemil committed Aug 15, 2024
1 parent 0a81c24 commit 34b4679
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ public void printsBuiltYamlMappingWithComments() throws Exception {
"name",
Yaml.createYamlScalarBuilder()
.addLine("eo-yaml")
.buildPlainScalar("name of the project")
.buildPlainScalar("Name", "Elegant objects YAML")
).build("Comment of the whole document");
System.out.println(commented);
MatcherAssert.assertThat(
Expand Down Expand Up @@ -112,13 +112,31 @@ public void readsComments() throws Exception {
read.comment().value(),
Matchers.equalTo("Comment of the whole document")
);
MatcherAssert.assertThat(
read.keys().stream()
.filter(k -> k.asScalar().value().equals("developers"))
.findFirst()
.get()
.comment().value(),
Matchers.equalTo("all the contributors here")
);
MatcherAssert.assertThat(
read.yamlSequence("developers").comment().value(),
Matchers.equalTo("all the contributors here")
);
MatcherAssert.assertThat(
read.keys().stream()
.filter(k -> k.asScalar().value().equals("name"))
.findFirst()
.get()
.comment().value(),
Matchers.equalTo("Name")
);
MatcherAssert.assertThat(
read.value("name").comment().value(),
Matchers.equalTo("name of the project")
Matchers.equalTo(
"Name" + System.lineSeparator() + "Elegant objects YAML"
)
);
}

Expand Down
3 changes: 2 additions & 1 deletion src/test/resources/commentedMapping.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,5 @@ developers:
- rultor
- salikjan
- sherif
name: eo-yaml # name of the project
# Name
name: eo-yaml # Elegant objects YAML

0 comments on commit 34b4679

Please sign in to comment.