From 1d0bd0c78fd95af1943222918c62b5a139a8a609 Mon Sep 17 00:00:00 2001 From: RalfBarkow Date: Sun, 9 Jun 2024 18:01:51 +0200 Subject: [PATCH] test(UpdateDisplayOptions) --- .../UpdateDisplayOptionsTest.java | 45 +++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 src/test/java/de/danielluedecke/zettelkasten/UpdateDisplayOptionsTest.java diff --git a/src/test/java/de/danielluedecke/zettelkasten/UpdateDisplayOptionsTest.java b/src/test/java/de/danielluedecke/zettelkasten/UpdateDisplayOptionsTest.java new file mode 100644 index 00000000..fb87052d --- /dev/null +++ b/src/test/java/de/danielluedecke/zettelkasten/UpdateDisplayOptionsTest.java @@ -0,0 +1,45 @@ +package de.danielluedecke.zettelkasten; + +import org.testng.Assert; +import org.testng.annotations.Test; + +public class UpdateDisplayOptionsTest { + + @Test + public void testDefaultOptions() { + UpdateDisplayOptions options = UpdateDisplayOptions.defaultOptions(); + Assert.assertTrue(options.shouldUpdateNoteSequencesTree()); + Assert.assertTrue(options.shouldUpdateLinksTable()); + Assert.assertTrue(options.shouldUpdateTitlesTab()); + } + + @Test + public void testCustomOptions() { + UpdateDisplayOptions options = new UpdateDisplayOptions.UpdateDisplayOptionsBuilder() + .updateNoteSequencesTab(false) + .updateLinksTab(true) + .updateTitlesTab(false) + .build(); + + Assert.assertFalse(options.shouldUpdateNoteSequencesTree()); + Assert.assertTrue(options.shouldUpdateLinksTable()); + Assert.assertFalse(options.shouldUpdateTitlesTab()); + } + + @Test + public void testBuilderWithExistingOptions() { + UpdateDisplayOptions originalOptions = new UpdateDisplayOptions.UpdateDisplayOptionsBuilder() + .updateNoteSequencesTab(false) + .updateLinksTab(false) + .updateTitlesTab(true) + .build(); + + UpdateDisplayOptions newOptions = new UpdateDisplayOptions.UpdateDisplayOptionsBuilder(originalOptions) + .updateNoteSequencesTab(true) + .build(); + + Assert.assertTrue(newOptions.shouldUpdateNoteSequencesTree()); + Assert.assertFalse(newOptions.shouldUpdateLinksTable()); + Assert.assertTrue(newOptions.shouldUpdateTitlesTab()); + } +}