diff --git a/src/test/java/com/amihaiemil/eoyaml/ReflectedYamlMappingTest.java b/src/test/java/com/amihaiemil/eoyaml/ReflectedYamlMappingTest.java index 0a089b14..506efc61 100644 --- a/src/test/java/com/amihaiemil/eoyaml/ReflectedYamlMappingTest.java +++ b/src/test/java/com/amihaiemil/eoyaml/ReflectedYamlMappingTest.java @@ -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. */ @@ -267,4 +295,25 @@ public void setClasses(List 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 entries = new ArrayList<>(); + + public List getEntries() { + return entries; + } + + public void setEntries(List entries) { + this.entries = entries; + } + } + }