### Eclipse Workspace Patch 1.0
#P josm
diff --git test/unit/org/openstreetmap/josm/gui/preferences/display/DisplayPreferenceTest.java test/unit/org/openstreetmap/josm/gui/preferences/display/DisplayPreferenceTest.java
index c2d3812..b2cb379 100644
|
|
|
|
| 1 | 1 | // License: GPL. For details, see LICENSE file. |
| 2 | 2 | package org.openstreetmap.josm.gui.preferences.display; |
| 3 | 3 | |
| | 4 | import static org.junit.jupiter.api.Assertions.assertDoesNotThrow; |
| | 5 | import static org.junit.jupiter.api.Assertions.assertInstanceOf; |
| 4 | 6 | import static org.junit.jupiter.api.Assertions.assertNotNull; |
| 5 | 7 | |
| 6 | 8 | import org.junit.jupiter.api.Test; |
| | 9 | import org.junit.jupiter.api.parallel.Execution; |
| | 10 | import org.junit.jupiter.api.parallel.ExecutionMode; |
| | 11 | import org.openstreetmap.josm.gui.preferences.PreferenceSetting; |
| 7 | 12 | import org.openstreetmap.josm.gui.preferences.PreferencesTestUtils; |
| 8 | 13 | |
| 9 | 14 | /** |
| 10 | 15 | * Unit tests of {@link DisplayPreference} class. |
| 11 | 16 | */ |
| | 17 | @Execution(ExecutionMode.SAME_THREAD) |
| 12 | 18 | class DisplayPreferenceTest { |
| | 19 | |
| 13 | 20 | /** |
| 14 | 21 | * Unit test of {@link DisplayPreference#DisplayPreference}. |
| 15 | 22 | */ |
| 16 | 23 | @Test |
| 17 | | void testDisplayPreference() { |
| 18 | | assertNotNull(new DisplayPreference.Factory().createPreferenceSetting()); |
| | 24 | void testDisplayPreference_ShouldCreateValidInstance() { |
| | 25 | final PreferenceSetting preferenceSetting = new DisplayPreference.Factory().createPreferenceSetting(); |
| | 26 | |
| | 27 | assertNotNull(preferenceSetting, () -> "The factory should not return null."); |
| | 28 | assertInstanceOf(DisplayPreference.class, preferenceSetting, |
| | 29 | () -> "The factory should create a valid DisplayPreference instance."); |
| 19 | 30 | } |
| 20 | 31 | |
| 21 | 32 | /** |
| 22 | | * Unit test of {@link DisplayPreference#addGui}. |
| | 33 | * Smoke test for {@link DisplayPreference#addGui} without verifying tab integration. |
| 23 | 34 | */ |
| 24 | 35 | @Test |
| 25 | | void testAddGui() { |
| 26 | | PreferencesTestUtils.doTestPreferenceSettingAddGui(new DisplayPreference.Factory(), null); |
| | 36 | void testAddGui_WithoutParentClass_ShouldNotThrowException() { |
| | 37 | assertDoesNotThrow(() -> |
| | 38 | PreferencesTestUtils.doTestPreferenceSettingAddGui(new DisplayPreference.Factory(), null), |
| | 39 | "Should not throw an exception when parent class is null (e.g. when menu is invisible or not registered)."); |
| 27 | 40 | } |
| 28 | 41 | } |