Skip to content

Commit

Permalink
#633 added unit test
Browse files Browse the repository at this point in the history
  • Loading branch information
amihaiemil committed Nov 13, 2024
1 parent 6c784f2 commit ad5144d
Showing 1 changed file with 49 additions and 0 deletions.
49 changes: 49 additions & 0 deletions src/test/java/com/amihaiemil/eoyaml/ReflectedYamlMappingTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,34 @@ public void reflectsValues() {
);
}

/**
* Unit test for Issue #633.
*/
@Test
public void reflectsEntries() {
final Entries entries = new Entries();
entries.entries.add("Test1");
entries.entries.add("Test2");
entries.entries.add("Test3");
final YamlMapping mapping = Yaml.createYamlDump(entries).dumpMapping();
MatcherAssert.assertThat(
mapping.yamlSequence("entries").size(),
Matchers.is(3)
);
MatcherAssert.assertThat(
mapping.yamlSequence("entries").string(0),
Matchers.equalTo("Test1")
);
MatcherAssert.assertThat(
mapping.yamlSequence("entries").string(1),
Matchers.equalTo("Test2")
);
MatcherAssert.assertThat(
mapping.yamlSequence("entries").string(2),
Matchers.equalTo("Test3")
);
}

/**
* Prints the YAML correctly.
*/
Expand Down Expand Up @@ -267,4 +295,25 @@ public void setClasses(List<String> classes) {
}

}

/**
* Simple pojo for test.
* @checkstyle JavadocVariable (100 lines)
* @checkstyle JavadocMethod (100 lines)
* @checkstyle HiddenField (100 lines)
* @checkstyle ParameterNumber (100 lines)
* @checkstyle FinalParameters (100 lines)
*/
static final class Entries {
private List<String> entries = new ArrayList<>();

public List<String> getEntries() {
return entries;
}

public void setEntries(List<String> entries) {
this.entries = entries;
}
}

}

0 comments on commit ad5144d

Please sign in to comment.