diff options
author | Adrien Hopkins <adrien.p.hopkins@gmail.com> | 2025-02-23 19:20:30 -0500 |
---|---|---|
committer | Adrien Hopkins <adrien.p.hopkins@gmail.com> | 2025-02-23 20:36:03 -0500 |
commit | 4436b29053a0b757562ecc1d0a78e22902e6e5ae (patch) | |
tree | 7d2435198bc3108f00b6f820bc2e51c1597f51b2 /src/test/java/sevenUnitsGUI | |
parent | 1007169658004c78c408f8bd1f4efbbeb6448323 (diff) |
Allow default datafile to be disabled
If this option is deselected, the default unit, prefix, dimension and
metric exception data will not be loaded, and only custom data and the
few units that are not provided by files will be available.
The main rationale for this change is so that the data can be localized
by custom unit files.
Diffstat (limited to 'src/test/java/sevenUnitsGUI')
-rw-r--r-- | src/test/java/sevenUnitsGUI/PresenterTest.java | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/src/test/java/sevenUnitsGUI/PresenterTest.java b/src/test/java/sevenUnitsGUI/PresenterTest.java index 9e25a08..8b16365 100644 --- a/src/test/java/sevenUnitsGUI/PresenterTest.java +++ b/src/test/java/sevenUnitsGUI/PresenterTest.java @@ -17,6 +17,7 @@ package sevenUnitsGUI; import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; import static org.junit.jupiter.api.Assertions.assertTrue; import static org.junit.jupiter.api.Assumptions.assumeTrue; @@ -154,6 +155,23 @@ public final class PresenterTest { expectedOutput.getValue().toString(false, RoundingMode.HALF_EVEN)); assertEquals(List.of(expectedUC), viewBot.unitConversionList()); } + + /** + * Ensures that the default unitfile can be disabled. + * + * @since v1.0.0 + * @since 2025-02-23 + */ + @Test + void testDisableDefault() { + final var viewBot = new ViewBot(); + final var presenter = new Presenter(viewBot); + assumeTrue(presenter.database.containsUnitName("joule"), + "Attempted to test disabling default on unit not in default file."); + presenter.setUseDefaultDatafiles(false); + assertFalse(presenter.database.containsUnitName("joule"), + "Presenter disabled default datafiles, but still contains the joule."); + } /** * Tests that duplicate units are successfully removed, if that is asked for |