Skip to content

Commit

Permalink
test: Add test for dumpToString
Browse files Browse the repository at this point in the history
  • Loading branch information
Clashsoft committed Feb 22, 2024
1 parent d7666c8 commit eda87cf
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions src/test/java/org/fulib/TestObjectDiagrams.java
Original file line number Diff line number Diff line change
Expand Up @@ -186,4 +186,23 @@ public void dumpYaml() throws IOException
assertThat(decoded, instanceOf(StudyRight.class));
assertThat(((StudyRight) decoded).getId(), equalTo("StudyRight"));
}

@Test
public void dumpToString() throws IOException
{
StudyRight studyRight = new StudyRight().setId("StudyRight");
Person alice = new Student().setUni(studyRight).setName("Alice");
Person bob = new Student().setUni(studyRight).setName("Bob");
Person carli = new Student().setUni(studyRight).setName("Carli");

final String fileName = "tmp/objectDiagrams/dumpToString.txt";
FulibTools.objectDiagrams().dumpToString(fileName, studyRight, alice, bob, carli);

final String text = FileUtils.readFileToString(new File(fileName), StandardCharsets.UTF_8);

assertThat(text, equalTo("StudyRight null\n" +
"Alice []\n" +
"Bob []\n" +
"Carli []\n"));
}
}

0 comments on commit eda87cf

Please sign in to comment.