Skip to content

Commit

Permalink
test(UpdateDisplayOptions)
Browse files Browse the repository at this point in the history
  • Loading branch information
RalfBarkow committed Jun 9, 2024
1 parent db2e5c1 commit 1d0bd0c
Showing 1 changed file with 45 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -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());
}
}

0 comments on commit 1d0bd0c

Please sign in to comment.