Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#633 added unit test #634

Merged
merged 1 commit into from
Nov 13, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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;
}
}

}
Loading