-
Subject: [PATCH] See #16567: Update to JUnit 5
This converts most tests to use @Annotations. There are also some performance
improvements as it relates to tests.
---
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
diff --git a/src/org/openstreetmap/josm/data/validation/tests/CrossingWays.java b/src/org/openstreetmap/josm/data/validation/tests/CrossingWays.java
|
a
|
b
|
|
| 457 | 457 | |
| 458 | 458 | List<Way> prims = Arrays.asList(es1.getWay(), es2.getWay()); |
| 459 | 459 | if ((highlight = crossingWays.get(prims)) == null) { |
| 460 | | highlight = new ArrayList<>(); |
| | 460 | highlight = new ArrayList<>(2); |
| 461 | 461 | highlight.add(es1); |
| 462 | 462 | highlight.add(es2); |
| 463 | 463 | crossingWays.put(prims, highlight); |
-
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
diff --git a/src/org/openstreetmap/josm/data/validation/ValidatorCLI.java b/src/org/openstreetmap/josm/data/validation/ValidatorCLI.java
|
a
|
b
|
|
| 355 | 355 | Config.setUrlsProvider(JosmUrls.getInstance()); |
| 356 | 356 | ProjectionRegistry.setProjection(Projections.getProjectionByCode("epsg:3857".toUpperCase(Locale.ROOT))); |
| 357 | 357 | |
| 358 | | Territories.initializeInternalData(); |
| | 358 | if (Territories.getKnownIso3166Codes().isEmpty()) { |
| | 359 | Territories.initializeInternalData(); |
| | 360 | } |
| 359 | 361 | OsmValidator.initialize(); |
| 360 | 362 | MapPaintStyles.readFromPreferences(); |
| 361 | 363 | } |
-
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
diff --git a/src/org/openstreetmap/josm/gui/tagging/presets/TaggingPresets.java b/src/org/openstreetmap/josm/gui/tagging/presets/TaggingPresets.java
|
a
|
b
|
|
| 41 | 41 | public final class TaggingPresets { |
| 42 | 42 | |
| 43 | 43 | /** The collection of tagging presets */ |
| 44 | | private static final Collection<TaggingPreset> taggingPresets = new ArrayList<>(); |
| | 44 | private static final List<TaggingPreset> TAGGING_PRESETS = new ArrayList<>(); |
| 45 | 45 | |
| 46 | 46 | /** cache for key/value pairs found in the preset */ |
| 47 | 47 | private static final MultiMap<String, String> PRESET_TAG_CACHE = new MultiMap<>(); |
| … |
… |
|
| 68 | 68 | * Initializes tagging presets from preferences. |
| 69 | 69 | */ |
| 70 | 70 | public static void readFromPreferences() { |
| 71 | | taggingPresets.clear(); |
| 72 | | taggingPresets.addAll(TaggingPresetReader.readFromPreferences(false, false)); |
| 73 | | cachePresets(taggingPresets); |
| | 71 | TAGGING_PRESETS.clear(); |
| | 72 | TAGGING_PRESETS.addAll(TaggingPresetReader.readFromPreferences(false, false)); |
| | 73 | cachePresets(TAGGING_PRESETS); |
| 74 | 74 | } |
| 75 | 75 | |
| 76 | 76 | /** |
| … |
… |
|
| 88 | 88 | } |
| 89 | 89 | |
| 90 | 90 | readFromPreferences(); |
| 91 | | final List<TaggingPreset> activeLayerChangeListeners = new ArrayList<>(taggingPresets.size()); |
| 92 | | for (TaggingPreset tp: taggingPresets) { |
| | 91 | final List<TaggingPreset> activeLayerChangeListeners = new ArrayList<>(TAGGING_PRESETS.size()); |
| | 92 | for (TaggingPreset tp: TAGGING_PRESETS) { |
| 93 | 93 | if (!(tp instanceof TaggingPresetSeparator)) { |
| 94 | 94 | MainApplication.getToolbar().register(tp); |
| 95 | 95 | activeLayerChangeListeners.add(tp); |
| 96 | 96 | } |
| 97 | 97 | } |
| 98 | 98 | MainApplication.getLayerManager().addActiveLayerChangeListeners(activeLayerChangeListeners); |
| 99 | | if (taggingPresets.isEmpty()) { |
| | 99 | if (TAGGING_PRESETS.isEmpty()) { |
| 100 | 100 | presetsMenu.setVisible(false); |
| 101 | 101 | } else { |
| 102 | 102 | Map<TaggingPresetMenu, JMenu> submenus = new HashMap<>(); |
| 103 | | for (final TaggingPreset p : taggingPresets) { |
| | 103 | for (final TaggingPreset p : TAGGING_PRESETS) { |
| 104 | 104 | JMenu m = p.group != null ? submenus.get(p.group) : presetsMenu; |
| 105 | 105 | if (m == null && p.group != null) { |
| 106 | 106 | Logging.error("No tagging preset submenu for " + p.group); |
| … |
… |
|
| 126 | 126 | } |
| 127 | 127 | } |
| 128 | 128 | } |
| 129 | | if (SORT_MENU.get()) { |
| | 129 | if (Boolean.TRUE.equals(SORT_MENU.get())) { |
| 130 | 130 | TaggingPresetMenu.sortMenu(presetsMenu); |
| 131 | 131 | } |
| 132 | 132 | listeners.forEach(TaggingPresetListener::taggingPresetsModified); |
| … |
… |
|
| 141 | 141 | */ |
| 142 | 142 | public static void destroy() { |
| 143 | 143 | ToolbarPreferences toolBar = MainApplication.getToolbar(); |
| 144 | | for (TaggingPreset tp: taggingPresets) { |
| | 144 | for (TaggingPreset tp: TAGGING_PRESETS) { |
| 145 | 145 | toolBar.unregister(tp); |
| 146 | 146 | if (!(tp instanceof TaggingPresetSeparator)) { |
| 147 | 147 | MainApplication.getLayerManager().removeActiveLayerChangeListener(tp); |
| 148 | 148 | } |
| 149 | 149 | } |
| 150 | | taggingPresets.clear(); |
| | 150 | TAGGING_PRESETS.clear(); |
| 151 | 151 | PRESET_TAG_CACHE.clear(); |
| 152 | 152 | PRESET_ROLE_CACHE.clear(); |
| 153 | 153 | MainApplication.getMenu().presetsMenu.removeAll(); |
| … |
… |
|
| 190 | 190 | * @return a new collection containing all tagging presets. Empty if presets are not initialized (never null) |
| 191 | 191 | */ |
| 192 | 192 | public static Collection<TaggingPreset> getTaggingPresets() { |
| 193 | | return Collections.unmodifiableCollection(taggingPresets); |
| | 193 | return Collections.unmodifiableList(TAGGING_PRESETS); |
| 194 | 194 | } |
| 195 | 195 | |
| 196 | 196 | /** |
| … |
… |
|
| 263 | 263 | * @param presets The tagging presets to add |
| 264 | 264 | */ |
| 265 | 265 | public static void addTaggingPresets(Collection<TaggingPreset> presets) { |
| 266 | | if (presets != null && taggingPresets.addAll(presets)) { |
| | 266 | if (presets != null && TAGGING_PRESETS.addAll(presets)) { |
| 267 | 267 | listeners.forEach(TaggingPresetListener::taggingPresetsModified); |
| 268 | 268 | } |
| 269 | 269 | } |
-
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
diff --git a/test/functional/org/openstreetmap/josm/data/imagery/ImageryCompareTestIT.java b/test/functional/org/openstreetmap/josm/data/imagery/ImageryCompareTestIT.java
|
a
|
b
|
|
| 6 | 6 | import java.net.URL; |
| 7 | 7 | |
| 8 | 8 | import org.junit.jupiter.api.Test; |
| 9 | | import org.junit.jupiter.api.extension.RegisterExtension; |
| | 9 | import org.junit.jupiter.api.Timeout; |
| 10 | 10 | import org.openstreetmap.josm.spi.preferences.Config; |
| 11 | | import org.openstreetmap.josm.testutils.JOSMTestRules; |
| | 11 | import org.openstreetmap.josm.testutils.annotations.BasicPreferences; |
| 12 | 12 | import org.openstreetmap.josm.tools.HttpClient; |
| 13 | 13 | |
| 14 | | import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; |
| 15 | | |
| 16 | 14 | /** |
| 17 | 15 | * Automatic test of imagery synchronization between JOSM and ELI. |
| 18 | 16 | * See <a href="https://josm.openstreetmap.de/wiki/ImageryCompare">JOSM wiki</a> |
| 19 | 17 | */ |
| | 18 | @BasicPreferences |
| | 19 | @Timeout(60) |
| 20 | 20 | class ImageryCompareTestIT { |
| 21 | 21 | |
| 22 | 22 | private static final String BLACK_PREFIX = "<pre style=\"margin:3px;color:black\">"; |
| 23 | 23 | private static final String RED_PREFIX = "<pre style=\"margin:3px;color:red\">"; |
| 24 | 24 | |
| 25 | | /** |
| 26 | | * Setup test. |
| 27 | | */ |
| 28 | | @RegisterExtension |
| 29 | | @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") |
| 30 | | public JOSMTestRules test = new JOSMTestRules().preferences().timeout(60000); |
| 31 | | |
| 32 | 25 | /** |
| 33 | 26 | * Test of imagery entries. |
| 34 | 27 | * @throws Exception if an error occurs |
-
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
diff --git a/test/functional/org/openstreetmap/josm/data/osm/TaginfoTestIT.java b/test/functional/org/openstreetmap/josm/data/osm/TaginfoTestIT.java
|
a
|
b
|
|
| 9 | 9 | import java.util.ArrayList; |
| 10 | 10 | import java.util.List; |
| 11 | 11 | |
| 12 | | import jakarta.json.Json; |
| 13 | | import jakarta.json.JsonObject; |
| 14 | | import jakarta.json.JsonReader; |
| 15 | | import jakarta.json.JsonValue; |
| 16 | | |
| 17 | 12 | import org.junit.jupiter.api.Test; |
| 18 | | import org.junit.jupiter.api.extension.RegisterExtension; |
| | 13 | import org.junit.jupiter.api.Timeout; |
| 19 | 14 | import org.openstreetmap.josm.data.coor.LatLon; |
| 20 | 15 | import org.openstreetmap.josm.data.validation.tests.MapCSSTagChecker; |
| 21 | 16 | import org.openstreetmap.josm.data.validation.tests.TagChecker; |
| 22 | 17 | import org.openstreetmap.josm.gui.mappaint.mapcss.parsergen.ParseException; |
| 23 | 18 | import org.openstreetmap.josm.gui.tagging.presets.TaggingPresets; |
| 24 | | import org.openstreetmap.josm.testutils.JOSMTestRules; |
| | 19 | import org.openstreetmap.josm.testutils.annotations.BasicPreferences; |
| 25 | 20 | import org.openstreetmap.josm.tools.HttpClient; |
| 26 | | import org.xml.sax.SAXException; |
| 27 | 21 | |
| 28 | | import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; |
| | 22 | import jakarta.json.Json; |
| | 23 | import jakarta.json.JsonObject; |
| | 24 | import jakarta.json.JsonReader; |
| | 25 | import jakarta.json.JsonValue; |
| 29 | 26 | |
| 30 | 27 | /** |
| 31 | 28 | * Various integration tests with Taginfo. |
| 32 | 29 | */ |
| | 30 | @BasicPreferences |
| | 31 | @Timeout(20) |
| 33 | 32 | class TaginfoTestIT { |
| 34 | | |
| 35 | | /** |
| 36 | | * Setup test. |
| 37 | | */ |
| 38 | | @RegisterExtension |
| 39 | | @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") |
| 40 | | public JOSMTestRules test = new JOSMTestRules().preferences().timeout(20000); |
| 41 | | |
| 42 | 33 | /** |
| 43 | 34 | * Checks that popular tags are known (i.e included in internal presets, or deprecated, or explicitely ignored) |
| 44 | | * @throws SAXException if any XML parsing error occurs |
| 45 | 35 | * @throws IOException if any I/O error occurs |
| 46 | 36 | * @throws ParseException if any MapCSS parsing error occurs |
| 47 | 37 | */ |
| 48 | 38 | @Test |
| 49 | | void testCheckPopularTags() throws SAXException, IOException, ParseException { |
| | 39 | void testCheckPopularTags() throws IOException, ParseException { |
| 50 | 40 | TaggingPresets.readFromPreferences(); |
| 51 | 41 | new TagChecker().initialize(); |
| 52 | 42 | MapCSSTagChecker mapCssTagChecker = new MapCSSTagChecker(); |
-
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
diff --git a/test/functional/org/openstreetmap/josm/data/BoundariesTestIT.java b/test/functional/org/openstreetmap/josm/data/BoundariesTestIT.java
|
a
|
b
|
|
| 11 | 11 | import java.util.stream.Collectors; |
| 12 | 12 | |
| 13 | 13 | import org.junit.jupiter.api.Test; |
| 14 | | import org.junit.jupiter.api.extension.RegisterExtension; |
| 15 | 14 | import org.openstreetmap.josm.data.osm.DataSet; |
| 16 | 15 | import org.openstreetmap.josm.data.osm.OsmPrimitive; |
| 17 | 16 | import org.openstreetmap.josm.data.osm.search.SearchCompiler; |
| 18 | 17 | import org.openstreetmap.josm.io.OsmReader; |
| 19 | | import org.openstreetmap.josm.testutils.JOSMTestRules; |
| 20 | | |
| 21 | | import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; |
| | 18 | import org.openstreetmap.josm.testutils.annotations.BasicPreferences; |
| 22 | 19 | |
| 23 | 20 | /** |
| 24 | 21 | * Test of boundaries OSM file. |
| 25 | 22 | */ |
| | 23 | @BasicPreferences |
| 26 | 24 | class BoundariesTestIT { |
| 27 | 25 | |
| 28 | 26 | private static final List<String> RETIRED_ISO3166_1_CODES = Arrays.asList( |
| … |
… |
|
| 46 | 44 | "US-PR", "US-RI", "US-SC", "US-SD", "US-TN", "US-TX", "US-UM", "US-UT", "US-VT", "US-VA", "US-VI", "US-WA", "US-WV", "US-WI", |
| 47 | 45 | "US-WY"); |
| 48 | 46 | |
| 49 | | /** |
| 50 | | * Setup test. |
| 51 | | */ |
| 52 | | @RegisterExtension |
| 53 | | @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") |
| 54 | | public JOSMTestRules test = new JOSMTestRules().preferences(); |
| 55 | | |
| 56 | 47 | /** |
| 57 | 48 | * Test of boundaries OSM file. |
| 58 | 49 | * @throws Exception if an error occurs |
-
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
diff --git a/test/functional/org/openstreetmap/josm/gui/mappaint/MapCSSRendererTest.java b/test/functional/org/openstreetmap/josm/gui/mappaint/MapCSSRendererTest.java
|
a
|
b
|
|
| 27 | 27 | |
| 28 | 28 | import javax.imageio.ImageIO; |
| 29 | 29 | |
| 30 | | import org.junit.jupiter.api.extension.RegisterExtension; |
| 31 | 30 | import org.junit.jupiter.params.ParameterizedTest; |
| 32 | 31 | import org.junit.jupiter.params.provider.MethodSource; |
| 33 | 32 | import org.openstreetmap.josm.TestUtils; |
| … |
… |
|
| 39 | 38 | import org.openstreetmap.josm.data.projection.ProjectionRegistry; |
| 40 | 39 | import org.openstreetmap.josm.io.IllegalDataException; |
| 41 | 40 | import org.openstreetmap.josm.io.OsmReader; |
| 42 | | import org.openstreetmap.josm.testutils.JOSMTestRules; |
| | 41 | import org.openstreetmap.josm.testutils.annotations.BasicPreferences; |
| | 42 | import org.openstreetmap.josm.testutils.annotations.Projection; |
| 43 | 43 | import org.openstreetmap.josm.tools.ColorHelper; |
| 44 | 44 | import org.openstreetmap.josm.tools.Utils; |
| 45 | 45 | |
| 46 | | import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; |
| 47 | | |
| 48 | 46 | /** |
| 49 | 47 | * Test cases for {@link StyledMapRenderer} and the MapCSS classes. |
| 50 | 48 | * <p> |
| 51 | 49 | * This test uses the data and reference files stored in the test data directory {@value #TEST_DATA_BASE} |
| 52 | 50 | * @author Michael Zangl |
| 53 | 51 | */ |
| | 52 | @BasicPreferences |
| | 53 | @Projection |
| 54 | 54 | public class MapCSSRendererTest { |
| 55 | 55 | private static final String TEST_DATA_BASE = "/renderer/"; |
| 56 | 56 | /** |
| … |
… |
|
| 59 | 59 | private static final Bounds AREA_DEFAULT = new Bounds(0, 0, 1, 1); |
| 60 | 60 | private static final int IMAGE_SIZE = 256; |
| 61 | 61 | |
| 62 | | /** |
| 63 | | * Minimal test rules required |
| 64 | | */ |
| 65 | | @RegisterExtension |
| 66 | | @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") |
| 67 | | public JOSMTestRules test = new JOSMTestRules().preferences().projection(); |
| 68 | | |
| 69 | 62 | // development flag - set to true in order to update all reference images |
| 70 | 63 | private static final boolean UPDATE_ALL = false; |
| 71 | 64 | |
-
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
diff --git a/test/functional/org/openstreetmap/josm/gui/mappaint/StyleCacheTest.java b/test/functional/org/openstreetmap/josm/gui/mappaint/StyleCacheTest.java
|
a
|
b
|
|
| 9 | 9 | import java.awt.Graphics2D; |
| 10 | 10 | import java.awt.image.BufferedImage; |
| 11 | 11 | import java.io.File; |
| | 12 | import java.io.IOException; |
| 12 | 13 | import java.io.InputStream; |
| 13 | 14 | import java.util.IdentityHashMap; |
| 14 | 15 | |
| 15 | 16 | import org.junit.jupiter.api.AfterAll; |
| | 17 | import org.junit.jupiter.api.BeforeAll; |
| 16 | 18 | import org.junit.jupiter.api.BeforeEach; |
| 17 | 19 | import org.junit.jupiter.api.Test; |
| 18 | | import org.junit.jupiter.api.extension.RegisterExtension; |
| | 20 | import org.junit.jupiter.api.Timeout; |
| 19 | 21 | import org.openstreetmap.josm.data.Bounds; |
| 20 | 22 | import org.openstreetmap.josm.data.osm.DataSet; |
| 21 | 23 | import org.openstreetmap.josm.data.osm.OsmPrimitive; |
| … |
… |
|
| 26 | 28 | import org.openstreetmap.josm.gui.NavigatableComponent; |
| 27 | 29 | import org.openstreetmap.josm.gui.progress.NullProgressMonitor; |
| 28 | 30 | import org.openstreetmap.josm.io.Compression; |
| | 31 | import org.openstreetmap.josm.io.IllegalDataException; |
| 29 | 32 | import org.openstreetmap.josm.io.OsmReader; |
| 30 | | import org.openstreetmap.josm.testutils.JOSMTestRules; |
| | 33 | import org.openstreetmap.josm.testutils.annotations.BasicPreferences; |
| | 34 | import org.openstreetmap.josm.testutils.annotations.Main; |
| | 35 | import org.openstreetmap.josm.testutils.annotations.Projection; |
| 31 | 36 | import org.openstreetmap.josm.tools.Pair; |
| 32 | 37 | |
| 33 | | import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; |
| 34 | | |
| 35 | 38 | /** |
| 36 | 39 | * Test {@link StyleCache}. |
| 37 | 40 | */ |
| | 41 | @BasicPreferences |
| | 42 | @Main |
| | 43 | @org.openstreetmap.josm.testutils.annotations.MapPaintStyles |
| | 44 | @Projection |
| | 45 | @Timeout(60) |
| 38 | 46 | class StyleCacheTest { |
| 39 | 47 | |
| 40 | 48 | private static final int IMG_WIDTH = 1400; |
| … |
… |
|
| 46 | 54 | private static DataSet dsCity; |
| 47 | 55 | private static DataSet dsCity2; |
| 48 | 56 | |
| 49 | | /** |
| 50 | | * The test rules used for this test. |
| 51 | | */ |
| 52 | | @RegisterExtension |
| 53 | | @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") |
| 54 | | public JOSMTestRules test = new JOSMTestRules().main().preferences().projection().mapStyles().timeout(60000); |
| | 57 | @BeforeAll |
| | 58 | static void beforeAll() throws IllegalDataException, IOException { |
| | 59 | try (InputStream in = Compression.getUncompressedFileInputStream(new File("nodist/data/neubrandenburg.osm.bz2"))) { |
| | 60 | dsCity = OsmReader.parseDataSet(in, NullProgressMonitor.INSTANCE); |
| | 61 | } |
| | 62 | dsCity2 = new DataSet(dsCity); |
| | 63 | } |
| 55 | 64 | |
| 56 | 65 | /** |
| 57 | 66 | * Load the test data that is required. |
| … |
… |
|
| 60 | 69 | @BeforeEach |
| 61 | 70 | public void load() throws Exception { |
| 62 | 71 | img = new BufferedImage(IMG_WIDTH, IMG_HEIGHT, BufferedImage.TYPE_INT_ARGB); |
| 63 | | try (InputStream in = Compression.getUncompressedFileInputStream(new File("nodist/data/neubrandenburg.osm.bz2"))) { |
| 64 | | dsCity = OsmReader.parseDataSet(in, NullProgressMonitor.INSTANCE); |
| 65 | | } |
| 66 | | dsCity2 = new DataSet(dsCity); |
| 67 | 72 | } |
| 68 | 73 | |
| 69 | 74 | /** |
| … |
… |
|
| 96 | 101 | /** |
| 97 | 102 | * Verifies, that the intern pool is not growing when repeatedly rendering the |
| 98 | 103 | * same set of primitives (and clearing the calculated styles each time). |
| 99 | | * |
| | 104 | * <p> |
| 100 | 105 | * If it grows, this is an indication that the {@code equals} and {@code hashCode} |
| 101 | 106 | * implementation is broken and two identical objects are not recognized as equal |
| 102 | 107 | * or produce different hash codes. |
| 103 | | * |
| | 108 | * <p> |
| 104 | 109 | * The opposite problem (different objects are mistaken as equal) has more visible |
| 105 | 110 | * consequences for the user (wrong rendering on the map) and is not recognized by |
| 106 | 111 | * this test. |
| … |
… |
|
| 134 | 139 | /** |
| 135 | 140 | * Verifies, that the number of {@code StyleElementList} instances stored |
| 136 | 141 | * for all the rendered primitives is actually low (as intended). |
| 137 | | * |
| | 142 | * <p> |
| 138 | 143 | * Two primitives with the same style should share one {@code StyleElementList} |
| 139 | 144 | * instance for the cached style elements. This is verified by counting all |
| 140 | 145 | * the instances using {@code A == B} identity. |
-
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
diff --git a/test/performance/org/openstreetmap/josm/data/osm/visitor/paint/AbstractMapRendererPerformanceTestParent.java b/test/performance/org/openstreetmap/josm/data/osm/visitor/paint/AbstractMapRendererPerformanceTestParent.java
|
a
|
b
|
|
| 16 | 16 | |
| 17 | 17 | import org.junit.jupiter.api.Test; |
| 18 | 18 | import org.junit.jupiter.api.Timeout; |
| 19 | | import org.openstreetmap.josm.JOSMFixture; |
| 20 | 19 | import org.openstreetmap.josm.PerformanceTestUtils; |
| 21 | 20 | import org.openstreetmap.josm.data.Bounds; |
| 22 | 21 | import org.openstreetmap.josm.data.osm.DataSet; |
| … |
… |
|
| 24 | 23 | import org.openstreetmap.josm.gui.progress.NullProgressMonitor; |
| 25 | 24 | import org.openstreetmap.josm.io.Compression; |
| 26 | 25 | import org.openstreetmap.josm.io.OsmReader; |
| | 26 | import org.openstreetmap.josm.testutils.annotations.Projection; |
| | 27 | import org.openstreetmap.josm.testutils.annotations.Territories; |
| 27 | 28 | |
| 28 | 29 | import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; |
| 29 | 30 | |
| 30 | 31 | /** |
| 31 | 32 | * Abstract superclass of {@code StyledMapRendererPerformanceTest} and {@code WireframeMapRendererPerformanceTest}. |
| 32 | 33 | */ |
| | 34 | @Projection |
| | 35 | @Territories |
| 33 | 36 | @Timeout(value = 15, unit = TimeUnit.MINUTES) |
| 34 | 37 | abstract class AbstractMapRendererPerformanceTestParent { |
| 35 | 38 | |
| … |
… |
|
| 48 | 51 | private static DataSet dsCity; |
| 49 | 52 | |
| 50 | 53 | protected static void load() throws Exception { |
| 51 | | JOSMFixture.createPerformanceTestFixture().init(true); |
| 52 | 54 | img = new BufferedImage(IMG_WIDTH, IMG_HEIGHT, BufferedImage.TYPE_INT_ARGB); |
| 53 | 55 | g = (Graphics2D) img.getGraphics(); |
| 54 | 56 | g.setClip(0, 0, IMG_WIDTH, IMG_HEIGHT); |
-
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
diff --git a/test/performance/org/openstreetmap/josm/data/osm/KeyValuePerformanceTest.java b/test/performance/org/openstreetmap/josm/data/osm/KeyValuePerformanceTest.java
|
a
|
b
|
|
| 16 | 16 | import org.junit.jupiter.api.BeforeEach; |
| 17 | 17 | import org.junit.jupiter.api.Test; |
| 18 | 18 | import org.junit.jupiter.api.Timeout; |
| 19 | | import org.junit.jupiter.api.extension.RegisterExtension; |
| 20 | 19 | import org.openstreetmap.josm.PerformanceTestUtils; |
| 21 | 20 | import org.openstreetmap.josm.PerformanceTestUtils.PerformanceTestTimer; |
| 22 | 21 | import org.openstreetmap.josm.data.osm.OsmDataGenerator.KeyValueDataGenerator; |
| 23 | | import org.openstreetmap.josm.testutils.JOSMTestRules; |
| | 22 | import org.openstreetmap.josm.testutils.annotations.Projection; |
| 24 | 23 | |
| 25 | 24 | import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; |
| 26 | 25 | |
| … |
… |
|
| 28 | 27 | * This test measures the performance of {@link OsmPrimitive#get(String)} and related. |
| 29 | 28 | * @author Michael Zangl |
| 30 | 29 | */ |
| | 30 | @Projection |
| 31 | 31 | @Timeout(value = 15, unit = TimeUnit.MINUTES) |
| 32 | 32 | class KeyValuePerformanceTest { |
| 33 | 33 | private static final int PUT_RUNS = 10000; |
| … |
… |
|
| 38 | 38 | private final ArrayList<String> testStrings = new ArrayList<>(); |
| 39 | 39 | private Random random; |
| 40 | 40 | |
| 41 | | /** |
| 42 | | * Prepare the test. |
| 43 | | */ |
| 44 | | @RegisterExtension |
| 45 | | @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") |
| 46 | | public JOSMTestRules test = new JOSMTestRules().projection(); |
| 47 | | |
| 48 | 41 | /** |
| 49 | 42 | * See if there is a big difference between Strings that are interned and those that are not. |
| 50 | 43 | */ |
-
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
diff --git a/test/performance/org/openstreetmap/josm/gui/mappaint/mapcss/MapCSSPerformanceTest.java b/test/performance/org/openstreetmap/josm/gui/mappaint/mapcss/MapCSSPerformanceTest.java
|
a
|
b
|
|
| 10 | 10 | import java.util.Collection; |
| 11 | 11 | |
| 12 | 12 | import org.junit.jupiter.api.Test; |
| 13 | | import org.junit.jupiter.api.BeforeAll; |
| 14 | | import org.openstreetmap.josm.JOSMFixture; |
| 15 | 13 | import org.openstreetmap.josm.PerformanceTestUtils; |
| 16 | 14 | import org.openstreetmap.josm.data.Bounds; |
| 17 | 15 | import org.openstreetmap.josm.data.osm.DataSet; |
| … |
… |
|
| 21 | 19 | import org.openstreetmap.josm.gui.NavigatableComponent; |
| 22 | 20 | import org.openstreetmap.josm.gui.mappaint.MapRendererPerformanceTest; |
| 23 | 21 | import org.openstreetmap.josm.io.IllegalDataException; |
| | 22 | import org.openstreetmap.josm.testutils.annotations.Projection; |
| 24 | 23 | |
| 25 | 24 | /** |
| 26 | 25 | * This performance test measures the time for a full run of MapPaintVisitor.visitAll() |
| 27 | 26 | * against a test data set using a test style. |
| 28 | 27 | * |
| 29 | 28 | */ |
| | 29 | @Projection |
| 30 | 30 | class MapCSSPerformanceTest { |
| 31 | 31 | |
| 32 | 32 | /* ------------------------ configuration section ---------------------------- */ |
| … |
… |
|
| 47 | 47 | } |
| 48 | 48 | } |
| 49 | 49 | |
| 50 | | /** |
| 51 | | * Setup test. |
| 52 | | */ |
| 53 | | @BeforeAll |
| 54 | | public static void createJOSMFixture() { |
| 55 | | JOSMFixture.createPerformanceTestFixture().init(true); |
| 56 | | } |
| 57 | | |
| 58 | 50 | long timed(Runnable callable) { |
| 59 | 51 | long before = System.currentTimeMillis(); |
| 60 | 52 | callable.run(); |
-
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
diff --git a/test/performance/org/openstreetmap/josm/gui/mappaint/mapcss/MapCSSStyleSourceFilterTest.java b/test/performance/org/openstreetmap/josm/gui/mappaint/mapcss/MapCSSStyleSourceFilterTest.java
|
a
|
b
|
|
| 3 | 3 | |
| 4 | 4 | import java.util.concurrent.TimeUnit; |
| 5 | 5 | |
| 6 | | import org.junit.jupiter.api.BeforeAll; |
| 7 | 6 | import org.junit.jupiter.api.Test; |
| 8 | 7 | import org.junit.jupiter.api.Timeout; |
| 9 | | import org.openstreetmap.josm.JOSMFixture; |
| 10 | 8 | import org.openstreetmap.josm.PerformanceTestUtils; |
| 11 | 9 | import org.openstreetmap.josm.PerformanceTestUtils.PerformanceTestTimer; |
| 12 | 10 | import org.openstreetmap.josm.data.osm.OsmDataGenerator; |
| 13 | 11 | import org.openstreetmap.josm.data.osm.OsmDataGenerator.KeyValueDataGenerator; |
| 14 | 12 | import org.openstreetmap.josm.gui.mappaint.MultiCascade; |
| | 13 | import org.openstreetmap.josm.testutils.annotations.Projection; |
| 15 | 14 | |
| 16 | 15 | /** |
| 17 | 16 | * Tests how fast {@link MapCSSStyleSource} finds the right style candidates for one object. |
| 18 | 17 | * @author Michael Zangl |
| 19 | 18 | */ |
| | 19 | @Projection |
| 20 | 20 | @Timeout(value = 15, unit = TimeUnit.MINUTES) |
| 21 | 21 | class MapCSSStyleSourceFilterTest { |
| 22 | 22 | |
| … |
… |
|
| 80 | 80 | |
| 81 | 81 | private static final int APPLY_CALLS = 100000; |
| 82 | 82 | |
| 83 | | /** |
| 84 | | * Prepare the test. |
| 85 | | */ |
| 86 | | @BeforeAll |
| 87 | | public static void createJOSMFixture() { |
| 88 | | JOSMFixture.createPerformanceTestFixture().init(true); |
| 89 | | } |
| 90 | | |
| 91 | 83 | /** |
| 92 | 84 | * Time how long it takes to evaluate [key=value] rules |
| 93 | 85 | */ |
-
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
diff --git a/test/performance/org/openstreetmap/josm/gui/mappaint/MapRendererPerformanceTest.java b/test/performance/org/openstreetmap/josm/gui/mappaint/MapRendererPerformanceTest.java
|
a
|
b
|
|
| 18 | 18 | import java.util.List; |
| 19 | 19 | import java.util.Locale; |
| 20 | 20 | import java.util.Map; |
| | 21 | import java.util.concurrent.TimeUnit; |
| 21 | 22 | import java.util.stream.Collectors; |
| 22 | 23 | |
| 23 | 24 | import javax.imageio.ImageIO; |
| … |
… |
|
| 25 | 26 | import org.junit.jupiter.api.AfterAll; |
| 26 | 27 | import org.junit.jupiter.api.BeforeAll; |
| 27 | 28 | import org.junit.jupiter.api.Test; |
| 28 | | import org.junit.jupiter.api.extension.RegisterExtension; |
| 29 | | import org.openstreetmap.josm.JOSMFixture; |
| | 29 | import org.junit.jupiter.api.Timeout; |
| 30 | 30 | import org.openstreetmap.josm.PerformanceTestUtils; |
| 31 | 31 | import org.openstreetmap.josm.TestUtils; |
| 32 | 32 | import org.openstreetmap.josm.data.Bounds; |
| … |
… |
|
| 43 | 43 | import org.openstreetmap.josm.gui.mappaint.mapcss.MapCSSStyleSource; |
| 44 | 44 | import org.openstreetmap.josm.gui.mappaint.mapcss.Selector; |
| 45 | 45 | import org.openstreetmap.josm.gui.mappaint.styleelement.StyleElement; |
| 46 | | import org.openstreetmap.josm.testutils.JOSMTestRules; |
| | 46 | import org.openstreetmap.josm.testutils.annotations.BasicPreferences; |
| | 47 | import org.openstreetmap.josm.testutils.annotations.Main; |
| | 48 | import org.openstreetmap.josm.testutils.annotations.Projection; |
| | 49 | import org.openstreetmap.josm.testutils.annotations.Territories; |
| 47 | 50 | |
| 48 | 51 | import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; |
| 49 | 52 | |
| 50 | 53 | /** |
| 51 | 54 | * Performance test of map renderer. |
| 52 | 55 | */ |
| | 56 | @BasicPreferences |
| | 57 | @Main |
| | 58 | @Projection |
| | 59 | @Territories |
| | 60 | @Timeout(value = 15, unit = TimeUnit.MINUTES) |
| 53 | 61 | public class MapRendererPerformanceTest { |
| 54 | 62 | |
| 55 | 63 | private static final boolean DUMP_IMAGE = false; // dump images to file for debugging purpose |
| … |
… |
|
| 80 | 88 | |
| 81 | 89 | private static final EnumMap<Feature, BooleanStyleSetting> filters = new EnumMap<>(Feature.class); |
| 82 | 90 | |
| 83 | | /** |
| 84 | | * Setup tests |
| 85 | | */ |
| 86 | | @RegisterExtension |
| 87 | | @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") |
| 88 | | public JOSMTestRules josmTestRules = new JOSMTestRules().main().projection().preferences().timeout(15 * 60 * 1000); |
| 89 | | |
| 90 | 91 | /** |
| 91 | 92 | * Initializes test environment. |
| 92 | 93 | * @throws Exception if any error occurs |
| 93 | 94 | */ |
| 94 | 95 | @BeforeAll |
| 95 | 96 | public static void load() throws Exception { |
| 96 | | JOSMFixture.createPerformanceTestFixture().init(true); |
| 97 | | |
| 98 | 97 | img = new BufferedImage(IMG_WIDTH, IMG_HEIGHT, BufferedImage.TYPE_INT_ARGB); |
| 99 | 98 | g = (Graphics2D) img.getGraphics(); |
| 100 | 99 | g.setClip(0, 0, IMG_WIDTH, IMG_HEIGHT); |
-
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
diff --git a/test/unit/org/openstreetmap/josm/actions/mapmode/AddNoteActionTest.java b/test/unit/org/openstreetmap/josm/actions/mapmode/AddNoteActionTest.java
|
a
|
b
|
|
| 4 | 4 | import static org.junit.jupiter.api.Assertions.assertEquals; |
| 5 | 5 | import static org.junit.jupiter.api.Assertions.assertTrue; |
| 6 | 6 | |
| 7 | | import org.junit.jupiter.api.extension.RegisterExtension; |
| 8 | 7 | import org.junit.jupiter.api.Test; |
| 9 | 8 | import org.openstreetmap.josm.data.osm.DataSet; |
| 10 | 9 | import org.openstreetmap.josm.data.osm.NoteData; |
| 11 | 10 | import org.openstreetmap.josm.gui.MainApplication; |
| 12 | 11 | import org.openstreetmap.josm.gui.MapFrame; |
| 13 | 12 | import org.openstreetmap.josm.gui.layer.OsmDataLayer; |
| 14 | | import org.openstreetmap.josm.testutils.JOSMTestRules; |
| 15 | | |
| 16 | | import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; |
| | 13 | import org.openstreetmap.josm.testutils.annotations.Main; |
| | 14 | import org.openstreetmap.josm.testutils.annotations.Projection; |
| 17 | 15 | |
| 18 | 16 | /** |
| 19 | 17 | * Unit tests for class {@link AddNoteAction}. |
| 20 | 18 | */ |
| | 19 | @Main |
| | 20 | @Projection |
| 21 | 21 | class AddNoteActionTest { |
| 22 | | |
| 23 | | /** |
| 24 | | * Setup test. |
| 25 | | */ |
| 26 | | @RegisterExtension |
| 27 | | @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") |
| 28 | | public JOSMTestRules test = new JOSMTestRules().main().projection(); |
| 29 | | |
| 30 | 22 | /** |
| 31 | 23 | * Unit test of {@link AddNoteAction#enterMode} and {@link AddNoteAction#exitMode}. |
| 32 | 24 | */ |
-
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
diff --git a/test/unit/org/openstreetmap/josm/actions/mapmode/DeleteActionTest.java b/test/unit/org/openstreetmap/josm/actions/mapmode/DeleteActionTest.java
|
a
|
b
|
|
| 4 | 4 | import static org.junit.jupiter.api.Assertions.assertEquals; |
| 5 | 5 | import static org.junit.jupiter.api.Assertions.assertTrue; |
| 6 | 6 | |
| 7 | | import org.junit.jupiter.api.extension.RegisterExtension; |
| 8 | 7 | import org.junit.jupiter.api.Test; |
| 9 | 8 | import org.openstreetmap.josm.TestUtils; |
| 10 | 9 | import org.openstreetmap.josm.actions.mapmode.DeleteAction.DeleteMode; |
| … |
… |
|
| 12 | 11 | import org.openstreetmap.josm.gui.MainApplication; |
| 13 | 12 | import org.openstreetmap.josm.gui.MapFrame; |
| 14 | 13 | import org.openstreetmap.josm.gui.layer.OsmDataLayer; |
| 15 | | import org.openstreetmap.josm.testutils.JOSMTestRules; |
| 16 | | |
| 17 | | import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; |
| | 14 | import org.openstreetmap.josm.testutils.annotations.Main; |
| | 15 | import org.openstreetmap.josm.testutils.annotations.Projection; |
| 18 | 16 | |
| 19 | 17 | /** |
| 20 | 18 | * Unit tests for class {@link DeleteAction}. |
| 21 | 19 | */ |
| | 20 | @Main |
| | 21 | @Projection |
| 22 | 22 | class DeleteActionTest { |
| 23 | | |
| 24 | | /** |
| 25 | | * Setup test. |
| 26 | | */ |
| 27 | | @RegisterExtension |
| 28 | | @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") |
| 29 | | public JOSMTestRules test = new JOSMTestRules().main().projection(); |
| 30 | | |
| 31 | 23 | /** |
| 32 | 24 | * Unit test of {@link DeleteAction#enterMode} and {@link DeleteAction#exitMode}. |
| 33 | 25 | */ |
-
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
diff --git a/test/unit/org/openstreetmap/josm/actions/mapmode/DrawActionTest.java b/test/unit/org/openstreetmap/josm/actions/mapmode/DrawActionTest.java
|
a
|
b
|
|
| 13 | 13 | |
| 14 | 14 | import javax.swing.JList; |
| 15 | 15 | |
| 16 | | import org.junit.jupiter.api.extension.RegisterExtension; |
| 17 | 16 | import org.junit.jupiter.api.Test; |
| | 17 | import org.junit.jupiter.api.Timeout; |
| 18 | 18 | import org.openstreetmap.josm.data.UndoRedoHandler; |
| 19 | 19 | import org.openstreetmap.josm.data.coor.EastNorth; |
| 20 | 20 | import org.openstreetmap.josm.data.osm.DataSet; |
| … |
… |
|
| 25 | 25 | import org.openstreetmap.josm.gui.MapFrame; |
| 26 | 26 | import org.openstreetmap.josm.gui.PrimitiveRenderer; |
| 27 | 27 | import org.openstreetmap.josm.gui.layer.OsmDataLayer; |
| 28 | | import org.openstreetmap.josm.testutils.JOSMTestRules; |
| 29 | | |
| 30 | | import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; |
| | 28 | import org.openstreetmap.josm.testutils.annotations.Main; |
| | 29 | import org.openstreetmap.josm.testutils.annotations.Projection; |
| 31 | 30 | |
| 32 | 31 | /** |
| 33 | 32 | * Unit tests for class {@link DrawAction}. |
| 34 | 33 | */ |
| | 34 | @Main |
| | 35 | @Projection |
| | 36 | @Timeout(20) |
| 35 | 37 | class DrawActionTest { |
| 36 | | |
| 37 | | /** |
| 38 | | * Setup test. |
| 39 | | */ |
| 40 | | @RegisterExtension |
| 41 | | @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") |
| 42 | | public JOSMTestRules test = new JOSMTestRules().main().projection().timeout(20000); |
| 43 | | |
| 44 | 38 | /** |
| 45 | 39 | * Non regression test case for bug #12011. |
| 46 | 40 | * Add a new node in the middle of way then undo. The rendering of the node, selected, must not cause any crash in PrimitiveRenderer. |
| 47 | 41 | * @throws SecurityException see {@link Class#getDeclaredField} for details |
| 48 | | * @throws NoSuchFieldException see {@link Class#getDeclaredField} for details |
| 49 | | * @throws IllegalAccessException see {@link Field#set} for details |
| 50 | 42 | * @throws IllegalArgumentException see {@link Field#set} for details |
| 51 | 43 | */ |
| 52 | 44 | @Test |
| 53 | | void testTicket12011() throws IllegalArgumentException, IllegalAccessException, NoSuchFieldException, SecurityException { |
| | 45 | void testTicket12011() throws IllegalArgumentException, SecurityException { |
| 54 | 46 | DataSet dataSet = new DataSet(); |
| 55 | 47 | OsmDataLayer layer = new OsmDataLayer(dataSet, OsmDataLayer.createNewName(), null); |
| 56 | 48 | MainApplication.getLayerManager().addLayer(layer); |
| … |
… |
|
| 66 | 58 | dataSet.addPrimitive(n2); |
| 67 | 59 | |
| 68 | 60 | Way w = new Way(); |
| 69 | | w.setNodes(Arrays.asList(new Node[] {n1, n2})); |
| | 61 | w.setNodes(Arrays.asList(n1, n2)); |
| 70 | 62 | dataSet.addPrimitive(w); |
| 71 | 63 | |
| 72 | 64 | try { |
-
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
diff --git a/test/unit/org/openstreetmap/josm/actions/mapmode/DrawSnapHelperTest.java b/test/unit/org/openstreetmap/josm/actions/mapmode/DrawSnapHelperTest.java
|
a
|
b
|
|
| 10 | 10 | |
| 11 | 11 | import javax.swing.JCheckBoxMenuItem; |
| 12 | 12 | |
| 13 | | import org.junit.jupiter.api.extension.RegisterExtension; |
| 14 | 13 | import org.junit.jupiter.params.ParameterizedTest; |
| 15 | 14 | import org.junit.jupiter.params.provider.Arguments; |
| 16 | 15 | import org.junit.jupiter.params.provider.MethodSource; |
| … |
… |
|
| 25 | 24 | import org.openstreetmap.josm.data.projection.Projections; |
| 26 | 25 | import org.openstreetmap.josm.gui.MainApplication; |
| 27 | 26 | import org.openstreetmap.josm.gui.layer.OsmDataLayer; |
| 28 | | import org.openstreetmap.josm.testutils.JOSMTestRules; |
| | 27 | import org.openstreetmap.josm.testutils.annotations.Main; |
| 29 | 28 | import org.openstreetmap.josm.tools.Utils; |
| 30 | 29 | |
| 31 | 30 | /** |
| 32 | 31 | * Test class for {@link DrawSnapHelper} |
| 33 | 32 | */ |
| | 33 | @Main |
| | 34 | @org.openstreetmap.josm.testutils.annotations.Projection |
| 34 | 35 | class DrawSnapHelperTest { |
| 35 | | @RegisterExtension |
| 36 | | static JOSMTestRules rule = new JOSMTestRules().projection().main(); |
| 37 | | |
| 38 | 36 | static Stream<Arguments> testNonRegression13097() { |
| 39 | 37 | return Stream.of( |
| 40 | 38 | Arguments.of(Projections.getProjectionByCode("EPSG:4326")), // WGS84 Geographic |
-
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
diff --git a/test/unit/org/openstreetmap/josm/actions/mapmode/ExtrudeActionTest.java b/test/unit/org/openstreetmap/josm/actions/mapmode/ExtrudeActionTest.java
|
a
|
b
|
|
| 4 | 4 | import static org.junit.jupiter.api.Assertions.assertEquals; |
| 5 | 5 | import static org.junit.jupiter.api.Assertions.assertTrue; |
| 6 | 6 | |
| 7 | | import org.junit.jupiter.api.extension.RegisterExtension; |
| 8 | 7 | import org.junit.jupiter.api.Test; |
| 9 | 8 | import org.openstreetmap.josm.TestUtils; |
| 10 | 9 | import org.openstreetmap.josm.actions.mapmode.ExtrudeAction.Mode; |
| … |
… |
|
| 12 | 11 | import org.openstreetmap.josm.gui.MainApplication; |
| 13 | 12 | import org.openstreetmap.josm.gui.MapFrame; |
| 14 | 13 | import org.openstreetmap.josm.gui.layer.OsmDataLayer; |
| 15 | | import org.openstreetmap.josm.testutils.JOSMTestRules; |
| 16 | | |
| 17 | | import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; |
| | 14 | import org.openstreetmap.josm.testutils.annotations.Main; |
| | 15 | import org.openstreetmap.josm.testutils.annotations.Projection; |
| 18 | 16 | |
| 19 | 17 | /** |
| 20 | 18 | * Unit tests for class {@link ExtrudeAction}. |
| 21 | 19 | */ |
| | 20 | @Main |
| | 21 | @Projection |
| 22 | 22 | class ExtrudeActionTest { |
| 23 | | |
| 24 | | /** |
| 25 | | * Setup test. |
| 26 | | */ |
| 27 | | @RegisterExtension |
| 28 | | @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") |
| 29 | | public JOSMTestRules test = new JOSMTestRules().main().projection(); |
| 30 | | |
| 31 | 23 | /** |
| 32 | 24 | * Unit test of {@link ExtrudeAction#enterMode} and {@link ExtrudeAction#exitMode}. |
| 33 | 25 | */ |
-
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
diff --git a/test/unit/org/openstreetmap/josm/actions/mapmode/ImproveWayAccuracyActionTest.java b/test/unit/org/openstreetmap/josm/actions/mapmode/ImproveWayAccuracyActionTest.java
|
a
|
b
|
|
| 4 | 4 | import static org.junit.jupiter.api.Assertions.assertEquals; |
| 5 | 5 | import static org.junit.jupiter.api.Assertions.assertTrue; |
| 6 | 6 | |
| 7 | | import org.junit.jupiter.api.extension.RegisterExtension; |
| 8 | 7 | import org.junit.jupiter.api.Test; |
| 9 | 8 | import org.openstreetmap.josm.TestUtils; |
| 10 | 9 | import org.openstreetmap.josm.actions.mapmode.ImproveWayAccuracyAction.State; |
| … |
… |
|
| 12 | 11 | import org.openstreetmap.josm.gui.MainApplication; |
| 13 | 12 | import org.openstreetmap.josm.gui.MapFrame; |
| 14 | 13 | import org.openstreetmap.josm.gui.layer.OsmDataLayer; |
| 15 | | import org.openstreetmap.josm.testutils.JOSMTestRules; |
| 16 | | |
| 17 | | import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; |
| | 14 | import org.openstreetmap.josm.testutils.annotations.Main; |
| | 15 | import org.openstreetmap.josm.testutils.annotations.Projection; |
| 18 | 16 | |
| 19 | 17 | /** |
| 20 | 18 | * Unit tests for class {@link ImproveWayAccuracyAction}. |
| 21 | 19 | */ |
| | 20 | @Main |
| | 21 | @Projection |
| 22 | 22 | class ImproveWayAccuracyActionTest { |
| 23 | | |
| 24 | | /** |
| 25 | | * Setup test. |
| 26 | | */ |
| 27 | | @RegisterExtension |
| 28 | | @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") |
| 29 | | public JOSMTestRules test = new JOSMTestRules().main().projection(); |
| 30 | | |
| 31 | 23 | /** |
| 32 | 24 | * Unit test of {@link ImproveWayAccuracyAction#enterMode} and {@link ImproveWayAccuracyAction#exitMode}. |
| 33 | 25 | */ |
-
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
diff --git a/test/unit/org/openstreetmap/josm/actions/mapmode/ParallelWayActionTest.java b/test/unit/org/openstreetmap/josm/actions/mapmode/ParallelWayActionTest.java
|
a
|
b
|
|
| 4 | 4 | import static org.junit.jupiter.api.Assertions.assertEquals; |
| 5 | 5 | import static org.junit.jupiter.api.Assertions.assertTrue; |
| 6 | 6 | |
| 7 | | import org.junit.jupiter.api.extension.RegisterExtension; |
| 8 | 7 | import org.junit.jupiter.api.Test; |
| 9 | 8 | import org.openstreetmap.josm.TestUtils; |
| 10 | 9 | import org.openstreetmap.josm.actions.mapmode.ParallelWayAction.Mode; |
| … |
… |
|
| 13 | 12 | import org.openstreetmap.josm.gui.MainApplication; |
| 14 | 13 | import org.openstreetmap.josm.gui.MapFrame; |
| 15 | 14 | import org.openstreetmap.josm.gui.layer.OsmDataLayer; |
| 16 | | import org.openstreetmap.josm.testutils.JOSMTestRules; |
| 17 | | |
| 18 | | import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; |
| | 15 | import org.openstreetmap.josm.testutils.annotations.Main; |
| | 16 | import org.openstreetmap.josm.testutils.annotations.Projection; |
| 19 | 17 | |
| 20 | 18 | /** |
| 21 | 19 | * Unit tests for class {@link ParallelWayAction}. |
| 22 | 20 | */ |
| | 21 | @Main |
| | 22 | @Projection |
| 23 | 23 | class ParallelWayActionTest { |
| 24 | | |
| 25 | | /** |
| 26 | | * Setup test. |
| 27 | | */ |
| 28 | | @RegisterExtension |
| 29 | | @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") |
| 30 | | public JOSMTestRules test = new JOSMTestRules().main().projection(); |
| 31 | | |
| 32 | 24 | /** |
| 33 | 25 | * Unit test of {@link ParallelWayAction#enterMode} and {@link ParallelWayAction#exitMode}. |
| 34 | 26 | */ |
-
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
diff --git a/test/unit/org/openstreetmap/josm/actions/mapmode/PlayHeadDragModeTest.java b/test/unit/org/openstreetmap/josm/actions/mapmode/PlayHeadDragModeTest.java
|
a
|
b
|
|
| 4 | 4 | import static org.junit.jupiter.api.Assertions.assertEquals; |
| 5 | 5 | import static org.junit.jupiter.api.Assertions.assertTrue; |
| 6 | 6 | |
| 7 | | import org.junit.jupiter.api.extension.RegisterExtension; |
| 8 | 7 | import org.junit.jupiter.api.Test; |
| 9 | 8 | import org.openstreetmap.josm.data.osm.DataSet; |
| 10 | 9 | import org.openstreetmap.josm.gui.MainApplication; |
| 11 | 10 | import org.openstreetmap.josm.gui.MapFrame; |
| 12 | 11 | import org.openstreetmap.josm.gui.layer.OsmDataLayer; |
| 13 | 12 | import org.openstreetmap.josm.gui.layer.markerlayer.PlayHeadMarker; |
| 14 | | import org.openstreetmap.josm.testutils.JOSMTestRules; |
| 15 | | |
| 16 | | import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; |
| | 13 | import org.openstreetmap.josm.testutils.annotations.Main; |
| | 14 | import org.openstreetmap.josm.testutils.annotations.Projection; |
| 17 | 15 | |
| 18 | 16 | /** |
| 19 | 17 | * Unit tests for class {@link PlayHeadDragMode}. |
| 20 | 18 | */ |
| | 19 | @Main |
| | 20 | @Projection |
| 21 | 21 | class PlayHeadDragModeTest { |
| 22 | | |
| 23 | | /** |
| 24 | | * Setup test. |
| 25 | | */ |
| 26 | | @RegisterExtension |
| 27 | | @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") |
| 28 | | public JOSMTestRules test = new JOSMTestRules().main().projection(); |
| 29 | | |
| 30 | 22 | /** |
| 31 | 23 | * Unit test of {@link PlayHeadDragMode#enterMode} and {@link PlayHeadDragMode#exitMode}. |
| 32 | 24 | */ |
-
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
diff --git a/test/unit/org/openstreetmap/josm/actions/mapmode/SelectActionTest.java b/test/unit/org/openstreetmap/josm/actions/mapmode/SelectActionTest.java
|
a
|
b
|
|
| 12 | 12 | import java.util.Collection; |
| 13 | 13 | |
| 14 | 14 | import org.junit.jupiter.api.Test; |
| 15 | | import org.junit.jupiter.api.extension.RegisterExtension; |
| 16 | 15 | import org.openstreetmap.josm.TestUtils; |
| 17 | 16 | import org.openstreetmap.josm.actions.mapmode.SelectAction.Mode; |
| 18 | 17 | import org.openstreetmap.josm.actions.mapmode.SelectAction.SelectActionCursor; |
| … |
… |
|
| 25 | 24 | import org.openstreetmap.josm.gui.layer.MainLayerManager; |
| 26 | 25 | import org.openstreetmap.josm.gui.layer.OsmDataLayer; |
| 27 | 26 | import org.openstreetmap.josm.spi.preferences.Config; |
| 28 | | import org.openstreetmap.josm.testutils.JOSMTestRules; |
| | 27 | import org.openstreetmap.josm.testutils.annotations.Main; |
| | 28 | import org.openstreetmap.josm.testutils.annotations.Projection; |
| 29 | 29 | import org.openstreetmap.josm.tools.PlatformManager; |
| 30 | 30 | import org.openstreetmap.josm.tools.ReflectionUtils; |
| 31 | 31 | |
| … |
… |
|
| 34 | 34 | /** |
| 35 | 35 | * Unit tests for class {@link SelectAction}. |
| 36 | 36 | */ |
| | 37 | @Main |
| | 38 | @Projection |
| 37 | 39 | class SelectActionTest { |
| 38 | 40 | |
| 39 | 41 | boolean nodesMerged; |
| … |
… |
|
| 54 | 56 | } |
| 55 | 57 | } |
| 56 | 58 | |
| 57 | | /** |
| 58 | | * Setup test. |
| 59 | | */ |
| 60 | | @RegisterExtension |
| 61 | | @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") |
| 62 | | public JOSMTestRules test = new JOSMTestRules().projection().main(); |
| 63 | | |
| 64 | 59 | /** |
| 65 | 60 | * Test case: Move a two nodes way near a third node. |
| 66 | 61 | * Resulting way should be attach to the third node. |
-
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
diff --git a/test/unit/org/openstreetmap/josm/actions/upload/FixDataHookTest.java b/test/unit/org/openstreetmap/josm/actions/upload/FixDataHookTest.java
|
a
|
b
|
|
| 11 | 11 | import java.util.Collection; |
| 12 | 12 | |
| 13 | 13 | import org.junit.jupiter.api.Test; |
| 14 | | import org.junit.jupiter.api.extension.RegisterExtension; |
| 15 | 14 | import org.openstreetmap.josm.command.PseudoCommand; |
| 16 | 15 | import org.openstreetmap.josm.command.SequenceCommand; |
| 17 | 16 | import org.openstreetmap.josm.data.APIDataSet; |
| … |
… |
|
| 20 | 19 | import org.openstreetmap.josm.data.osm.OsmPrimitive; |
| 21 | 20 | import org.openstreetmap.josm.data.osm.Relation; |
| 22 | 21 | import org.openstreetmap.josm.data.osm.Way; |
| 23 | | import org.openstreetmap.josm.testutils.JOSMTestRules; |
| 24 | | |
| 25 | | import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; |
| | 22 | import org.openstreetmap.josm.testutils.annotations.Main; |
| 26 | 23 | |
| 27 | 24 | /** |
| 28 | 25 | * Unit tests for class {@link FixDataHook}. |
| 29 | 26 | */ |
| | 27 | @Main |
| 30 | 28 | class FixDataHookTest { |
| 31 | | |
| 32 | | /** |
| 33 | | * Setup test. |
| 34 | | */ |
| 35 | | @RegisterExtension |
| 36 | | @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") |
| 37 | | public JOSMTestRules test = new JOSMTestRules().main(); |
| 38 | | |
| 39 | 29 | /** |
| 40 | 30 | * Test of {@link FixDataHook#checkUpload} method. |
| 41 | 31 | */ |
-
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
diff --git a/test/unit/org/openstreetmap/josm/actions/upload/UploadNotesTaskTest.java b/test/unit/org/openstreetmap/josm/actions/upload/UploadNotesTaskTest.java
|
a
|
b
|
|
| 14 | 14 | import java.util.stream.Collectors; |
| 15 | 15 | import java.util.stream.Stream; |
| 16 | 16 | |
| 17 | | import org.junit.jupiter.api.extension.RegisterExtension; |
| 18 | 17 | import org.junit.jupiter.params.ParameterizedTest; |
| 19 | 18 | import org.junit.jupiter.params.provider.Arguments; |
| 20 | 19 | import org.junit.jupiter.params.provider.MethodSource; |
| … |
… |
|
| 30 | 29 | import org.openstreetmap.josm.gui.util.GuiHelper; |
| 31 | 30 | import org.openstreetmap.josm.io.OsmTransferException; |
| 32 | 31 | import org.openstreetmap.josm.testutils.FakeOsmApi; |
| 33 | | import org.openstreetmap.josm.testutils.JOSMTestRules; |
| 34 | 32 | import org.openstreetmap.josm.testutils.annotations.BasicPreferences; |
| | 33 | import org.openstreetmap.josm.testutils.annotations.OsmApi; |
| 35 | 34 | import org.openstreetmap.josm.tools.Logging; |
| 36 | 35 | |
| 37 | 36 | import mockit.Mock; |
| … |
… |
|
| 42 | 41 | * @author Taylor Smock |
| 43 | 42 | */ |
| 44 | 43 | @BasicPreferences |
| | 44 | @OsmApi(OsmApi.APIType.FAKE) |
| 45 | 45 | class UploadNotesTaskTest { |
| 46 | | @RegisterExtension |
| 47 | | static JOSMTestRules josmTestRules = new JOSMTestRules().fakeAPI(); |
| 48 | | |
| 49 | 46 | static Stream<Arguments> testUpload() { |
| 50 | 47 | final NoteData commonData = new NoteData(); |
| 51 | 48 | for (int i = 0; i < 12; i++) { |
-
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
diff --git a/test/unit/org/openstreetmap/josm/actions/upload/ValidateUploadHookTest.java b/test/unit/org/openstreetmap/josm/actions/upload/ValidateUploadHookTest.java
|
a
|
b
|
|
| 7 | 7 | import java.util.Collections; |
| 8 | 8 | import java.util.stream.Stream; |
| 9 | 9 | |
| 10 | | import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; |
| 11 | | import mockit.Mock; |
| 12 | 10 | import org.junit.jupiter.api.Test; |
| 13 | | import org.junit.jupiter.api.extension.RegisterExtension; |
| | 11 | import org.junit.jupiter.api.Timeout; |
| 14 | 12 | import org.junit.jupiter.params.ParameterizedTest; |
| 15 | 13 | import org.junit.jupiter.params.provider.Arguments; |
| 16 | 14 | import org.junit.jupiter.params.provider.MethodSource; |
| … |
… |
|
| 26 | 24 | import org.openstreetmap.josm.gui.ExtendedDialog; |
| 27 | 25 | import org.openstreetmap.josm.gui.MainApplication; |
| 28 | 26 | import org.openstreetmap.josm.gui.layer.OsmDataLayer; |
| 29 | | import org.openstreetmap.josm.testutils.JOSMTestRules; |
| | 27 | import org.openstreetmap.josm.testutils.annotations.Main; |
| | 28 | import org.openstreetmap.josm.testutils.annotations.OsmApi; |
| | 29 | import org.openstreetmap.josm.testutils.annotations.Projection; |
| 30 | 30 | import org.openstreetmap.josm.testutils.mockers.ExtendedDialogMocker; |
| 31 | 31 | |
| | 32 | import mockit.Mock; |
| | 33 | |
| 32 | 34 | /** |
| 33 | 35 | * Unit tests for class {@link ValidateUploadHook}. |
| 34 | 36 | */ |
| | 37 | @Main |
| | 38 | @OsmApi(OsmApi.APIType.FAKE) |
| | 39 | @Projection |
| | 40 | @Timeout(30) |
| 35 | 41 | class ValidateUploadHookTest { |
| 36 | | |
| 37 | | /** |
| 38 | | * Setup test. |
| 39 | | */ |
| 40 | | @RegisterExtension |
| 41 | | @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") |
| 42 | | public JOSMTestRules test = new JOSMTestRules().main().projection().fakeAPI().timeout(30000); |
| 43 | | |
| 44 | 42 | /** |
| 45 | 43 | * Test of {@link ValidateUploadHook#checkUpload} method. |
| 46 | 44 | */ |
-
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
diff --git a/test/unit/org/openstreetmap/josm/actions/AboutActionTest.java b/test/unit/org/openstreetmap/josm/actions/AboutActionTest.java
|
a
|
b
|
|
| 1 | 1 | // License: GPL. For details, see LICENSE file. |
| 2 | 2 | package org.openstreetmap.josm.actions; |
| 3 | 3 | |
| 4 | | import static org.junit.jupiter.api.Assertions.assertNotNull; |
| | 4 | import static org.junit.jupiter.api.Assertions.assertDoesNotThrow; |
| 5 | 5 | |
| 6 | | import org.junit.jupiter.api.extension.RegisterExtension; |
| 7 | 6 | import org.junit.jupiter.api.Test; |
| 8 | | import org.openstreetmap.josm.testutils.JOSMTestRules; |
| | 7 | import org.openstreetmap.josm.testutils.annotations.Main; |
| 9 | 8 | |
| 10 | | import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; |
| 11 | 9 | |
| 12 | 10 | /** |
| 13 | 11 | * Unit tests for class {@link AboutAction}. |
| 14 | 12 | */ |
| | 13 | @Main |
| 15 | 14 | final class AboutActionTest { |
| 16 | | |
| 17 | | /** |
| 18 | | * Setup test. |
| 19 | | */ |
| 20 | | @RegisterExtension |
| 21 | | @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") |
| 22 | | public JOSMTestRules test = new JOSMTestRules().main(); |
| 23 | | |
| 24 | 15 | /** |
| 25 | 16 | * Unit test of {@link AboutAction#buildAboutPanel}. |
| 26 | 17 | */ |
| 27 | 18 | @Test |
| 28 | 19 | void testBuildAboutPanel() { |
| 29 | | assertNotNull(new AboutAction().buildAboutPanel()); |
| | 20 | assertDoesNotThrow(() -> new AboutAction().buildAboutPanel()); |
| 30 | 21 | } |
| 31 | 22 | } |
-
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
diff --git a/test/unit/org/openstreetmap/josm/actions/AddImageryLayerActionTest.java b/test/unit/org/openstreetmap/josm/actions/AddImageryLayerActionTest.java
|
a
|
b
|
|
| 10 | 10 | import java.util.List; |
| 11 | 11 | |
| 12 | 12 | import org.junit.jupiter.api.Test; |
| 13 | | import org.junit.jupiter.api.extension.RegisterExtension; |
| 14 | 13 | import org.openstreetmap.gui.jmapviewer.FeatureAdapter; |
| 15 | 14 | import org.openstreetmap.josm.data.imagery.ImageryInfo; |
| 16 | 15 | import org.openstreetmap.josm.gui.MainApplication; |
| 17 | 16 | import org.openstreetmap.josm.gui.layer.TMSLayer; |
| 18 | 17 | import org.openstreetmap.josm.gui.layer.WMSLayer; |
| 19 | | import org.openstreetmap.josm.testutils.JOSMTestRules; |
| 20 | 18 | import org.openstreetmap.josm.testutils.annotations.BasicPreferences; |
| 21 | 19 | import org.openstreetmap.josm.testutils.annotations.BasicWiremock; |
| | 20 | import org.openstreetmap.josm.testutils.annotations.OsmApi; |
| | 21 | import org.openstreetmap.josm.testutils.annotations.Projection; |
| 22 | 22 | |
| 23 | 23 | import com.github.tomakehurst.wiremock.WireMockServer; |
| 24 | 24 | |
| 25 | | import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; |
| 26 | | |
| 27 | 25 | /** |
| 28 | 26 | * Unit tests for class {@link AddImageryLayerAction}. |
| 29 | 27 | */ |
| 30 | | @BasicWiremock |
| 31 | 28 | @BasicPreferences |
| | 29 | @BasicWiremock |
| | 30 | @OsmApi(OsmApi.APIType.FAKE) |
| | 31 | @Projection |
| 32 | 32 | final class AddImageryLayerActionTest { |
| 33 | | /** |
| 34 | | * We need prefs for this. We need platform for actions and the OSM API for checking blacklist. |
| 35 | | */ |
| 36 | | @RegisterExtension |
| 37 | | @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") |
| 38 | | public JOSMTestRules test = new JOSMTestRules().fakeAPI().projection(); |
| 39 | | |
| 40 | 33 | /** |
| 41 | 34 | * HTTP mock. |
| 42 | 35 | */ |
-
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
diff --git a/test/unit/org/openstreetmap/josm/actions/AlignInCircleActionTest.java b/test/unit/org/openstreetmap/josm/actions/AlignInCircleActionTest.java
|
a
|
b
|
|
| 17 | 17 | import java.util.stream.Collectors; |
| 18 | 18 | |
| 19 | 19 | import org.junit.jupiter.api.Test; |
| 20 | | import org.junit.jupiter.api.extension.RegisterExtension; |
| 21 | 20 | import org.openstreetmap.josm.TestUtils; |
| 22 | 21 | import org.openstreetmap.josm.actions.AlignInCircleAction.InvalidSelection; |
| 23 | 22 | import org.openstreetmap.josm.command.Command; |
| … |
… |
|
| 29 | 28 | import org.openstreetmap.josm.gui.progress.NullProgressMonitor; |
| 30 | 29 | import org.openstreetmap.josm.io.IllegalDataException; |
| 31 | 30 | import org.openstreetmap.josm.io.OsmReader; |
| 32 | | import org.openstreetmap.josm.testutils.JOSMTestRules; |
| | 31 | import org.openstreetmap.josm.testutils.annotations.Projection; |
| 33 | 32 | import org.opentest4j.AssertionFailedError; |
| 34 | 33 | |
| 35 | | import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; |
| 36 | | |
| 37 | 34 | /** |
| 38 | 35 | * Unit tests for class {@link AlignInLineAction}. |
| 39 | 36 | */ |
| | 37 | @Projection |
| 40 | 38 | final class AlignInCircleActionTest { |
| 41 | | |
| 42 | | /** |
| 43 | | * Setup test. |
| 44 | | */ |
| 45 | | @RegisterExtension |
| 46 | | @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") |
| 47 | | public JOSMTestRules test = new JOSMTestRules().projection(); |
| 48 | | |
| 49 | | |
| 50 | 39 | /** |
| 51 | 40 | * Test case: way with several nodes selected |
| 52 | 41 | * @throws Exception if an error occurs |
| … |
… |
|
| 64 | 53 | } |
| 65 | 54 | } |
| 66 | 55 | assertNotNull(roundabout); |
| 67 | | if (roundabout != null) { |
| 68 | | ds.setSelected(roundabout); |
| 69 | | Command c = AlignInCircleAction.buildCommand(ds); |
| 70 | | c.executeCommand(); |
| 71 | | Way expected = (Way) ds2.getPrimitiveById(roundabout); |
| 72 | | assertNotNull(expected); |
| 73 | | assertEquals(expected, roundabout); |
| 74 | | assertEquals(expected.getNodesCount(), roundabout.getNodesCount()); |
| 75 | | for (Node n1 : roundabout.getNodes()) { |
| 76 | | Node n2 = (Node) ds2.getPrimitiveById(n1); |
| 77 | | assertEquals(n1.lat(), n2.lat(), 1e-5); |
| 78 | | assertEquals(n1.lon(), n2.lon(), 1e-5); |
| 79 | | } |
| | 56 | ds.setSelected(roundabout); |
| | 57 | Command c = AlignInCircleAction.buildCommand(ds); |
| | 58 | c.executeCommand(); |
| | 59 | Way expected = (Way) ds2.getPrimitiveById(roundabout); |
| | 60 | assertNotNull(expected); |
| | 61 | assertEquals(expected, roundabout); |
| | 62 | assertEquals(expected.getNodesCount(), roundabout.getNodesCount()); |
| | 63 | for (Node n1 : roundabout.getNodes()) { |
| | 64 | Node n2 = (Node) ds2.getPrimitiveById(n1); |
| | 65 | assertEquals(n1.lat(), n2.lat(), 1e-5); |
| | 66 | assertEquals(n1.lon(), n2.lon(), 1e-5); |
| 80 | 67 | } |
| 81 | 68 | } |
| 82 | 69 | |
| … |
… |
|
| 97 | 84 | } |
| 98 | 85 | } |
| 99 | 86 | assertNotNull(roundabout); |
| 100 | | if (roundabout != null) { |
| 101 | | ds.setSelected(roundabout); |
| 102 | | assertNull(AlignInCircleAction.buildCommand(ds)); |
| 103 | | } |
| | 87 | ds.setSelected(roundabout); |
| | 88 | assertNull(AlignInCircleAction.buildCommand(ds)); |
| 104 | 89 | } |
| 105 | 90 | |
| 106 | 91 | /** |
| … |
… |
|
| 120 | 105 | } |
| 121 | 106 | } |
| 122 | 107 | assertNotNull(circularWay); |
| 123 | | if (circularWay != null) { |
| 124 | | ds.setSelected(circularWay.getNodes()); |
| 125 | | Command c = AlignInCircleAction.buildCommand(ds); |
| 126 | | assertNotNull(c); |
| 127 | | c.executeCommand(); |
| 128 | | Way expected = (Way) ds2.getPrimitiveById(circularWay); |
| 129 | | assertNotNull(expected); |
| 130 | | assertEquals(expected, circularWay); |
| 131 | | assertEquals(expected.getNodesCount(), circularWay.getNodesCount()); |
| 132 | | for (Node n1 : circularWay.getNodes()) { |
| 133 | | Node n2 = (Node) ds2.getPrimitiveById(n1); |
| 134 | | assertEquals(n1.lat(), n2.lat(), 1e-5); |
| 135 | | assertEquals(n1.lon(), n2.lon(), 1e-5); |
| 136 | | } |
| | 108 | ds.setSelected(circularWay.getNodes()); |
| | 109 | Command c = AlignInCircleAction.buildCommand(ds); |
| | 110 | assertNotNull(c); |
| | 111 | c.executeCommand(); |
| | 112 | Way expected = (Way) ds2.getPrimitiveById(circularWay); |
| | 113 | assertNotNull(expected); |
| | 114 | assertEquals(expected, circularWay); |
| | 115 | assertEquals(expected.getNodesCount(), circularWay.getNodesCount()); |
| | 116 | for (Node n1 : circularWay.getNodes()) { |
| | 117 | Node n2 = (Node) ds2.getPrimitiveById(n1); |
| | 118 | assertEquals(n1.lat(), n2.lat(), 1e-5); |
| | 119 | assertEquals(n1.lon(), n2.lon(), 1e-5); |
| 137 | 120 | } |
| 138 | 121 | } |
| 139 | 122 | |
-
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
diff --git a/test/unit/org/openstreetmap/josm/actions/AlignInLineActionTest.java b/test/unit/org/openstreetmap/josm/actions/AlignInLineActionTest.java
|
a
|
b
|
|
| 1 | 1 | // License: GPL. For details, see LICENSE file. |
| 2 | 2 | package org.openstreetmap.josm.actions; |
| 3 | 3 | |
| | 4 | import static org.junit.jupiter.api.Assertions.assertDoesNotThrow; |
| 4 | 5 | import static org.junit.jupiter.api.Assertions.assertEquals; |
| 5 | | import static org.junit.jupiter.api.Assertions.assertNotNull; |
| 6 | 6 | import static org.junit.jupiter.api.Assertions.assertNull; |
| 7 | 7 | import static org.junit.jupiter.api.Assertions.assertThrows; |
| 8 | 8 | |
| 9 | 9 | import org.junit.jupiter.api.BeforeEach; |
| 10 | 10 | import org.junit.jupiter.api.Test; |
| 11 | | import org.junit.jupiter.api.extension.RegisterExtension; |
| 12 | 11 | import org.openstreetmap.josm.actions.AlignInLineAction.InvalidSelection; |
| 13 | 12 | import org.openstreetmap.josm.actions.AlignInLineAction.Line; |
| 14 | 13 | import org.openstreetmap.josm.data.coor.EastNorth; |
| … |
… |
|
| 17 | 16 | import org.openstreetmap.josm.data.osm.Node; |
| 18 | 17 | import org.openstreetmap.josm.data.osm.Way; |
| 19 | 18 | import org.openstreetmap.josm.gui.MainApplication; |
| 20 | | import org.openstreetmap.josm.testutils.JOSMTestRules; |
| 21 | | |
| 22 | | import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; |
| | 19 | import org.openstreetmap.josm.testutils.annotations.Main; |
| | 20 | import org.openstreetmap.josm.testutils.annotations.Projection; |
| 23 | 21 | |
| 24 | 22 | /** |
| 25 | 23 | * Unit tests for class {@link AlignInLineAction}. |
| 26 | 24 | */ |
| | 25 | @Main |
| | 26 | @Projection |
| 27 | 27 | final class AlignInLineActionTest { |
| 28 | | |
| 29 | | /** |
| 30 | | * Setup test. |
| 31 | | */ |
| 32 | | @RegisterExtension |
| 33 | | @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") |
| 34 | | public JOSMTestRules test = new JOSMTestRules().main().projection(); |
| 35 | | |
| 36 | 28 | /** Class under test. */ |
| 37 | 29 | private static AlignInLineAction action; |
| 38 | 30 | |
| … |
… |
|
| 49 | 41 | /** |
| 50 | 42 | * Test case: only nodes selected, part of an open way: align these nodes on the line passing through the extremity |
| 51 | 43 | * nodes (the most distant in the way sequence, not the most euclidean-distant). See |
| 52 | | * https://josm.openstreetmap.de/ticket/9605#comment:3. Note that in this test, after alignment, way is overlapping |
| 53 | | * itself. |
| | 44 | * <a href="https://josm.openstreetmap.de/ticket/9605#comment:3">comment:3:ticket:9605</a>. |
| | 45 | * Note that in this test, after alignment, way is overlapping itself. |
| 54 | 46 | * @throws InvalidSelection never |
| 55 | 47 | */ |
| 56 | 48 | @Test |
| … |
… |
|
| 210 | 202 | */ |
| 211 | 203 | @Test |
| 212 | 204 | void testLineDifferentCoordinates() throws InvalidSelection { |
| 213 | | assertNotNull(new Line(new Node(new EastNorth(0, 1)), |
| | 205 | assertDoesNotThrow(() -> new Line(new Node(new EastNorth(0, 1)), |
| 214 | 206 | new Node(new EastNorth(0, 2)))); |
| 215 | | assertNotNull(new Line(new Node(new EastNorth(0, 1)), |
| | 207 | assertDoesNotThrow(() -> new Line(new Node(new EastNorth(0, 1)), |
| 216 | 208 | new Node(new EastNorth(1, 1)))); |
| 217 | | assertNotNull(new Line(new Node(new EastNorth(0, 1)), |
| | 209 | assertDoesNotThrow(() -> new Line(new Node(new EastNorth(0, 1)), |
| 218 | 210 | new Node(new EastNorth(0+1e-150, 1+1e-150)))); |
| 219 | 211 | } |
| 220 | 212 | |
-
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
diff --git a/test/unit/org/openstreetmap/josm/actions/CombineWayActionTest.java b/test/unit/org/openstreetmap/josm/actions/CombineWayActionTest.java
|
a
|
b
|
|
| 22 | 22 | import org.openstreetmap.josm.data.osm.Way; |
| 23 | 23 | import org.openstreetmap.josm.io.IllegalDataException; |
| 24 | 24 | import org.openstreetmap.josm.io.OsmReader; |
| | 25 | import org.openstreetmap.josm.testutils.annotations.ResetUniquePrimitiveIdCounters; |
| 25 | 26 | |
| 26 | 27 | import nl.jqno.equalsverifier.EqualsVerifier; |
| 27 | 28 | |
| … |
… |
|
| 113 | 114 | * @throws IllegalDataException if OSM parsing fails |
| 114 | 115 | */ |
| 115 | 116 | @Test |
| | 117 | @ResetUniquePrimitiveIdCounters |
| 116 | 118 | void testTicket18367NeedsSplit() throws IOException, IllegalDataException { |
| 117 | 119 | try (InputStream is = TestUtils.getRegressionDataStream(18367, "split-and-reverse.osm")) { |
| 118 | 120 | DataSet ds = OsmReader.parseDataSet(is, null); |
-
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
diff --git a/test/unit/org/openstreetmap/josm/actions/CopyActionTest.java b/test/unit/org/openstreetmap/josm/actions/CopyActionTest.java
|
a
|
b
|
|
| 16 | 16 | import java.util.Arrays; |
| 17 | 17 | |
| 18 | 18 | import org.junit.jupiter.api.Test; |
| 19 | | import org.junit.jupiter.api.extension.RegisterExtension; |
| 20 | 19 | import org.openstreetmap.josm.data.coor.LatLon; |
| 21 | 20 | import org.openstreetmap.josm.data.osm.DataSet; |
| 22 | 21 | import org.openstreetmap.josm.data.osm.Node; |
| … |
… |
|
| 25 | 24 | import org.openstreetmap.josm.gui.datatransfer.ClipboardUtils; |
| 26 | 25 | import org.openstreetmap.josm.gui.datatransfer.data.PrimitiveTransferData; |
| 27 | 26 | import org.openstreetmap.josm.gui.layer.OsmDataLayer; |
| 28 | | import org.openstreetmap.josm.testutils.JOSMTestRules; |
| 29 | | |
| 30 | | import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; |
| | 27 | import org.openstreetmap.josm.testutils.annotations.BasicPreferences; |
| | 28 | import org.openstreetmap.josm.testutils.annotations.Main; |
| | 29 | import org.openstreetmap.josm.testutils.annotations.OsmApi; |
| | 30 | import org.openstreetmap.josm.testutils.annotations.Projection; |
| 31 | 31 | |
| 32 | 32 | /** |
| 33 | 33 | * Unit tests for class {@link CopyAction}. |
| 34 | 34 | */ |
| | 35 | @BasicPreferences |
| | 36 | @Main |
| | 37 | @OsmApi(OsmApi.APIType.FAKE) |
| | 38 | @Projection |
| 35 | 39 | class CopyActionTest { |
| 36 | 40 | private static final class CapturingCopyAction extends CopyAction { |
| 37 | 41 | private boolean warningShown; |
| … |
… |
|
| 42 | 46 | } |
| 43 | 47 | } |
| 44 | 48 | |
| 45 | | /** |
| 46 | | * We need prefs for this. |
| 47 | | */ |
| 48 | | @RegisterExtension |
| 49 | | @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") |
| 50 | | public static JOSMTestRules test = new JOSMTestRules().preferences().fakeAPI().main().projection(); |
| 51 | | |
| 52 | 49 | /** |
| 53 | 50 | * Test that copy action copies the selected primitive |
| 54 | 51 | * @throws IOException if an I/O error occurs |
-
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
diff --git a/test/unit/org/openstreetmap/josm/actions/CreateCircleActionTest.java b/test/unit/org/openstreetmap/josm/actions/CreateCircleActionTest.java
|
a
|
b
|
|
| 9 | 9 | import java.util.Collection; |
| 10 | 10 | |
| 11 | 11 | import org.junit.jupiter.api.Test; |
| 12 | | import org.junit.jupiter.api.extension.RegisterExtension; |
| 13 | 12 | import org.openstreetmap.josm.data.coor.EastNorth; |
| 14 | 13 | import org.openstreetmap.josm.data.coor.LatLon; |
| 15 | 14 | import org.openstreetmap.josm.data.osm.BBox; |
| 16 | 15 | import org.openstreetmap.josm.data.osm.DataSet; |
| 17 | 16 | import org.openstreetmap.josm.data.osm.Node; |
| 18 | 17 | import org.openstreetmap.josm.data.osm.Way; |
| 19 | | import org.openstreetmap.josm.testutils.JOSMTestRules; |
| | 18 | import org.openstreetmap.josm.testutils.annotations.Projection; |
| 20 | 19 | import org.openstreetmap.josm.tools.GeoProperty; |
| 21 | 20 | import org.openstreetmap.josm.tools.GeoPropertyIndex; |
| 22 | 21 | import org.openstreetmap.josm.tools.Geometry; |
| 23 | 22 | import org.openstreetmap.josm.tools.ReflectionUtils; |
| 24 | 23 | import org.openstreetmap.josm.tools.RightAndLefthandTraffic; |
| 25 | 24 | |
| 26 | | import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; |
| 27 | | |
| 28 | 25 | /** |
| 29 | 26 | * Unit tests for class {@link CreateCircleAction}. |
| 30 | 27 | */ |
| | 28 | @Projection |
| 31 | 29 | final class CreateCircleActionTest { |
| 32 | | |
| 33 | | /** |
| 34 | | * Setup test. |
| 35 | | */ |
| 36 | | @RegisterExtension |
| 37 | | @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") |
| 38 | | public JOSMTestRules test = new JOSMTestRules().projection(); |
| 39 | | |
| 40 | 30 | /** |
| 41 | 31 | * Test case: When Create Circle action is performed with a single way selected, |
| 42 | 32 | * circle direction must equals way direction. |
| 43 | 33 | * see #7421 |
| 44 | | * @throws ReflectiveOperationException if an error occurs |
| 45 | 34 | */ |
| 46 | 35 | @Test |
| 47 | | void testTicket7421case0() throws ReflectiveOperationException { |
| | 36 | void testTicket7421case0() { |
| 48 | 37 | DataSet dataSet = new DataSet(); |
| 49 | 38 | |
| 50 | 39 | Node n1 = new Node(new EastNorth(0, 0)); |
-
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
diff --git a/test/unit/org/openstreetmap/josm/actions/CreateMultipolygonActionTest.java b/test/unit/org/openstreetmap/josm/actions/CreateMultipolygonActionTest.java
|
a
|
b
|
|
| 14 | 14 | import java.util.TreeMap; |
| 15 | 15 | |
| 16 | 16 | import org.junit.jupiter.api.Test; |
| 17 | | import org.junit.jupiter.api.extension.RegisterExtension; |
| 18 | 17 | import org.openstreetmap.josm.TestUtils; |
| 19 | 18 | import org.openstreetmap.josm.command.SequenceCommand; |
| 20 | 19 | import org.openstreetmap.josm.data.osm.DataSet; |
| … |
… |
|
| 29 | 28 | import org.openstreetmap.josm.gui.layer.Layer; |
| 30 | 29 | import org.openstreetmap.josm.gui.layer.OsmDataLayer; |
| 31 | 30 | import org.openstreetmap.josm.io.OsmReader; |
| 32 | | import org.openstreetmap.josm.testutils.JOSMTestRules; |
| | 31 | import org.openstreetmap.josm.testutils.annotations.BasicPreferences; |
| | 32 | import org.openstreetmap.josm.testutils.annotations.Main; |
| | 33 | import org.openstreetmap.josm.testutils.annotations.MapPaintStyles; |
| | 34 | import org.openstreetmap.josm.testutils.annotations.Projection; |
| 33 | 35 | import org.openstreetmap.josm.tools.Pair; |
| 34 | 36 | import org.openstreetmap.josm.tools.SubclassFilteredCollection; |
| 35 | 37 | |
| 36 | | import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; |
| 37 | | |
| 38 | 38 | /** |
| 39 | 39 | * Unit test of {@link CreateMultipolygonAction} |
| 40 | 40 | */ |
| | 41 | @BasicPreferences |
| | 42 | @Main |
| | 43 | @MapPaintStyles |
| | 44 | @Projection |
| 41 | 45 | class CreateMultipolygonActionTest { |
| 42 | | |
| 43 | | /** |
| 44 | | * Setup test. |
| 45 | | */ |
| 46 | | @RegisterExtension |
| 47 | | @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") |
| 48 | | public JOSMTestRules test = new JOSMTestRules().projection().main().preferences().mapStyles(); |
| 49 | | |
| 50 | 46 | private static Map<String, String> getRefToRoleMap(Relation relation) { |
| 51 | 47 | Map<String, String> refToRole = new TreeMap<>(); |
| 52 | 48 | String ref = relation.get("ref"); |
-
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
diff --git a/test/unit/org/openstreetmap/josm/actions/ExitActionTest.java b/test/unit/org/openstreetmap/josm/actions/ExitActionTest.java
|
a
|
b
|
|
| 8 | 8 | |
| 9 | 9 | import org.junit.jupiter.api.BeforeAll; |
| 10 | 10 | import org.junit.jupiter.api.Test; |
| 11 | | import org.junit.jupiter.api.extension.RegisterExtension; |
| 12 | 11 | import org.openstreetmap.josm.TestUtils; |
| 13 | 12 | import org.openstreetmap.josm.data.cache.JCSCacheManager; |
| 14 | 13 | import org.openstreetmap.josm.gui.MainApplication; |
| 15 | 14 | import org.openstreetmap.josm.gui.io.SaveLayersDialog; |
| 16 | 15 | import org.openstreetmap.josm.gui.progress.swing.ProgressMonitorExecutor; |
| 17 | | import org.openstreetmap.josm.testutils.JOSMTestRules; |
| | 16 | import org.openstreetmap.josm.testutils.annotations.Main; |
| 18 | 17 | import org.openstreetmap.josm.tools.ImageProvider; |
| 19 | 18 | import org.openstreetmap.josm.tools.Utils; |
| 20 | 19 | |
| 21 | 20 | import com.ginsberg.junit.exit.ExpectSystemExitWithStatus; |
| 22 | | |
| 23 | | import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; |
| 24 | 21 | import mockit.Invocation; |
| 25 | 22 | import mockit.Mock; |
| 26 | 23 | import mockit.MockUp; |
| … |
… |
|
| 28 | 25 | /** |
| 29 | 26 | * Unit tests for class {@link ExitAction}. |
| 30 | 27 | */ |
| | 28 | @Main |
| 31 | 29 | final class ExitActionTest { |
| 32 | | |
| 33 | | /** |
| 34 | | * Setup test. |
| 35 | | */ |
| 36 | | @RegisterExtension |
| 37 | | @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") |
| 38 | | public JOSMTestRules test = new JOSMTestRules().main(); |
| 39 | | |
| 40 | 30 | @BeforeAll |
| 41 | 31 | static void beforeAll() { |
| 42 | 32 | assumeTrue(Utils.getJavaVersion() < 18 || "allow".equals(System.getProperty("java.security.manager"))); |
-
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
diff --git a/test/unit/org/openstreetmap/josm/actions/FullscreenToggleActionTest.java b/test/unit/org/openstreetmap/josm/actions/FullscreenToggleActionTest.java
|
a
|
b
|
|
| 1 | 1 | // License: GPL. For details, see LICENSE file. |
| 2 | 2 | package org.openstreetmap.josm.actions; |
| 3 | 3 | |
| 4 | | import org.junit.jupiter.api.extension.RegisterExtension; |
| 5 | 4 | import org.junit.jupiter.api.Test; |
| 6 | | import org.openstreetmap.josm.testutils.JOSMTestRules; |
| 7 | | |
| 8 | | import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; |
| | 5 | import org.openstreetmap.josm.testutils.annotations.Main; |
| 9 | 6 | |
| 10 | 7 | /** |
| 11 | 8 | * Test {@link FullscreenToggleAction} |
| 12 | 9 | */ |
| | 10 | @Main |
| 13 | 11 | class FullscreenToggleActionTest { |
| 14 | | /** |
| 15 | | * Setup test. |
| 16 | | */ |
| 17 | | @RegisterExtension |
| 18 | | @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") |
| 19 | | public JOSMTestRules test = new JOSMTestRules().main(); |
| 20 | | |
| 21 | 12 | /** |
| 22 | 13 | * Test {@link FullscreenToggleAction} |
| 23 | 14 | */ |
-
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
diff --git a/test/unit/org/openstreetmap/josm/actions/JoinAreasActionTest.java b/test/unit/org/openstreetmap/josm/actions/JoinAreasActionTest.java
|
a
|
b
|
|
| 16 | 16 | import java.util.Set; |
| 17 | 17 | |
| 18 | 18 | import org.junit.jupiter.api.Test; |
| 19 | | import org.junit.jupiter.api.extension.RegisterExtension; |
| 20 | 19 | import org.openstreetmap.josm.TestUtils; |
| 21 | 20 | import org.openstreetmap.josm.actions.search.SearchAction; |
| 22 | 21 | import org.openstreetmap.josm.data.Bounds; |
| … |
… |
|
| 35 | 34 | import org.openstreetmap.josm.gui.progress.NullProgressMonitor; |
| 36 | 35 | import org.openstreetmap.josm.io.IllegalDataException; |
| 37 | 36 | import org.openstreetmap.josm.io.OsmReader; |
| 38 | | import org.openstreetmap.josm.testutils.JOSMTestRules; |
| | 37 | import org.openstreetmap.josm.testutils.annotations.BasicPreferences; |
| | 38 | import org.openstreetmap.josm.testutils.annotations.Main; |
| | 39 | import org.openstreetmap.josm.testutils.annotations.Projection; |
| 39 | 40 | import org.openstreetmap.josm.tools.MultiMap; |
| 40 | 41 | import org.openstreetmap.josm.tools.Utils; |
| 41 | 42 | |
| 42 | | import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; |
| 43 | | |
| 44 | 43 | /** |
| 45 | 44 | * Unit tests of {@link JoinAreasAction} class. |
| 46 | 45 | */ |
| | 46 | @BasicPreferences |
| | 47 | @Main |
| | 48 | @Projection |
| 47 | 49 | class JoinAreasActionTest { |
| 48 | | |
| 49 | | /** |
| 50 | | * Setup test. |
| 51 | | */ |
| 52 | | @RegisterExtension |
| 53 | | @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") |
| 54 | | public JOSMTestRules test = new JOSMTestRules().main().projection().preferences(); |
| 55 | | |
| 56 | 50 | /** |
| 57 | 51 | * Non-regression test for bug #9599. |
| 58 | 52 | * @throws IOException if any I/O error occurs |
-
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
diff --git a/test/unit/org/openstreetmap/josm/actions/JoinNodeWayActionTest.java b/test/unit/org/openstreetmap/josm/actions/JoinNodeWayActionTest.java
|
a
|
b
|
|
| 12 | 12 | import java.util.stream.Collectors; |
| 13 | 13 | |
| 14 | 14 | import org.junit.jupiter.api.Test; |
| 15 | | import org.junit.jupiter.api.extension.RegisterExtension; |
| 16 | 15 | import org.openstreetmap.josm.TestUtils; |
| 17 | 16 | import org.openstreetmap.josm.data.coor.EastNorth; |
| 18 | 17 | import org.openstreetmap.josm.data.coor.LatLon; |
| … |
… |
|
| 26 | 25 | import org.openstreetmap.josm.gui.layer.Layer; |
| 27 | 26 | import org.openstreetmap.josm.gui.layer.OsmDataLayer; |
| 28 | 27 | import org.openstreetmap.josm.io.OsmReader; |
| 29 | | import org.openstreetmap.josm.testutils.JOSMTestRules; |
| | 28 | import org.openstreetmap.josm.testutils.annotations.BasicPreferences; |
| | 29 | import org.openstreetmap.josm.testutils.annotations.Main; |
| | 30 | import org.openstreetmap.josm.testutils.annotations.Projection; |
| 30 | 31 | import org.openstreetmap.josm.tools.Geometry; |
| 31 | 32 | |
| 32 | | import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; |
| 33 | | |
| 34 | 33 | /** |
| 35 | 34 | * Unit tests for class {@link JoinNodeWayAction}. |
| 36 | 35 | */ |
| | 36 | @BasicPreferences |
| | 37 | @Main |
| | 38 | @Projection |
| 37 | 39 | final class JoinNodeWayActionTest { |
| 38 | | /** |
| 39 | | * Setup test. |
| 40 | | */ |
| 41 | | @RegisterExtension |
| 42 | | @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") |
| 43 | | public JOSMTestRules test = new JOSMTestRules().projection().main().preferences(); |
| 44 | | |
| 45 | 40 | private void setupMapView(DataSet ds) { |
| 46 | 41 | // setup a reasonable size for the edit window |
| 47 | 42 | MainApplication.getMap().mapView.setBounds(new Rectangle(1345, 939)); |
| … |
… |
|
| 59 | 54 | /** |
| 60 | 55 | * Test case: Move node onto two almost overlapping ways |
| 61 | 56 | * see #18189 moveontoway.osm |
| 62 | | * @throws Exception if an error occurs |
| 63 | 57 | */ |
| 64 | 58 | @Test |
| 65 | | void testTicket18189() throws Exception { |
| | 59 | void testTicket18189() { |
| 66 | 60 | DataSet dataSet = new DataSet(); |
| 67 | 61 | OsmDataLayer layer = new OsmDataLayer(dataSet, OsmDataLayer.createNewName(), null); |
| 68 | 62 | MainApplication.getLayerManager().addLayer(layer); |
-
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
diff --git a/test/unit/org/openstreetmap/josm/actions/MergeLayerActionTest.java b/test/unit/org/openstreetmap/josm/actions/MergeLayerActionTest.java
|
a
|
b
|
|
| 11 | 11 | |
| 12 | 12 | import org.junit.jupiter.api.BeforeEach; |
| 13 | 13 | import org.junit.jupiter.api.Test; |
| 14 | | import org.junit.jupiter.api.extension.RegisterExtension; |
| 15 | 14 | import org.openstreetmap.josm.TestUtils; |
| 16 | 15 | import org.openstreetmap.josm.data.osm.DataSet; |
| 17 | 16 | import org.openstreetmap.josm.gui.ExtendedDialog; |
| … |
… |
|
| 19 | 18 | import org.openstreetmap.josm.gui.layer.LayerManagerTest.TestLayer; |
| 20 | 19 | import org.openstreetmap.josm.gui.layer.OsmDataLayer; |
| 21 | 20 | import org.openstreetmap.josm.gui.widgets.JosmComboBox; |
| 22 | | import org.openstreetmap.josm.testutils.JOSMTestRules; |
| | 21 | import org.openstreetmap.josm.testutils.annotations.Main; |
| | 22 | import org.openstreetmap.josm.testutils.annotations.Projection; |
| 23 | 23 | import org.openstreetmap.josm.testutils.mockers.ExtendedDialogMocker; |
| 24 | 24 | import org.openstreetmap.josm.testutils.mockers.JOptionPaneSimpleMocker; |
| 25 | 25 | |
| 26 | | import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; |
| 27 | | |
| 28 | 26 | /** |
| 29 | 27 | * Unit tests for class {@link MergeLayerAction}. |
| 30 | 28 | */ |
| | 29 | @Main |
| | 30 | @Projection |
| 31 | 31 | public class MergeLayerActionTest { |
| 32 | | |
| 33 | | /** |
| 34 | | * Setup test. |
| 35 | | */ |
| 36 | | @RegisterExtension |
| 37 | | @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") |
| 38 | | public JOSMTestRules test = new JOSMTestRules().main().projection(); |
| 39 | | |
| 40 | 32 | /** |
| 41 | 33 | * MergeLayerExtendedDialog mocker. |
| 42 | 34 | */ |
-
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
diff --git a/test/unit/org/openstreetmap/josm/actions/MergeNodesActionTest.java b/test/unit/org/openstreetmap/josm/actions/MergeNodesActionTest.java
|
a
|
b
|
|
| 7 | 7 | |
| 8 | 8 | import java.util.Arrays; |
| 9 | 9 | import java.util.Collections; |
| | 10 | import java.util.List; |
| 10 | 11 | |
| 11 | 12 | import org.junit.jupiter.api.Test; |
| 12 | | import org.junit.jupiter.api.extension.RegisterExtension; |
| 13 | 13 | import org.openstreetmap.josm.data.coor.LatLon; |
| 14 | 14 | import org.openstreetmap.josm.data.osm.DataSet; |
| 15 | 15 | import org.openstreetmap.josm.data.osm.Node; |
| 16 | 16 | import org.openstreetmap.josm.spi.preferences.Config; |
| 17 | | import org.openstreetmap.josm.testutils.JOSMTestRules; |
| 18 | | |
| 19 | | import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; |
| | 17 | import org.openstreetmap.josm.testutils.annotations.Projection; |
| 20 | 18 | |
| 21 | 19 | /** |
| 22 | 20 | * Unit tests for class {@link MergeNodesAction}. |
| 23 | 21 | */ |
| | 22 | @Projection |
| 24 | 23 | class MergeNodesActionTest { |
| 25 | | |
| 26 | | /** |
| 27 | | * Setup test. |
| 28 | | */ |
| 29 | | @RegisterExtension |
| 30 | | @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") |
| 31 | | public JOSMTestRules test = new JOSMTestRules().projection(); |
| 32 | | |
| 33 | 24 | /** |
| 34 | 25 | * Unit test of {@link MergeNodesAction#selectTargetLocationNode} - empty list |
| 35 | 26 | */ |
| 36 | 27 | @Test |
| 37 | 28 | void testSelectTargetLocationNodeEmpty() { |
| 38 | | assertThrows(IllegalArgumentException.class, () -> MergeNodesAction.selectTargetLocationNode(Collections.emptyList())); |
| | 29 | final List<Node> noNodes = Collections.emptyList(); |
| | 30 | assertThrows(IllegalArgumentException.class, () -> MergeNodesAction.selectTargetLocationNode(noNodes)); |
| 39 | 31 | } |
| 40 | 32 | |
| 41 | 33 | /** |
| … |
… |
|
| 44 | 36 | @Test |
| 45 | 37 | void testSelectTargetLocationNodeInvalidMode() { |
| 46 | 38 | Config.getPref().putInt("merge-nodes.mode", -1); |
| 47 | | assertThrows(IllegalStateException.class, () -> MergeNodesAction.selectTargetLocationNode(Arrays.asList(new Node(0), new Node(1)))); |
| | 39 | final List<Node> nodes = Arrays.asList(new Node(0), new Node(1)); |
| | 40 | assertThrows(IllegalStateException.class, () -> MergeNodesAction.selectTargetLocationNode(nodes)); |
| 48 | 41 | } |
| 49 | 42 | |
| 50 | 43 | /** |
| … |
… |
|
| 61 | 54 | |
| 62 | 55 | Config.getPref().putInt("merge-nodes.mode", 2); |
| 63 | 56 | assertEquals(LatLon.NORTH_POLE, MergeNodesAction.selectTargetLocationNode( |
| 64 | | Arrays.asList(new Node(LatLon.NORTH_POLE))).getCoor()); |
| | 57 | Collections.singletonList(new Node(LatLon.NORTH_POLE))).getCoor()); |
| 65 | 58 | } |
| 66 | 59 | |
| 67 | 60 | /** |
| … |
… |
|
| 73 | 66 | DataSet ds = new DataSet(); |
| 74 | 67 | Node n1 = new Node(1); |
| 75 | 68 | ds.addPrimitive(n1); |
| 76 | | assertEquals(1, MergeNodesAction.selectTargetNode(Arrays.asList(n1)).getId()); |
| | 69 | assertEquals(1, MergeNodesAction.selectTargetNode(Collections.singletonList(n1)).getId()); |
| 77 | 70 | } |
| 78 | 71 | } |
-
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
diff --git a/test/unit/org/openstreetmap/josm/actions/OrthogonalizeActionTest.java b/test/unit/org/openstreetmap/josm/actions/OrthogonalizeActionTest.java
|
a
|
b
|
|
| 11 | 11 | import java.util.List; |
| 12 | 12 | |
| 13 | 13 | import org.junit.jupiter.api.Test; |
| 14 | | import org.junit.jupiter.api.extension.RegisterExtension; |
| 15 | 14 | import org.openstreetmap.josm.TestUtils; |
| 16 | 15 | import org.openstreetmap.josm.actions.OrthogonalizeAction.Direction; |
| 17 | 16 | import org.openstreetmap.josm.data.coor.LatLon; |
| … |
… |
|
| 22 | 21 | import org.openstreetmap.josm.gui.MainApplication; |
| 23 | 22 | import org.openstreetmap.josm.gui.layer.OsmDataLayer; |
| 24 | 23 | import org.openstreetmap.josm.io.OsmReader; |
| 25 | | import org.openstreetmap.josm.testutils.JOSMTestRules; |
| | 24 | import org.openstreetmap.josm.testutils.annotations.Projection; |
| 26 | 25 | import org.openstreetmap.josm.tools.Geometry; |
| 27 | 26 | import org.openstreetmap.josm.tools.SubclassFilteredCollection; |
| 28 | 27 | |
| 29 | | import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; |
| 30 | 28 | import net.trajano.commons.testing.UtilityClassTestUtil; |
| 31 | 29 | |
| 32 | 30 | /** |
| 33 | 31 | * Unit tests for class {@link OrthogonalizeAction}. |
| 34 | 32 | */ |
| | 33 | @Projection |
| 35 | 34 | class OrthogonalizeActionTest { |
| 36 | | |
| 37 | | /** |
| 38 | | * Setup test. |
| 39 | | */ |
| 40 | | @RegisterExtension |
| 41 | | @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") |
| 42 | | public JOSMTestRules test = new JOSMTestRules().projection(); |
| 43 | | |
| 44 | 35 | @Test |
| 45 | | void testNoSelection() throws Exception { |
| | 36 | void testNoSelection() { |
| 46 | 37 | assertThrows(OrthogonalizeAction.InvalidUserInputException.class, () -> performTest("nothing selected")); |
| 47 | 38 | } |
| 48 | 39 | |
-
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
diff --git a/test/unit/org/openstreetmap/josm/actions/PurgeActionTest.java b/test/unit/org/openstreetmap/josm/actions/PurgeActionTest.java
|
a
|
b
|
|
| 4 | 4 | import static org.junit.jupiter.api.Assertions.assertEquals; |
| 5 | 5 | import static org.junit.jupiter.api.Assertions.assertTrue; |
| 6 | 6 | |
| 7 | | import java.io.FileNotFoundException; |
| 8 | 7 | import java.io.IOException; |
| 9 | 8 | import java.io.InputStream; |
| 10 | 9 | |
| 11 | | import org.junit.jupiter.api.extension.RegisterExtension; |
| 12 | 10 | import org.junit.jupiter.api.Test; |
| 13 | 11 | import org.openstreetmap.josm.TestUtils; |
| 14 | 12 | import org.openstreetmap.josm.data.osm.DataSet; |
| … |
… |
|
| 17 | 15 | import org.openstreetmap.josm.gui.layer.OsmDataLayer; |
| 18 | 16 | import org.openstreetmap.josm.io.IllegalDataException; |
| 19 | 17 | import org.openstreetmap.josm.io.OsmReader; |
| 20 | | import org.openstreetmap.josm.testutils.JOSMTestRules; |
| 21 | | |
| 22 | | import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; |
| | 18 | import org.openstreetmap.josm.testutils.annotations.Main; |
| | 19 | import org.openstreetmap.josm.testutils.annotations.Projection; |
| 23 | 20 | |
| 24 | 21 | /** |
| 25 | 22 | * Unit tests for class {@link PurgeAction}. |
| 26 | 23 | */ |
| | 24 | @Main |
| | 25 | @Projection |
| 27 | 26 | class PurgeActionTest { |
| 28 | | |
| 29 | | /** |
| 30 | | * Setup test. |
| 31 | | */ |
| 32 | | @RegisterExtension |
| 33 | | @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") |
| 34 | | public static JOSMTestRules test = new JOSMTestRules().main().projection(); |
| 35 | | |
| 36 | 27 | /** |
| 37 | 28 | * Non-regression test for ticket #12038. |
| 38 | 29 | * @throws IOException if any I/O error occurs |
| 39 | | * @throws FileNotFoundException if the data file cannot be found |
| 40 | 30 | * @throws IllegalDataException if OSM parsing fails |
| 41 | 31 | */ |
| 42 | 32 | @Test |
| 43 | | void testCopyStringWayRelation() throws FileNotFoundException, IOException, IllegalDataException { |
| | 33 | void testCopyStringWayRelation() throws IOException, IllegalDataException { |
| 44 | 34 | try (InputStream is = TestUtils.getRegressionDataStream(12038, "data.osm")) { |
| 45 | 35 | DataSet ds = OsmReader.parseDataSet(is, null); |
| 46 | 36 | OsmDataLayer layer = new OsmDataLayer(ds, null, null); |
-
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
diff --git a/test/unit/org/openstreetmap/josm/actions/RestorePropertyActionTest.java b/test/unit/org/openstreetmap/josm/actions/RestorePropertyActionTest.java
|
a
|
b
|
|
| 7 | 7 | import javax.swing.ListSelectionModel; |
| 8 | 8 | |
| 9 | 9 | import org.junit.jupiter.api.Test; |
| 10 | | import org.junit.jupiter.api.extension.RegisterExtension; |
| 11 | 10 | import org.openstreetmap.josm.command.ChangePropertyCommand; |
| 12 | 11 | import org.openstreetmap.josm.data.UndoRedoHandler; |
| 13 | 12 | import org.openstreetmap.josm.data.coor.LatLon; |
| 14 | 13 | import org.openstreetmap.josm.data.osm.DataSet; |
| 15 | 14 | import org.openstreetmap.josm.data.osm.Node; |
| 16 | | import org.openstreetmap.josm.testutils.JOSMTestRules; |
| 17 | | |
| 18 | | import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; |
| | 15 | import org.openstreetmap.josm.testutils.annotations.BasicPreferences; |
| 19 | 16 | |
| 20 | 17 | /** |
| 21 | 18 | * Unit tests of {@link RestorePropertyAction} |
| 22 | 19 | */ |
| | 20 | @BasicPreferences |
| 23 | 21 | class RestorePropertyActionTest { |
| 24 | | |
| 25 | | /** |
| 26 | | * Setup test. |
| 27 | | */ |
| 28 | | @RegisterExtension |
| 29 | | @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") |
| 30 | | public JOSMTestRules test = new JOSMTestRules().preferences(); |
| 31 | | |
| 32 | 22 | @Test |
| 33 | 23 | void testTicket20965() { |
| 34 | 24 | doTest20965(null, null); |
-
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
diff --git a/test/unit/org/openstreetmap/josm/actions/SelectAllActionTest.java b/test/unit/org/openstreetmap/josm/actions/SelectAllActionTest.java
|
a
|
b
|
|
| 3 | 3 | |
| 4 | 4 | import static org.junit.jupiter.api.Assertions.assertEquals; |
| 5 | 5 | |
| 6 | | import org.junit.jupiter.api.extension.RegisterExtension; |
| 7 | 6 | import org.junit.jupiter.api.Test; |
| 8 | 7 | import org.openstreetmap.josm.data.osm.DataSet; |
| 9 | 8 | import org.openstreetmap.josm.gui.MainApplication; |
| 10 | | import org.openstreetmap.josm.testutils.JOSMTestRules; |
| 11 | | |
| 12 | | import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; |
| | 9 | import org.openstreetmap.josm.testutils.annotations.BasicPreferences; |
| | 10 | import org.openstreetmap.josm.testutils.annotations.Main; |
| | 11 | import org.openstreetmap.josm.testutils.annotations.Projection; |
| 13 | 12 | |
| 14 | 13 | /** |
| 15 | 14 | * Unit tests for class {@link SelectAllAction}. |
| 16 | 15 | */ |
| | 16 | @BasicPreferences |
| | 17 | @Main |
| | 18 | @Projection |
| 17 | 19 | final class SelectAllActionTest { |
| 18 | | |
| 19 | | /** |
| 20 | | * Setup test. |
| 21 | | */ |
| 22 | | @RegisterExtension |
| 23 | | @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") |
| 24 | | public JOSMTestRules rules = new JOSMTestRules().preferences().projection().main(); |
| 25 | | |
| 26 | 20 | /** |
| 27 | 21 | * Unit test of {@link SelectAllAction#actionPerformed} method. |
| 28 | 22 | */ |
-
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
diff --git a/test/unit/org/openstreetmap/josm/actions/SelectByInternalPointActionTest.java b/test/unit/org/openstreetmap/josm/actions/SelectByInternalPointActionTest.java
|
a
|
b
|
|
| 6 | 6 | import static org.junit.jupiter.api.Assertions.assertNull; |
| 7 | 7 | import static org.junit.jupiter.api.Assertions.assertTrue; |
| 8 | 8 | |
| 9 | | import org.junit.jupiter.api.extension.RegisterExtension; |
| 10 | 9 | import org.junit.jupiter.api.Test; |
| 11 | 10 | import org.openstreetmap.josm.data.coor.EastNorth; |
| 12 | 11 | import org.openstreetmap.josm.data.osm.DataSet; |
| … |
… |
|
| 17 | 16 | import org.openstreetmap.josm.gui.MainApplication; |
| 18 | 17 | import org.openstreetmap.josm.gui.layer.Layer; |
| 19 | 18 | import org.openstreetmap.josm.gui.layer.OsmDataLayer; |
| 20 | | import org.openstreetmap.josm.testutils.JOSMTestRules; |
| | 19 | import org.openstreetmap.josm.testutils.annotations.BasicPreferences; |
| | 20 | import org.openstreetmap.josm.testutils.annotations.Main; |
| | 21 | import org.openstreetmap.josm.testutils.annotations.Projection; |
| 21 | 22 | |
| 22 | | import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; |
| 23 | 23 | import net.trajano.commons.testing.UtilityClassTestUtil; |
| 24 | 24 | |
| 25 | 25 | /** |
| 26 | 26 | * Unit tests for class {@link SelectByInternalPointAction}. |
| 27 | 27 | */ |
| | 28 | @BasicPreferences |
| | 29 | @Main |
| | 30 | @Projection |
| 28 | 31 | final class SelectByInternalPointActionTest { |
| 29 | | |
| 30 | | /** |
| 31 | | * Setup test. |
| 32 | | */ |
| 33 | | @RegisterExtension |
| 34 | | @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") |
| 35 | | public JOSMTestRules rules = new JOSMTestRules().preferences().projection().main(); |
| 36 | | |
| 37 | 32 | /** |
| 38 | 33 | * Tests that {@code SelectByInternalPointAction} satisfies utility class criteria. |
| 39 | 34 | * @throws ReflectiveOperationException if an error occurs |
-
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
diff --git a/test/unit/org/openstreetmap/josm/actions/SessionSaveAsActionTest.java b/test/unit/org/openstreetmap/josm/actions/SessionSaveAsActionTest.java
|
a
|
b
|
|
| 4 | 4 | import static org.junit.jupiter.api.Assertions.assertFalse; |
| 5 | 5 | |
| 6 | 6 | import org.junit.jupiter.api.Test; |
| 7 | | import org.junit.jupiter.api.extension.RegisterExtension; |
| 8 | | import org.openstreetmap.josm.testutils.JOSMTestRules; |
| 9 | | |
| 10 | | import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; |
| | 7 | import org.openstreetmap.josm.testutils.annotations.Main; |
| 11 | 8 | |
| 12 | 9 | /** |
| 13 | 10 | * Unit tests for class {@link SessionSaveAsAction}. |
| 14 | 11 | */ |
| | 12 | @Main |
| 15 | 13 | class SessionSaveAsActionTest { |
| 16 | | |
| 17 | | /** |
| 18 | | * Setup test. |
| 19 | | */ |
| 20 | | @RegisterExtension |
| 21 | | @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") |
| 22 | | public JOSMTestRules test = new JOSMTestRules().main(); |
| 23 | | |
| 24 | 14 | /** |
| 25 | 15 | * Unit test of {@link SessionSaveAsAction#actionPerformed} |
| 26 | 16 | */ |
-
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
diff --git a/test/unit/org/openstreetmap/josm/actions/SimplifyWayActionTest.java b/test/unit/org/openstreetmap/josm/actions/SimplifyWayActionTest.java
|
a
|
b
|
|
| 17 | 17 | |
| 18 | 18 | import org.junit.jupiter.api.BeforeEach; |
| 19 | 19 | import org.junit.jupiter.api.Test; |
| 20 | | import org.junit.jupiter.api.extension.RegisterExtension; |
| 21 | 20 | import org.openstreetmap.josm.TestUtils; |
| 22 | 21 | import org.openstreetmap.josm.command.DeleteCommand; |
| 23 | 22 | import org.openstreetmap.josm.command.SequenceCommand; |
| … |
… |
|
| 28 | 27 | import org.openstreetmap.josm.gui.MainApplication; |
| 29 | 28 | import org.openstreetmap.josm.io.IllegalDataException; |
| 30 | 29 | import org.openstreetmap.josm.io.OsmReader; |
| 31 | | import org.openstreetmap.josm.testutils.JOSMTestRules; |
| | 30 | import org.openstreetmap.josm.testutils.annotations.Main; |
| | 31 | import org.openstreetmap.josm.testutils.annotations.Projection; |
| 32 | 32 | import org.openstreetmap.josm.tools.Utils; |
| 33 | 33 | |
| 34 | | import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; |
| 35 | | |
| 36 | 34 | /** |
| 37 | 35 | * Unit tests for class {@link SimplifyWayAction}. |
| 38 | 36 | */ |
| | 37 | @Main |
| | 38 | @Projection |
| 39 | 39 | final class SimplifyWayActionTest { |
| 40 | 40 | |
| 41 | 41 | /** Class under test. */ |
| 42 | 42 | private static SimplifyWayAction action; |
| 43 | 43 | |
| 44 | | /** |
| 45 | | * Setup test. |
| 46 | | */ |
| 47 | | @RegisterExtension |
| 48 | | @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") |
| 49 | | public JOSMTestRules test = new JOSMTestRules().main().projection(); |
| 50 | | |
| 51 | 44 | /** |
| 52 | 45 | * Setup test. |
| 53 | 46 | */ |
-
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
diff --git a/test/unit/org/openstreetmap/josm/actions/SplitWayActionTest.java b/test/unit/org/openstreetmap/josm/actions/SplitWayActionTest.java
|
a
|
b
|
|
| 7 | 7 | import java.util.Arrays; |
| 8 | 8 | |
| 9 | 9 | import org.junit.jupiter.api.Test; |
| 10 | | import org.junit.jupiter.api.extension.RegisterExtension; |
| 11 | 10 | import org.openstreetmap.josm.TestUtils; |
| 12 | 11 | import org.openstreetmap.josm.data.coor.EastNorth; |
| 13 | 12 | import org.openstreetmap.josm.data.coor.LatLon; |
| … |
… |
|
| 16 | 15 | import org.openstreetmap.josm.data.osm.Relation; |
| 17 | 16 | import org.openstreetmap.josm.data.osm.RelationMember; |
| 18 | 17 | import org.openstreetmap.josm.data.osm.Way; |
| 19 | | import org.openstreetmap.josm.testutils.JOSMTestRules; |
| 20 | | |
| 21 | | import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; |
| | 18 | import org.openstreetmap.josm.testutils.annotations.Projection; |
| 22 | 19 | |
| 23 | 20 | /** |
| 24 | 21 | * Unit tests for class {@link SplitWayAction}. |
| 25 | 22 | */ |
| | 23 | @Projection |
| 26 | 24 | final class SplitWayActionTest { |
| 27 | | |
| 28 | | /** |
| 29 | | * Setup test. |
| 30 | | */ |
| 31 | | @RegisterExtension |
| 32 | | @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") |
| 33 | | public JOSMTestRules test = new JOSMTestRules().projection(); |
| 34 | 25 | private final DataSet dataSet = new DataSet(); |
| 35 | 26 | |
| 36 | 27 | private Node addNode(int east, int north) { |
-
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
diff --git a/test/unit/org/openstreetmap/josm/actions/UnGlueActionTest.java b/test/unit/org/openstreetmap/josm/actions/UnGlueActionTest.java
|
a
|
b
|
|
| 6 | 6 | |
| 7 | 7 | import org.junit.jupiter.api.BeforeEach; |
| 8 | 8 | import org.junit.jupiter.api.Test; |
| 9 | | import org.junit.jupiter.api.extension.RegisterExtension; |
| 10 | 9 | import org.openstreetmap.josm.data.coor.LatLon; |
| 11 | 10 | import org.openstreetmap.josm.data.osm.DataSet; |
| 12 | 11 | import org.openstreetmap.josm.data.osm.Node; |
| 13 | 12 | import org.openstreetmap.josm.data.osm.Way; |
| 14 | 13 | import org.openstreetmap.josm.gui.MainApplication; |
| 15 | 14 | import org.openstreetmap.josm.gui.layer.OsmDataLayer; |
| 16 | | import org.openstreetmap.josm.testutils.JOSMTestRules; |
| 17 | | |
| 18 | | import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; |
| | 15 | import org.openstreetmap.josm.testutils.annotations.BasicPreferences; |
| | 16 | import org.openstreetmap.josm.testutils.annotations.Main; |
| | 17 | import org.openstreetmap.josm.testutils.annotations.Projection; |
| 19 | 18 | |
| 20 | 19 | /** |
| 21 | 20 | * Unit tests for class {@link UnGlueAction}. |
| 22 | 21 | */ |
| | 22 | @BasicPreferences |
| | 23 | @Main |
| | 24 | @Projection |
| 23 | 25 | final class UnGlueActionTest { |
| 24 | 26 | |
| 25 | 27 | /** Class under test. */ |
| 26 | 28 | private static UnGlueAction action; |
| 27 | 29 | |
| 28 | | /** |
| 29 | | * Setup test. |
| 30 | | */ |
| 31 | | @RegisterExtension |
| 32 | | @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") |
| 33 | | public JOSMTestRules test = new JOSMTestRules().main().projection().preferences(); |
| 34 | | |
| 35 | 30 | /** |
| 36 | 31 | * Setup test. |
| 37 | 32 | */ |
-
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
diff --git a/test/unit/org/openstreetmap/josm/actions/UnJoinNodeWayActionTest.java b/test/unit/org/openstreetmap/josm/actions/UnJoinNodeWayActionTest.java
|
a
|
b
|
|
| 6 | 6 | import java.util.Arrays; |
| 7 | 7 | |
| 8 | 8 | import org.junit.jupiter.api.Test; |
| 9 | | import org.junit.jupiter.api.extension.RegisterExtension; |
| 10 | 9 | import org.openstreetmap.josm.data.coor.EastNorth; |
| 11 | 10 | import org.openstreetmap.josm.data.osm.DataSet; |
| 12 | 11 | import org.openstreetmap.josm.data.osm.Node; |
| 13 | 12 | import org.openstreetmap.josm.data.osm.Way; |
| 14 | 13 | import org.openstreetmap.josm.gui.MainApplication; |
| 15 | 14 | import org.openstreetmap.josm.gui.layer.OsmDataLayer; |
| 16 | | import org.openstreetmap.josm.testutils.JOSMTestRules; |
| 17 | | |
| 18 | | import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; |
| | 15 | import org.openstreetmap.josm.testutils.annotations.Main; |
| | 16 | import org.openstreetmap.josm.testutils.annotations.Projection; |
| 19 | 17 | |
| 20 | 18 | /** |
| 21 | 19 | * Unit tests for class {@link UnJoinNodeWayAction}. |
| 22 | 20 | */ |
| | 21 | @Main |
| | 22 | @Projection |
| 23 | 23 | final class UnJoinNodeWayActionTest { |
| 24 | 24 | |
| 25 | 25 | /** |
| … |
… |
|
| 32 | 32 | */ |
| 33 | 33 | @Override |
| 34 | 34 | public void notify(String msg, int messageType) { |
| 35 | | return; |
| | 35 | // Do nothing |
| 36 | 36 | } |
| 37 | 37 | } |
| 38 | | |
| 39 | | /** |
| 40 | | * Setup test. |
| 41 | | */ |
| 42 | | @RegisterExtension |
| 43 | | @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") |
| 44 | | public static JOSMTestRules test = new JOSMTestRules().projection().main(); |
| 45 | 38 | |
| 46 | 39 | /** |
| 47 | 40 | * Test case: Ignore irrelevant nodes |
| … |
… |
|
| 64 | 57 | dataSet.addPrimitive(n4); |
| 65 | 58 | |
| 66 | 59 | Way w = new Way(); |
| 67 | | w.setNodes(Arrays.asList(new Node[] {n1, n2, n3})); |
| | 60 | w.setNodes(Arrays.asList(n1, n2, n3)); |
| 68 | 61 | dataSet.addPrimitive(w); |
| 69 | 62 | |
| 70 | 63 | dataSet.addSelected(n2); |
-
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
diff --git a/test/unit/org/openstreetmap/josm/actions/UploadActionTest.java b/test/unit/org/openstreetmap/josm/actions/UploadActionTest.java
|
a
|
b
|
|
| 3 | 3 | |
| 4 | 4 | import static org.junit.jupiter.api.Assertions.assertDoesNotThrow; |
| 5 | 5 | import static org.junit.jupiter.api.Assertions.assertTrue; |
| 6 | | import static org.junit.jupiter.api.Assertions.fail; |
| 7 | 6 | |
| 8 | 7 | import java.awt.GraphicsEnvironment; |
| 9 | 8 | import java.util.Collections; |
| | 9 | import java.util.concurrent.ExecutionException; |
| 10 | 10 | import java.util.concurrent.TimeUnit; |
| | 11 | import java.util.concurrent.TimeoutException; |
| 11 | 12 | |
| 12 | 13 | import org.junit.jupiter.api.Test; |
| 13 | | import org.junit.jupiter.api.extension.RegisterExtension; |
| 14 | 14 | import org.openstreetmap.josm.TestUtils; |
| 15 | 15 | import org.openstreetmap.josm.command.AddPrimitivesCommand; |
| 16 | 16 | import org.openstreetmap.josm.data.UserIdentityManager; |
| … |
… |
|
| 21 | 21 | import org.openstreetmap.josm.gui.io.UploadDialog; |
| 22 | 22 | import org.openstreetmap.josm.gui.layer.OsmDataLayer; |
| 23 | 23 | import org.openstreetmap.josm.gui.util.GuiHelper; |
| 24 | | import org.openstreetmap.josm.testutils.JOSMTestRules; |
| 25 | 24 | import org.openstreetmap.josm.testutils.annotations.BasicPreferences; |
| 26 | 25 | import org.openstreetmap.josm.testutils.annotations.Main; |
| | 26 | import org.openstreetmap.josm.testutils.annotations.OsmApi; |
| 27 | 27 | import org.openstreetmap.josm.testutils.annotations.Projection; |
| 28 | 28 | import org.openstreetmap.josm.testutils.annotations.Territories; |
| 29 | 29 | import org.openstreetmap.josm.testutils.mockers.WindowMocker; |
| … |
… |
|
| 39 | 39 | */ |
| 40 | 40 | @BasicPreferences |
| 41 | 41 | @Main |
| | 42 | @OsmApi(OsmApi.APIType.FAKE) |
| 42 | 43 | @Projection |
| 43 | 44 | // Territories is needed due to test pollution. One of the listeners |
| 44 | 45 | // that may get registered on SelectionEventManager requires |
| … |
… |
|
| 46 | 47 | // avoid the NPE. |
| 47 | 48 | @Territories(Territories.Initialize.ALL) |
| 48 | 49 | class UploadActionTest { |
| 49 | | // Only needed for layer cleanup. And user identity cleanup. And ensuring that data isn't accidentally uploaded. |
| 50 | | // Note that the setUp method can be replaced by the @Territories extension, when that is merged. |
| 51 | | @RegisterExtension |
| 52 | | static JOSMTestRules josmTestRules = new JOSMTestRules().fakeAPI(); |
| 53 | | |
| 54 | 50 | /** |
| 55 | 51 | * Non-regression test for JOSM #21476. |
| 56 | 52 | */ |
| 57 | 53 | @Test |
| 58 | | void testNonRegression21476() { |
| | 54 | void testNonRegression21476() throws ExecutionException, InterruptedException, TimeoutException { |
| 59 | 55 | TestUtils.assumeWorkingJMockit(); |
| 60 | 56 | Logging.clearLastErrorAndWarnings(); |
| 61 | 57 | new WindowMocker(); |
| … |
… |
|
| 83 | 79 | // sync worker |
| 84 | 80 | }).get(1, TimeUnit.SECONDS); |
| 85 | 81 | assertTrue(Logging.getLastErrorAndWarnings().isEmpty()); |
| 86 | | } catch (Exception exception) { |
| 87 | | fail(exception); |
| 88 | 82 | } finally { |
| 89 | 83 | Logging.clearLastErrorAndWarnings(); |
| 90 | 84 | } |
| … |
… |
|
| 108 | 102 | @Mock |
| 109 | 103 | public final boolean isCanceled(final Invocation invocation) { |
| 110 | 104 | if (!GraphicsEnvironment.isHeadless()) { |
| 111 | | return invocation.proceed(); |
| | 105 | return Boolean.TRUE.equals(invocation.proceed()); |
| 112 | 106 | } |
| 113 | 107 | return true; |
| 114 | 108 | } |
-
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
diff --git a/test/unit/org/openstreetmap/josm/command/conflict/DeletedStateConflictResolveCommandTest.java b/test/unit/org/openstreetmap/josm/command/conflict/DeletedStateConflictResolveCommandTest.java
|
a
|
b
|
|
| 9 | 9 | import org.openstreetmap.josm.data.osm.User; |
| 10 | 10 | import org.openstreetmap.josm.data.osm.Way; |
| 11 | 11 | import org.openstreetmap.josm.gui.layer.OsmDataLayer; |
| | 12 | import org.openstreetmap.josm.testutils.annotations.MapPaintStyles; |
| 12 | 13 | |
| 13 | 14 | import nl.jqno.equalsverifier.EqualsVerifier; |
| 14 | 15 | import nl.jqno.equalsverifier.Warning; |
| … |
… |
|
| 16 | 17 | /** |
| 17 | 18 | * Unit tests of {@link DeletedStateConflictResolveCommand} class. |
| 18 | 19 | */ |
| | 20 | @MapPaintStyles |
| 19 | 21 | class DeletedStateConflictResolveCommandTest { |
| 20 | 22 | /** |
| 21 | 23 | * Unit test of methods {@link DeletedStateConflictResolveCommand#equals} and {@link DeletedStateConflictResolveCommand#hashCode}. |
-
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
diff --git a/test/unit/org/openstreetmap/josm/command/conflict/ModifiedConflictResolveCommandTest.java b/test/unit/org/openstreetmap/josm/command/conflict/ModifiedConflictResolveCommandTest.java
|
a
|
b
|
|
| 9 | 9 | import org.openstreetmap.josm.data.osm.User; |
| 10 | 10 | import org.openstreetmap.josm.data.osm.Way; |
| 11 | 11 | import org.openstreetmap.josm.gui.layer.OsmDataLayer; |
| | 12 | import org.openstreetmap.josm.testutils.annotations.MapPaintStyles; |
| 12 | 13 | |
| 13 | 14 | import nl.jqno.equalsverifier.EqualsVerifier; |
| 14 | 15 | import nl.jqno.equalsverifier.Warning; |
| … |
… |
|
| 16 | 17 | /** |
| 17 | 18 | * Unit tests of {@link ModifiedConflictResolveCommand} class. |
| 18 | 19 | */ |
| | 20 | @MapPaintStyles |
| 19 | 21 | class ModifiedConflictResolveCommandTest { |
| 20 | 22 | /** |
| 21 | 23 | * Unit test of methods {@link ModifiedConflictResolveCommand#equals} and {@link ModifiedConflictResolveCommand#hashCode}. |
-
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
diff --git a/test/unit/org/openstreetmap/josm/command/conflict/RelationMemberConflictResolverCommandTest.java b/test/unit/org/openstreetmap/josm/command/conflict/RelationMemberConflictResolverCommandTest.java
|
a
|
b
|
|
| 9 | 9 | import org.openstreetmap.josm.data.osm.Relation; |
| 10 | 10 | import org.openstreetmap.josm.data.osm.User; |
| 11 | 11 | import org.openstreetmap.josm.gui.layer.OsmDataLayer; |
| | 12 | import org.openstreetmap.josm.testutils.annotations.MapPaintStyles; |
| 12 | 13 | |
| 13 | 14 | import nl.jqno.equalsverifier.EqualsVerifier; |
| 14 | 15 | import nl.jqno.equalsverifier.Warning; |
| … |
… |
|
| 16 | 17 | /** |
| 17 | 18 | * Unit tests of {@link RelationMemberConflictResolverCommand} class. |
| 18 | 19 | */ |
| | 20 | @MapPaintStyles |
| 19 | 21 | class RelationMemberConflictResolverCommandTest { |
| 20 | 22 | /** |
| 21 | 23 | * Unit test of methods {@link RelationMemberConflictResolverCommand#equals} and {@link RelationMemberConflictResolverCommand#hashCode}. |
-
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
diff --git a/test/unit/org/openstreetmap/josm/command/conflict/TagConflictResolveCommandTest.java b/test/unit/org/openstreetmap/josm/command/conflict/TagConflictResolveCommandTest.java
|
a
|
b
|
|
| 9 | 9 | import org.openstreetmap.josm.data.osm.User; |
| 10 | 10 | import org.openstreetmap.josm.data.osm.Way; |
| 11 | 11 | import org.openstreetmap.josm.gui.layer.OsmDataLayer; |
| | 12 | import org.openstreetmap.josm.testutils.annotations.MapPaintStyles; |
| 12 | 13 | |
| 13 | 14 | import nl.jqno.equalsverifier.EqualsVerifier; |
| 14 | 15 | import nl.jqno.equalsverifier.Warning; |
| … |
… |
|
| 16 | 17 | /** |
| 17 | 18 | * Unit tests of {@link TagConflictResolveCommand} class. |
| 18 | 19 | */ |
| | 20 | @MapPaintStyles |
| 19 | 21 | class TagConflictResolveCommandTest { |
| 20 | 22 | /** |
| 21 | 23 | * Unit test of methods {@link TagConflictResolveCommand#equals} and {@link TagConflictResolveCommand#hashCode}. |
-
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
diff --git a/test/unit/org/openstreetmap/josm/command/conflict/VersionConflictResolveCommandTest.java b/test/unit/org/openstreetmap/josm/command/conflict/VersionConflictResolveCommandTest.java
|
a
|
b
|
|
| 9 | 9 | import org.openstreetmap.josm.data.osm.User; |
| 10 | 10 | import org.openstreetmap.josm.data.osm.Way; |
| 11 | 11 | import org.openstreetmap.josm.gui.layer.OsmDataLayer; |
| | 12 | import org.openstreetmap.josm.testutils.annotations.MapPaintStyles; |
| 12 | 13 | |
| 13 | 14 | import nl.jqno.equalsverifier.EqualsVerifier; |
| 14 | 15 | import nl.jqno.equalsverifier.Warning; |
| … |
… |
|
| 16 | 17 | /** |
| 17 | 18 | * Unit tests of {@link VersionConflictResolveCommand} class. |
| 18 | 19 | */ |
| | 20 | @MapPaintStyles |
| 19 | 21 | class VersionConflictResolveCommandTest { |
| 20 | 22 | /** |
| 21 | 23 | * Unit test of methods {@link VersionConflictResolveCommand#equals} and {@link VersionConflictResolveCommand#hashCode}. |
-
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
diff --git a/test/unit/org/openstreetmap/josm/command/conflict/WayNodesConflictResolverCommandTest.java b/test/unit/org/openstreetmap/josm/command/conflict/WayNodesConflictResolverCommandTest.java
|
a
|
b
|
|
| 9 | 9 | import org.openstreetmap.josm.data.osm.User; |
| 10 | 10 | import org.openstreetmap.josm.data.osm.Way; |
| 11 | 11 | import org.openstreetmap.josm.gui.layer.OsmDataLayer; |
| | 12 | import org.openstreetmap.josm.testutils.annotations.MapPaintStyles; |
| 12 | 13 | |
| 13 | 14 | import nl.jqno.equalsverifier.EqualsVerifier; |
| 14 | 15 | import nl.jqno.equalsverifier.Warning; |
| … |
… |
|
| 16 | 17 | /** |
| 17 | 18 | * Unit tests of {@link WayNodesConflictResolverCommand} class. |
| 18 | 19 | */ |
| | 20 | @MapPaintStyles |
| 19 | 21 | class WayNodesConflictResolverCommandTest { |
| 20 | 22 | /** |
| 21 | 23 | * Unit test of methods {@link WayNodesConflictResolverCommand#equals} and {@link WayNodesConflictResolverCommand#hashCode}. |
-
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
diff --git a/test/unit/org/openstreetmap/josm/command/MoveCommandTest.java b/test/unit/org/openstreetmap/josm/command/MoveCommandTest.java
|
a
|
b
|
|
| 13 | 13 | |
| 14 | 14 | import org.junit.jupiter.api.BeforeEach; |
| 15 | 15 | import org.junit.jupiter.api.Test; |
| 16 | | import org.junit.jupiter.api.extension.RegisterExtension; |
| 17 | 16 | import org.openstreetmap.josm.TestUtils; |
| 18 | 17 | import org.openstreetmap.josm.command.CommandTest.CommandTestDataWithRelation; |
| 19 | 18 | import org.openstreetmap.josm.data.coor.EastNorth; |
| … |
… |
|
| 24 | 23 | import org.openstreetmap.josm.data.osm.User; |
| 25 | 24 | import org.openstreetmap.josm.data.projection.ProjectionRegistry; |
| 26 | 25 | import org.openstreetmap.josm.gui.layer.OsmDataLayer; |
| 27 | | import org.openstreetmap.josm.testutils.JOSMTestRules; |
| | 26 | import org.openstreetmap.josm.testutils.annotations.BasicPreferences; |
| | 27 | import org.openstreetmap.josm.testutils.annotations.I18n; |
| | 28 | import org.openstreetmap.josm.testutils.annotations.Projection; |
| 28 | 29 | |
| 29 | | import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; |
| 30 | 30 | import nl.jqno.equalsverifier.EqualsVerifier; |
| 31 | 31 | import nl.jqno.equalsverifier.Warning; |
| 32 | 32 | |
| 33 | 33 | /** |
| 34 | 34 | * Unit tests of {@link MoveCommand} class. |
| 35 | 35 | */ |
| | 36 | @BasicPreferences |
| | 37 | @I18n |
| | 38 | @Projection |
| 36 | 39 | class MoveCommandTest { |
| 37 | | /** |
| 38 | | * We need prefs for nodes. |
| 39 | | */ |
| 40 | | @RegisterExtension |
| 41 | | @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") |
| 42 | | public JOSMTestRules test = new JOSMTestRules().preferences().i18n().projection(); |
| 43 | 40 | private CommandTestDataWithRelation testData; |
| 44 | 41 | |
| 45 | 42 | /** |
| … |
… |
|
| 59 | 56 | LatLon destLatLon = ProjectionRegistry.getProjection().eastNorth2latlon(offset); |
| 60 | 57 | EastNorth start = new EastNorth(2, 0); |
| 61 | 58 | |
| 62 | | Set<OsmPrimitive> nodeAsCollection = Collections.<OsmPrimitive>singleton(testData.existingNode); |
| | 59 | Set<OsmPrimitive> nodeAsCollection = Collections.singleton(testData.existingNode); |
| 63 | 60 | assertEquals(1, nodeAsCollection.size()); |
| 64 | 61 | checkCommandAfterConstructor(new MoveCommand(nodeAsCollection, offset)); |
| 65 | 62 | checkCommandAfterConstructor(new MoveCommand(testData.existingNode, destLatLon)); |
| … |
… |
|
| 220 | 217 | ArrayList<OsmPrimitive> modified = new ArrayList<>(); |
| 221 | 218 | ArrayList<OsmPrimitive> deleted = new ArrayList<>(); |
| 222 | 219 | ArrayList<OsmPrimitive> added = new ArrayList<>(); |
| 223 | | new MoveCommand(Arrays.<OsmPrimitive>asList(testData.existingNode), 1, 2).fillModifiedData(modified, |
| | 220 | new MoveCommand(Collections.singletonList(testData.existingNode), 1, 2).fillModifiedData(modified, |
| 224 | 221 | deleted, added); |
| 225 | 222 | assertArrayEquals(new Object[] {testData.existingNode }, modified.toArray()); |
| 226 | 223 | assertArrayEquals(new Object[] {}, deleted.toArray()); |
| … |
… |
|
| 232 | 229 | */ |
| 233 | 230 | @Test |
| 234 | 231 | void testGetParticipatingPrimitives() { |
| 235 | | MoveCommand command = new MoveCommand(Arrays.<OsmPrimitive>asList(testData.existingNode), 1, 2); |
| | 232 | MoveCommand command = new MoveCommand(Collections.singletonList(testData.existingNode), 1, 2); |
| 236 | 233 | command.executeCommand(); |
| 237 | 234 | assertArrayEquals(new Object[] {testData.existingNode}, command.getParticipatingPrimitives().toArray()); |
| 238 | 235 | |
| 239 | 236 | MoveCommand command2 = new MoveCommand( |
| 240 | | Arrays.<OsmPrimitive>asList(testData.existingNode, testData.existingWay), 1, 2); |
| | 237 | Arrays.asList(testData.existingNode, testData.existingWay), 1, 2); |
| 241 | 238 | command2.executeCommand(); |
| 242 | 239 | assertArrayEquals(new Object[] {testData.existingNode, testData.existingNode2}, |
| 243 | 240 | command2.getParticipatingPrimitives().toArray()); |
| … |
… |
|
| 250 | 247 | void testDescription() { |
| 251 | 248 | Node node = TestUtils.addFakeDataSet(new Node(LatLon.ZERO)); |
| 252 | 249 | node.put("name", "xy"); |
| 253 | | List<OsmPrimitive> nodeList = Arrays.<OsmPrimitive>asList(node); |
| | 250 | List<OsmPrimitive> nodeList = Collections.singletonList(node); |
| 254 | 251 | assertTrue(new MoveCommand(nodeList, 1, 2).getDescriptionText().matches("Move 1 node")); |
| 255 | | List<OsmPrimitive> nodes = Arrays.<OsmPrimitive>asList(node, testData.existingNode, testData.existingNode2); |
| | 252 | List<OsmPrimitive> nodes = Arrays.asList(node, testData.existingNode, testData.existingNode2); |
| 256 | 253 | assertTrue(new MoveCommand(nodes, 1, 2).getDescriptionText().matches("Move 3 nodes")); |
| 257 | 254 | } |
| 258 | 255 | |
-
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
diff --git a/test/unit/org/openstreetmap/josm/command/RotateCommandTest.java b/test/unit/org/openstreetmap/josm/command/RotateCommandTest.java
|
a
|
b
|
|
| 6 | 6 | |
| 7 | 7 | import java.util.ArrayList; |
| 8 | 8 | import java.util.Arrays; |
| | 9 | import java.util.Collections; |
| 9 | 10 | |
| 10 | 11 | import org.junit.jupiter.api.BeforeEach; |
| 11 | 12 | import org.junit.jupiter.api.Test; |
| 12 | | import org.junit.jupiter.api.extension.RegisterExtension; |
| 13 | 13 | import org.openstreetmap.josm.TestUtils; |
| 14 | 14 | import org.openstreetmap.josm.command.CommandTest.CommandTestData; |
| 15 | 15 | import org.openstreetmap.josm.data.coor.EastNorth; |
| … |
… |
|
| 19 | 19 | import org.openstreetmap.josm.data.osm.OsmPrimitive; |
| 20 | 20 | import org.openstreetmap.josm.data.osm.User; |
| 21 | 21 | import org.openstreetmap.josm.gui.layer.OsmDataLayer; |
| 22 | | import org.openstreetmap.josm.testutils.JOSMTestRules; |
| | 22 | import org.openstreetmap.josm.testutils.annotations.BasicPreferences; |
| | 23 | import org.openstreetmap.josm.testutils.annotations.Projection; |
| 23 | 24 | |
| 24 | | import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; |
| 25 | 25 | import nl.jqno.equalsverifier.EqualsVerifier; |
| 26 | 26 | import nl.jqno.equalsverifier.Warning; |
| 27 | 27 | |
| 28 | 28 | /** |
| 29 | 29 | * Unit tests of {@link RotateCommand} class. |
| 30 | 30 | */ |
| | 31 | @BasicPreferences |
| | 32 | @Projection |
| 31 | 33 | class RotateCommandTest { |
| 32 | | |
| 33 | | /** |
| 34 | | * We need prefs for nodes. |
| 35 | | */ |
| 36 | | @RegisterExtension |
| 37 | | @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") |
| 38 | | public JOSMTestRules test = new JOSMTestRules().preferences().projection(); |
| 39 | 34 | private CommandTestData testData; |
| 40 | 35 | |
| 41 | 36 | /** |
| … |
… |
|
| 99 | 94 | ArrayList<OsmPrimitive> modified = new ArrayList<>(); |
| 100 | 95 | ArrayList<OsmPrimitive> deleted = new ArrayList<>(); |
| 101 | 96 | ArrayList<OsmPrimitive> added = new ArrayList<>(); |
| 102 | | RotateCommand command = new RotateCommand(Arrays.asList(testData.existingNode), |
| | 97 | RotateCommand command = new RotateCommand(Collections.singletonList(testData.existingNode), |
| 103 | 98 | new EastNorth(0, 0)); |
| 104 | 99 | // intentionally empty |
| 105 | 100 | command.fillModifiedData(modified, deleted, added); |
| … |
… |
|
| 113 | 108 | */ |
| 114 | 109 | @Test |
| 115 | 110 | void testGetParticipatingPrimitives() { |
| 116 | | RotateCommand command = new RotateCommand(Arrays.asList(testData.existingNode), new EastNorth(0, 0)); |
| | 111 | RotateCommand command = new RotateCommand(Collections.singletonList(testData.existingNode), new EastNorth(0, 0)); |
| 117 | 112 | command.executeCommand(); |
| 118 | 113 | assertArrayEquals(new Object[] {testData.existingNode}, command.getParticipatingPrimitives().toArray()); |
| 119 | 114 | } |
| … |
… |
|
| 124 | 119 | @Test |
| 125 | 120 | void testDescription() { |
| 126 | 121 | assertEquals("Rotate 1 node", |
| 127 | | new RotateCommand(Arrays.asList(testData.existingNode), new EastNorth(0, 0)) |
| | 122 | new RotateCommand(Collections.singletonList(testData.existingNode), new EastNorth(0, 0)) |
| 128 | 123 | .getDescriptionText()); |
| 129 | 124 | assertEquals("Rotate 2 nodes", |
| 130 | 125 | new RotateCommand(Arrays.asList(testData.existingNode, testData.existingNode2), new EastNorth(0, 0)) |
-
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
diff --git a/test/unit/org/openstreetmap/josm/command/ScaleCommandTest.java b/test/unit/org/openstreetmap/josm/command/ScaleCommandTest.java
|
a
|
b
|
|
| 6 | 6 | |
| 7 | 7 | import java.util.ArrayList; |
| 8 | 8 | import java.util.Arrays; |
| | 9 | import java.util.Collections; |
| 9 | 10 | |
| 10 | 11 | import org.junit.jupiter.api.BeforeEach; |
| 11 | 12 | import org.junit.jupiter.api.Test; |
| 12 | | import org.junit.jupiter.api.extension.RegisterExtension; |
| 13 | 13 | import org.openstreetmap.josm.TestUtils; |
| 14 | 14 | import org.openstreetmap.josm.command.CommandTest.CommandTestData; |
| 15 | 15 | import org.openstreetmap.josm.data.coor.EastNorth; |
| … |
… |
|
| 19 | 19 | import org.openstreetmap.josm.data.osm.OsmPrimitive; |
| 20 | 20 | import org.openstreetmap.josm.data.osm.User; |
| 21 | 21 | import org.openstreetmap.josm.gui.layer.OsmDataLayer; |
| 22 | | import org.openstreetmap.josm.testutils.JOSMTestRules; |
| | 22 | import org.openstreetmap.josm.testutils.annotations.BasicPreferences; |
| | 23 | import org.openstreetmap.josm.testutils.annotations.Projection; |
| 23 | 24 | |
| 24 | | import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; |
| 25 | 25 | import nl.jqno.equalsverifier.EqualsVerifier; |
| 26 | 26 | import nl.jqno.equalsverifier.Warning; |
| 27 | 27 | |
| 28 | 28 | /** |
| 29 | 29 | * Unit tests of {@link ScaleCommand} class. |
| 30 | 30 | */ |
| | 31 | @BasicPreferences |
| | 32 | @Projection |
| 31 | 33 | class ScaleCommandTest { |
| 32 | | |
| 33 | | /** |
| 34 | | * We need prefs for nodes. |
| 35 | | */ |
| 36 | | @RegisterExtension |
| 37 | | @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") |
| 38 | | public JOSMTestRules test = new JOSMTestRules().preferences().projection(); |
| 39 | 34 | private CommandTestData testData; |
| 40 | 35 | |
| 41 | 36 | /** |
| … |
… |
|
| 99 | 94 | ArrayList<OsmPrimitive> modified = new ArrayList<>(); |
| 100 | 95 | ArrayList<OsmPrimitive> deleted = new ArrayList<>(); |
| 101 | 96 | ArrayList<OsmPrimitive> added = new ArrayList<>(); |
| 102 | | ScaleCommand command = new ScaleCommand(Arrays.asList(testData.existingNode), |
| | 97 | ScaleCommand command = new ScaleCommand(Collections.singletonList(testData.existingNode), |
| 103 | 98 | new EastNorth(0, 0)); |
| 104 | 99 | // intentionally empty |
| 105 | 100 | command.fillModifiedData(modified, deleted, added); |
| … |
… |
|
| 113 | 108 | */ |
| 114 | 109 | @Test |
| 115 | 110 | void testGetParticipatingPrimitives() { |
| 116 | | ScaleCommand command = new ScaleCommand(Arrays.asList(testData.existingNode), new EastNorth(0, 0)); |
| | 111 | ScaleCommand command = new ScaleCommand(Collections.singletonList(testData.existingNode), new EastNorth(0, 0)); |
| 117 | 112 | command.executeCommand(); |
| 118 | 113 | assertArrayEquals(new Object[] {testData.existingNode }, command.getParticipatingPrimitives().toArray()); |
| 119 | 114 | } |
| … |
… |
|
| 124 | 119 | @Test |
| 125 | 120 | void testDescription() { |
| 126 | 121 | assertEquals("Scale 1 node", |
| 127 | | new ScaleCommand(Arrays.asList(testData.existingNode), new EastNorth(0, 0)) |
| | 122 | new ScaleCommand(Collections.singletonList(testData.existingNode), new EastNorth(0, 0)) |
| 128 | 123 | .getDescriptionText()); |
| 129 | 124 | assertEquals("Scale 2 nodes", |
| 130 | 125 | new ScaleCommand(Arrays.asList(testData.existingNode, testData.existingNode2), new EastNorth(0, 0)) |
-
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
diff --git a/test/unit/org/openstreetmap/josm/command/SplitWayCommandTest.java b/test/unit/org/openstreetmap/josm/command/SplitWayCommandTest.java
|
a
|
b
|
|
| 17 | 17 | import java.util.stream.Stream; |
| 18 | 18 | |
| 19 | 19 | import org.junit.jupiter.api.Test; |
| 20 | | import org.junit.jupiter.api.extension.RegisterExtension; |
| 21 | 20 | import org.junit.jupiter.params.ParameterizedTest; |
| 22 | 21 | import org.junit.jupiter.params.provider.Arguments; |
| 23 | 22 | import org.junit.jupiter.params.provider.MethodSource; |
| … |
… |
|
| 37 | 36 | import org.openstreetmap.josm.gui.dialogs.relation.sort.WayConnectionTypeCalculator; |
| 38 | 37 | import org.openstreetmap.josm.io.IllegalDataException; |
| 39 | 38 | import org.openstreetmap.josm.io.OsmReader; |
| 40 | | import org.openstreetmap.josm.testutils.JOSMTestRules; |
| 41 | | |
| 42 | | import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; |
| | 39 | import org.openstreetmap.josm.testutils.annotations.BasicPreferences; |
| | 40 | import org.openstreetmap.josm.testutils.annotations.Main; |
| | 41 | import org.openstreetmap.josm.testutils.annotations.Projection; |
| 43 | 42 | |
| 44 | 43 | /** |
| 45 | 44 | * Unit tests for class {@link SplitWayCommand}. |
| 46 | 45 | */ |
| | 46 | @BasicPreferences |
| | 47 | @Main |
| | 48 | @Projection |
| 47 | 49 | final class SplitWayCommandTest { |
| 48 | | |
| 49 | | /** |
| 50 | | * Setup test. |
| 51 | | */ |
| 52 | | @RegisterExtension |
| 53 | | @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") |
| 54 | | static JOSMTestRules test = new JOSMTestRules().main().projection().preferences(); |
| 55 | | |
| 56 | 50 | /** |
| 57 | 51 | * Unit test of {@link SplitWayCommand#findVias}. |
| 58 | 52 | */ |
| … |
… |
|
| 302 | 296 | |
| 303 | 297 | /** |
| 304 | 298 | * Non-regression test for issue #17400 (Warn when splitting way in not fully downloaded region) |
| 305 | | * |
| | 299 | * <p> |
| 306 | 300 | * Bus route 190 gets broken when the split occurs, because the two new way parts are inserted in the relation in |
| 307 | 301 | * the wrong order. |
| 308 | 302 | * |
| … |
… |
|
| 347 | 341 | |
| 348 | 342 | /** |
| 349 | 343 | * Non-regression test for issue #18863 (Asking for download of missing members when not needed) |
| 350 | | * |
| | 344 | * <p> |
| 351 | 345 | * A split on node 4518025255 caused the 'download missing members?' dialog to pop up for relation 68745 (CB 2), |
| 352 | 346 | * even though the way members next to the split way were already downloaded. This happened because this relation |
| 353 | 347 | * does not have its members connected at all. |
| 354 | | * |
| | 348 | * <p> |
| 355 | 349 | * This split should not trigger any download action at all. |
| 356 | 350 | * |
| 357 | 351 | * @throws IOException if any I/O error occurs |
-
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
diff --git a/test/unit/org/openstreetmap/josm/data/cache/HostLimitQueueTest.java b/test/unit/org/openstreetmap/josm/data/cache/HostLimitQueueTest.java
|
a
|
b
|
|
| 12 | 12 | |
| 13 | 13 | import org.apache.commons.jcs3.access.behavior.ICacheAccess; |
| 14 | 14 | import org.junit.jupiter.api.Test; |
| 15 | | import org.junit.jupiter.api.extension.RegisterExtension; |
| | 15 | import org.junit.jupiter.api.Timeout; |
| 16 | 16 | import org.openstreetmap.josm.data.imagery.TMSCachedTileLoader; |
| 17 | 17 | import org.openstreetmap.josm.data.imagery.TileJobOptions; |
| 18 | | import org.openstreetmap.josm.testutils.JOSMTestRules; |
| | 18 | import org.openstreetmap.josm.testutils.annotations.BasicPreferences; |
| 19 | 19 | import org.openstreetmap.josm.tools.Logging; |
| 20 | 20 | |
| 21 | | import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; |
| 22 | | |
| 23 | 21 | /** |
| 24 | | * Simple tests for ThreadPoolExecutor / HostLimitQueue veryfing, that this pair works OK |
| | 22 | * Simple tests for ThreadPoolExecutor / HostLimitQueue verifying, that this pair works OK |
| 25 | 23 | * @author Wiktor Niesiobedzki |
| 26 | 24 | */ |
| | 25 | @BasicPreferences |
| | 26 | @Timeout(20) |
| 27 | 27 | class HostLimitQueueTest { |
| 28 | | /** |
| 29 | | * Setup test. |
| 30 | | */ |
| 31 | | @RegisterExtension |
| 32 | | @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") |
| 33 | | public JOSMTestRules test = new JOSMTestRules().preferences().timeout(20 * 1000); |
| 34 | | |
| 35 | 28 | /** |
| 36 | 29 | * Mock class for tests |
| 37 | 30 | */ |
-
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
diff --git a/test/unit/org/openstreetmap/josm/data/coor/conversion/ICoordinateFormatTest.java b/test/unit/org/openstreetmap/josm/data/coor/conversion/ICoordinateFormatTest.java
|
a
|
b
|
|
| 3 | 3 | |
| 4 | 4 | import static org.junit.jupiter.api.Assertions.assertEquals; |
| 5 | 5 | |
| 6 | | import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; |
| 7 | | |
| 8 | | import org.junit.jupiter.api.extension.RegisterExtension; |
| 9 | 6 | import org.junit.jupiter.api.Test; |
| 10 | 7 | import org.openstreetmap.josm.data.coor.ILatLon; |
| 11 | 8 | import org.openstreetmap.josm.data.coor.LatLon; |
| 12 | | import org.openstreetmap.josm.testutils.JOSMTestRules; |
| | 9 | import org.openstreetmap.josm.testutils.annotations.Projection; |
| 13 | 10 | |
| 14 | 11 | /** |
| 15 | 12 | * Test for {@link ICoordinateFormat} implementations. |
| 16 | 13 | */ |
| | 14 | @Projection |
| 17 | 15 | class ICoordinateFormatTest { |
| 18 | | /** |
| 19 | | * Setup test. |
| 20 | | */ |
| 21 | | @RegisterExtension |
| 22 | | @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") |
| 23 | | public JOSMTestRules test = new JOSMTestRules().projection(); |
| 24 | | |
| 25 | 16 | /** |
| 26 | 17 | * Tests {@link ICoordinateFormat#latToString(org.openstreetmap.josm.data.coor.ILatLon)} |
| 27 | 18 | * and {@link ICoordinateFormat#lonToString(org.openstreetmap.josm.data.coor.ILatLon)} |
-
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
diff --git a/test/unit/org/openstreetmap/josm/data/coor/conversion/LatLonParserTest.java b/test/unit/org/openstreetmap/josm/data/coor/conversion/LatLonParserTest.java
|
a
|
b
|
|
| 5 | 5 | import static org.junit.jupiter.api.Assertions.assertThrows; |
| 6 | 6 | |
| 7 | 7 | import org.junit.jupiter.api.Test; |
| 8 | | import org.junit.jupiter.api.extension.RegisterExtension; |
| 9 | 8 | import org.openstreetmap.josm.data.coor.LatLon; |
| 10 | | import org.openstreetmap.josm.testutils.JOSMTestRules; |
| 11 | | |
| 12 | | import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; |
| | 9 | import org.openstreetmap.josm.testutils.annotations.Projection; |
| 13 | 10 | |
| 14 | 11 | /** |
| 15 | 12 | * Unit tests for class {@link LatLonParser}. |
| 16 | 13 | */ |
| | 14 | @Projection |
| 17 | 15 | class LatLonParserTest { |
| 18 | | |
| 19 | | /** |
| 20 | | * Setup test. |
| 21 | | */ |
| 22 | | @RegisterExtension |
| 23 | | @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") |
| 24 | | public JOSMTestRules test = new JOSMTestRules().projection(); |
| 25 | | |
| 26 | 16 | /** |
| 27 | 17 | * Unit test of {@link LatLonParser#parse} method. |
| 28 | 18 | */ |
-
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
diff --git a/test/unit/org/openstreetmap/josm/data/coor/LatLonTest.java b/test/unit/org/openstreetmap/josm/data/coor/LatLonTest.java
|
a
|
b
|
|
| 10 | 10 | import java.util.List; |
| 11 | 11 | |
| 12 | 12 | import org.junit.jupiter.api.Test; |
| 13 | | import org.junit.jupiter.api.extension.RegisterExtension; |
| 14 | 13 | import org.openstreetmap.josm.TestUtils; |
| 15 | 14 | import org.openstreetmap.josm.data.Bounds; |
| 16 | | import org.openstreetmap.josm.testutils.JOSMTestRules; |
| | 15 | import org.openstreetmap.josm.testutils.annotations.Projection; |
| 17 | 16 | |
| 18 | 17 | import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; |
| 19 | 18 | import nl.jqno.equalsverifier.EqualsVerifier; |
| … |
… |
|
| 21 | 20 | /** |
| 22 | 21 | * Unit tests for class {@link LatLon}. |
| 23 | 22 | */ |
| | 23 | @Projection |
| 24 | 24 | public class LatLonTest { |
| 25 | | |
| 26 | | /** |
| 27 | | * Setup test. |
| 28 | | */ |
| 29 | | @RegisterExtension |
| 30 | | @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") |
| 31 | | public JOSMTestRules test = new JOSMTestRules().projection(); |
| 32 | | |
| 33 | 25 | private static final double EPSILON = 1e-6; |
| 34 | 26 | |
| 35 | 27 | /** |
| … |
… |
|
| 155 | 147 | } |
| 156 | 148 | |
| 157 | 149 | /** |
| 158 | | * Unit test of {@link LatLon#LatLon(LatLon)}. |
| | 150 | * Unit test of {@link LatLon#LatLon(ILatLon)}. |
| 159 | 151 | */ |
| 160 | 152 | @Test |
| 161 | 153 | void testCopyConstructor() { |
-
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
diff --git a/test/unit/org/openstreetmap/josm/data/coor/PolarCoorTest.java b/test/unit/org/openstreetmap/josm/data/coor/PolarCoorTest.java
|
a
|
b
|
|
| 6 | 6 | |
| 7 | 7 | import java.text.DecimalFormat; |
| 8 | 8 | |
| 9 | | import org.junit.jupiter.api.extension.RegisterExtension; |
| 10 | 9 | import org.junit.jupiter.api.Test; |
| 11 | 10 | import org.openstreetmap.josm.TestUtils; |
| 12 | | import org.openstreetmap.josm.testutils.JOSMTestRules; |
| | 11 | import org.openstreetmap.josm.testutils.annotations.Projection; |
| 13 | 12 | |
| 14 | | import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; |
| 15 | 13 | import nl.jqno.equalsverifier.EqualsVerifier; |
| 16 | 14 | |
| 17 | 15 | /** |
| 18 | 16 | * Test the {@link PolarCoor} class. |
| 19 | 17 | */ |
| | 18 | @Projection |
| 20 | 19 | class PolarCoorTest { |
| 21 | | |
| 22 | | /** |
| 23 | | * Setup test. |
| 24 | | */ |
| 25 | | @RegisterExtension |
| 26 | | @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") |
| 27 | | public JOSMTestRules test = new JOSMTestRules().projection(); |
| 28 | | |
| 29 | 20 | /** |
| 30 | 21 | * Test {@link PolarCoor#PolarCoor} |
| 31 | 22 | */ |
-
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
diff --git a/test/unit/org/openstreetmap/josm/data/gpx/GpxDataTest.java b/test/unit/org/openstreetmap/josm/data/gpx/GpxDataTest.java
|
a
|
b
|
|
| 20 | 20 | |
| 21 | 21 | import org.junit.jupiter.api.BeforeEach; |
| 22 | 22 | import org.junit.jupiter.api.Test; |
| 23 | | import org.junit.jupiter.api.extension.RegisterExtension; |
| 24 | 23 | import org.openstreetmap.josm.TestUtils; |
| 25 | 24 | import org.openstreetmap.josm.data.Bounds; |
| 26 | 25 | import org.openstreetmap.josm.data.DataSource; |
| … |
… |
|
| 31 | 30 | import org.openstreetmap.josm.data.gpx.GpxData.GpxDataChangeListener; |
| 32 | 31 | import org.openstreetmap.josm.data.projection.ProjectionRegistry; |
| 33 | 32 | import org.openstreetmap.josm.io.GpxReaderTest; |
| 34 | | import org.openstreetmap.josm.testutils.JOSMTestRules; |
| | 33 | import org.openstreetmap.josm.testutils.annotations.Projection; |
| 35 | 34 | import org.openstreetmap.josm.tools.ListenerList; |
| 36 | 35 | import org.openstreetmap.josm.tools.date.Interval; |
| 37 | 36 | import org.xml.sax.SAXException; |
| 38 | 37 | |
| 39 | | import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; |
| 40 | 38 | import nl.jqno.equalsverifier.EqualsVerifier; |
| 41 | 39 | import nl.jqno.equalsverifier.Warning; |
| 42 | 40 | |
| 43 | 41 | /** |
| 44 | 42 | * Unit tests for class {@link GpxData}. |
| 45 | 43 | */ |
| | 44 | @Projection |
| 46 | 45 | class GpxDataTest { |
| 47 | | |
| 48 | | /** |
| 49 | | * Setup test. |
| 50 | | */ |
| 51 | | @RegisterExtension |
| 52 | | @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") |
| 53 | | public JOSMTestRules test = new JOSMTestRules().projection(); |
| 54 | | |
| 55 | 46 | private GpxData data; |
| 56 | 47 | |
| 57 | 48 | /** |
| … |
… |
|
| 338 | 329 | p1.setInstant(Instant.ofEpochMilli(100020)); |
| 339 | 330 | p2.setInstant(Instant.ofEpochMilli(200020)); |
| 340 | 331 | |
| 341 | | data.addTrack(new GpxTrack(Arrays.asList(Arrays.asList(p2)), Collections.emptyMap())); |
| 342 | | data.addTrack(new GpxTrack(Arrays.asList(Arrays.asList(p1)), Collections.emptyMap())); |
| | 332 | data.addTrack(new GpxTrack(Collections.singletonList(Collections.singletonList(p2)), Collections.emptyMap())); |
| | 333 | data.addTrack(new GpxTrack(Collections.singletonList(Collections.singletonList(p1)), Collections.emptyMap())); |
| 343 | 334 | |
| 344 | 335 | List<IGpxTrack> tracks = data.getOrderedTracks(); |
| 345 | 336 | assertEquals(2, tracks.size()); |
| … |
… |
|
| 363 | 354 | p1.setInstant(Instant.ofEpochMilli(200020)); |
| 364 | 355 | p2.setInstant(Instant.ofEpochMilli(100020)); |
| 365 | 356 | p4.setInstant(Instant.ofEpochMilli(500020)); |
| 366 | | data.addTrack(new GpxTrack(Arrays.asList(Arrays.asList(p1, p2)), Collections.emptyMap())); |
| 367 | | data.addTrack(new GpxTrack(Arrays.asList(Arrays.asList(p3, p4, p5)), Collections.emptyMap())); |
| | 357 | data.addTrack(new GpxTrack(Collections.singletonList(Arrays.asList(p1, p2)), Collections.emptyMap())); |
| | 358 | data.addTrack(new GpxTrack(Collections.singletonList(Arrays.asList(p3, p4, p5)), Collections.emptyMap())); |
| 368 | 359 | |
| 369 | 360 | Interval times = data.getMinMaxTimeForAllTracks().orElse(null); |
| 370 | 361 | assertEquals("1970-01-01T00:01:40.020Z/1970-01-01T00:08:20.020Z", times.toString()); |
| … |
… |
|
| 382 | 373 | .map(ProjectionRegistry.getProjection()::eastNorth2latlon) |
| 383 | 374 | .map(WayPoint::new) |
| 384 | 375 | .collect(Collectors.toList()); |
| 385 | | data.addTrack(new GpxTrack(Arrays.asList(points), Collections.emptyMap())); |
| | 376 | data.addTrack(new GpxTrack(Collections.singletonList(points), Collections.emptyMap())); |
| 386 | 377 | |
| 387 | 378 | WayPoint closeToMiddle = data.nearestPointOnTrack(new EastNorth(10, 0), 10); |
| 388 | 379 | assertEquals(points.get(1), closeToMiddle); |
| … |
… |
|
| 405 | 396 | void testGetDataSources() { |
| 406 | 397 | DataSource ds = new DataSource(new Bounds(0, 0, 1, 1), "test"); |
| 407 | 398 | data.dataSources.add(ds); |
| 408 | | assertEquals(new ArrayList<>(Arrays.asList(ds)), new ArrayList<>(data.getDataSources())); |
| | 399 | assertEquals(new ArrayList<>(Collections.singletonList(ds)), new ArrayList<>(data.getDataSources())); |
| 409 | 400 | } |
| 410 | 401 | |
| 411 | 402 | /** |
| … |
… |
|
| 428 | 419 | Bounds bounds = new Bounds(0, 0, 1, 1); |
| 429 | 420 | DataSource ds = new DataSource(bounds, "test"); |
| 430 | 421 | data.dataSources.add(ds); |
| 431 | | assertEquals(Arrays.asList(bounds), data.getDataSourceBounds()); |
| | 422 | assertEquals(Collections.singletonList(bounds), data.getDataSourceBounds()); |
| 432 | 423 | } |
| 433 | 424 | |
| 434 | 425 | /** |
-
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
diff --git a/test/unit/org/openstreetmap/josm/data/imagery/vectortile/mapbox/style/MapboxVectorStyleTest.java b/test/unit/org/openstreetmap/josm/data/imagery/vectortile/mapbox/style/MapboxVectorStyleTest.java
|
a
|
b
|
|
| 28 | 28 | import java.util.stream.Collectors; |
| 29 | 29 | |
| 30 | 30 | import javax.imageio.ImageIO; |
| 31 | | import jakarta.json.Json; |
| 32 | | import jakarta.json.JsonObject; |
| 33 | | import jakarta.json.JsonObjectBuilder; |
| 34 | | import jakarta.json.JsonReader; |
| 35 | | import jakarta.json.JsonStructure; |
| 36 | | import jakarta.json.JsonValue; |
| 37 | 31 | |
| 38 | 32 | import org.awaitility.Awaitility; |
| 39 | 33 | import org.awaitility.Durations; |
| 40 | 34 | import org.junit.jupiter.api.Test; |
| 41 | | import org.junit.jupiter.api.extension.RegisterExtension; |
| 42 | 35 | import org.junit.jupiter.api.io.TempDir; |
| 43 | 36 | import org.openstreetmap.josm.TestUtils; |
| 44 | 37 | import org.openstreetmap.josm.gui.MainApplication; |
| … |
… |
|
| 48 | 41 | import org.openstreetmap.josm.gui.mappaint.mapcss.Instruction; |
| 49 | 42 | import org.openstreetmap.josm.gui.mappaint.mapcss.MapCSSRule; |
| 50 | 43 | import org.openstreetmap.josm.gui.mappaint.mapcss.MapCSSStyleSource; |
| 51 | | import org.openstreetmap.josm.testutils.JOSMTestRules; |
| | 44 | import org.openstreetmap.josm.testutils.annotations.BasicPreferences; |
| 52 | 45 | import org.openstreetmap.josm.tools.ColorHelper; |
| 53 | 46 | import org.openstreetmap.josm.tools.ImageProvider; |
| 54 | 47 | |
| | 48 | import jakarta.json.Json; |
| | 49 | import jakarta.json.JsonObject; |
| | 50 | import jakarta.json.JsonObjectBuilder; |
| | 51 | import jakarta.json.JsonReader; |
| | 52 | import jakarta.json.JsonStructure; |
| | 53 | import jakarta.json.JsonValue; |
| 55 | 54 | import nl.jqno.equalsverifier.EqualsVerifier; |
| 56 | 55 | |
| 57 | 56 | /** |
| 58 | 57 | * Test class for {@link MapboxVectorStyle} |
| 59 | 58 | * @author Taylor Smock |
| 60 | 59 | */ |
| 61 | | public class MapboxVectorStyleTest { |
| | 60 | // Needed for osm primitives (we really just need to initialize the config) |
| | 61 | // OSM primitives are called when we load style sources |
| | 62 | @BasicPreferences |
| | 63 | class MapboxVectorStyleTest { |
| 62 | 64 | /** Used to store sprite files (specifically, sprite{,@2x}.{png,json}) */ |
| 63 | 65 | @TempDir |
| 64 | 66 | File spritesDirectory; |
| 65 | 67 | |
| 66 | | // Needed for osm primitives (we really just need to initialize the config) |
| 67 | | // OSM primitives are called when we load style sources |
| 68 | | @RegisterExtension |
| 69 | | JOSMTestRules rules = new JOSMTestRules(); |
| 70 | | |
| 71 | 68 | /** The base information */ |
| 72 | 69 | private static final String BASE_STYLE = "'{'\"version\":8,\"name\":\"test_style\",\"owner\":\"josm test\",\"id\":\"{0}\",{1}'}'"; |
| 73 | 70 | /** Source 1 */ |
| … |
… |
|
| 86 | 83 | @Test |
| 87 | 84 | void testVersionChecks() { |
| 88 | 85 | assertThrows(NullPointerException.class, () -> new MapboxVectorStyle(JsonValue.EMPTY_JSON_OBJECT)); |
| 89 | | IllegalArgumentException badVersion = assertThrows(IllegalArgumentException.class, |
| 90 | | () -> new MapboxVectorStyle(Json.createObjectBuilder().add("version", 7).build())); |
| | 86 | final JsonObject style7 = Json.createObjectBuilder().add("version", 7).build(); |
| | 87 | IllegalArgumentException badVersion = assertThrows(IllegalArgumentException.class, () -> new MapboxVectorStyle(style7)); |
| 91 | 88 | assertEquals("Vector Tile Style Version not understood: version 7 (json: {\"version\":7})", badVersion.getMessage()); |
| 92 | | badVersion = assertThrows(IllegalArgumentException.class, |
| 93 | | () -> new MapboxVectorStyle(Json.createObjectBuilder().add("version", 9).build())); |
| | 89 | final JsonObject style9 = Json.createObjectBuilder().add("version", 9).build(); |
| | 90 | badVersion = assertThrows(IllegalArgumentException.class, () -> new MapboxVectorStyle(style9)); |
| 94 | 91 | assertEquals("Vector Tile Style Version not understood: version 9 (json: {\"version\":9})", badVersion.getMessage()); |
| 95 | 92 | assertDoesNotThrow(() -> new MapboxVectorStyle(Json.createObjectBuilder().add("version", 8).build())); |
| 96 | 93 | } |
-
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
diff --git a/test/unit/org/openstreetmap/josm/data/imagery/WMSEndpointTileSourceTest.java b/test/unit/org/openstreetmap/josm/data/imagery/WMSEndpointTileSourceTest.java
|
a
|
b
|
|
| 17 | 17 | import org.openstreetmap.josm.data.projection.ProjectionRegistry; |
| 18 | 18 | import org.openstreetmap.josm.data.projection.Projections; |
| 19 | 19 | import org.openstreetmap.josm.spi.preferences.Config; |
| | 20 | import org.openstreetmap.josm.testutils.annotations.BasicPreferences; |
| 20 | 21 | import org.openstreetmap.josm.testutils.annotations.BasicWiremock; |
| | 22 | import org.openstreetmap.josm.testutils.annotations.Projection; |
| 21 | 23 | |
| 22 | 24 | import com.github.tomakehurst.wiremock.WireMockServer; |
| 23 | 25 | import com.github.tomakehurst.wiremock.client.WireMock; |
| 24 | 26 | |
| 25 | | import org.openstreetmap.josm.testutils.annotations.Projection; |
| 26 | | |
| | 27 | @BasicPreferences(true) |
| 27 | 28 | @BasicWiremock |
| 28 | 29 | @Projection |
| 29 | 30 | class WMSEndpointTileSourceTest implements TileSourceTest { |
-
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
diff --git a/test/unit/org/openstreetmap/josm/data/osm/MultipolygonBuilderTest.java b/test/unit/org/openstreetmap/josm/data/osm/MultipolygonBuilderTest.java
|
a
|
b
|
|
| 5 | 5 | |
| 6 | 6 | import java.io.InputStream; |
| 7 | 7 | |
| 8 | | import org.junit.jupiter.api.extension.RegisterExtension; |
| 9 | 8 | import org.junit.jupiter.api.Test; |
| | 9 | import org.junit.jupiter.api.Timeout; |
| 10 | 10 | import org.openstreetmap.josm.TestUtils; |
| 11 | 11 | import org.openstreetmap.josm.io.OsmReader; |
| 12 | | import org.openstreetmap.josm.testutils.JOSMTestRules; |
| 13 | | |
| 14 | | import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; |
| | 12 | import org.openstreetmap.josm.testutils.annotations.Projection; |
| 15 | 13 | |
| 16 | 14 | /** |
| 17 | 15 | * Unit tests of the {@code MultipolygonBuilder} class. |
| 18 | 16 | */ |
| | 17 | @Projection |
| | 18 | @Timeout(15) |
| 19 | 19 | class MultipolygonBuilderTest { |
| 20 | | |
| 21 | | /** |
| 22 | | * Setup test. |
| 23 | | */ |
| 24 | | @RegisterExtension |
| 25 | | @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") |
| 26 | | public JOSMTestRules test = new JOSMTestRules().projection().timeout(15000); |
| 27 | | |
| 28 | 20 | /** |
| 29 | 21 | * Non-regression test for ticket #12376. |
| 30 | 22 | * @throws Exception if an error occurs |
-
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
diff --git a/test/unit/org/openstreetmap/josm/data/osm/NodeTest.java b/test/unit/org/openstreetmap/josm/data/osm/NodeTest.java
|
a
|
b
|
|
| 5 | 5 | import static org.junit.jupiter.api.Assertions.assertFalse; |
| 6 | 6 | import static org.junit.jupiter.api.Assertions.assertNotNull; |
| 7 | 7 | import static org.junit.jupiter.api.Assertions.assertNull; |
| 8 | | import static org.junit.jupiter.api.Assertions.assertTrue; |
| 9 | 8 | import static org.junit.jupiter.api.Assertions.assertThrows; |
| | 9 | import static org.junit.jupiter.api.Assertions.assertTrue; |
| 10 | 10 | |
| 11 | 11 | import org.junit.jupiter.api.Test; |
| 12 | | import org.junit.jupiter.api.extension.RegisterExtension; |
| 13 | 12 | import org.openstreetmap.josm.data.Bounds; |
| 14 | 13 | import org.openstreetmap.josm.data.DataSource; |
| 15 | 14 | import org.openstreetmap.josm.data.coor.EastNorth; |
| 16 | 15 | import org.openstreetmap.josm.data.coor.LatLon; |
| 17 | | import org.openstreetmap.josm.testutils.JOSMTestRules; |
| 18 | | |
| 19 | | import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; |
| | 16 | import org.openstreetmap.josm.testutils.annotations.Projection; |
| 20 | 17 | |
| 21 | 18 | /** |
| 22 | 19 | * Unit tests of the {@code Node} class. |
| 23 | 20 | */ |
| | 21 | @Projection |
| 24 | 22 | class NodeTest { |
| 25 | | |
| 26 | | /** |
| 27 | | * Setup test. |
| 28 | | */ |
| 29 | | @RegisterExtension |
| 30 | | @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") |
| 31 | | public JOSMTestRules test = new JOSMTestRules().projection(); |
| 32 | | |
| 33 | 23 | /** |
| 34 | 24 | * Non-regression test for ticket #12060. |
| 35 | 25 | */ |
-
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
diff --git a/test/unit/org/openstreetmap/josm/data/osm/NoteDataTest.java b/test/unit/org/openstreetmap/josm/data/osm/NoteDataTest.java
|
a
|
b
|
|
| 7 | 7 | import static org.junit.jupiter.api.Assertions.assertThrows; |
| 8 | 8 | import static org.junit.jupiter.api.Assertions.assertTrue; |
| 9 | 9 | |
| 10 | | import java.util.Arrays; |
| | 10 | import java.util.Collections; |
| 11 | 11 | import java.util.List; |
| 12 | 12 | |
| 13 | 13 | import org.junit.jupiter.api.Test; |
| 14 | | import org.junit.jupiter.api.extension.RegisterExtension; |
| 15 | 14 | import org.openstreetmap.josm.data.coor.LatLon; |
| 16 | 15 | import org.openstreetmap.josm.data.notes.Note; |
| 17 | 16 | import org.openstreetmap.josm.data.notes.Note.State; |
| 18 | 17 | import org.openstreetmap.josm.data.notes.NoteComment; |
| 19 | | import org.openstreetmap.josm.testutils.JOSMTestRules; |
| 20 | | |
| 21 | | import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; |
| | 18 | import org.openstreetmap.josm.testutils.annotations.BasicPreferences; |
| 22 | 19 | |
| 23 | 20 | /** |
| 24 | 21 | * Unit tests of the {@code NoteData} class. |
| 25 | 22 | */ |
| | 23 | @BasicPreferences |
| 26 | 24 | class NoteDataTest { |
| 27 | | |
| 28 | | /** |
| 29 | | * Setup test. |
| 30 | | */ |
| 31 | | @RegisterExtension |
| 32 | | @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") |
| 33 | | public JOSMTestRules test = new JOSMTestRules().preferences(); |
| 34 | | |
| 35 | 25 | /** |
| 36 | 26 | * Unit test for {@link NoteData#NoteData} |
| 37 | 27 | */ |
| … |
… |
|
| 39 | 29 | void testNoteData() { |
| 40 | 30 | NoteData empty = new NoteData(); |
| 41 | 31 | assertEquals(0, empty.getNotes().size()); |
| 42 | | NoteData notEmpty = new NoteData(Arrays.asList(new Note(LatLon.ZERO))); |
| | 32 | NoteData notEmpty = new NoteData(Collections.singletonList(new Note(LatLon.ZERO))); |
| 43 | 33 | assertEquals(1, notEmpty.getNotes().size()); |
| 44 | 34 | } |
| 45 | 35 | |
| … |
… |
|
| 53 | 43 | assertNull(note.getClosedAt()); |
| 54 | 44 | assertTrue(note.getComments().isEmpty()); |
| 55 | 45 | |
| 56 | | NoteData data = new NoteData(Arrays.asList(note)); |
| | 46 | NoteData data = new NoteData(Collections.singletonList(note)); |
| 57 | 47 | data.closeNote(note, "foo"); |
| 58 | 48 | |
| 59 | 49 | assertEquals(State.CLOSED, note.getState()); |
-
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
diff --git a/test/unit/org/openstreetmap/josm/data/preferences/JosmUrlsTest.java b/test/unit/org/openstreetmap/josm/data/preferences/JosmUrlsTest.java
|
a
|
b
|
|
| 3 | 3 | |
| 4 | 4 | import static org.junit.jupiter.api.Assertions.assertEquals; |
| 5 | 5 | |
| 6 | | import org.junit.jupiter.api.extension.RegisterExtension; |
| 7 | 6 | import org.junit.jupiter.api.Test; |
| 8 | 7 | import org.openstreetmap.josm.spi.preferences.Config; |
| 9 | | import org.openstreetmap.josm.testutils.JOSMTestRules; |
| 10 | | |
| 11 | | import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; |
| | 8 | import org.openstreetmap.josm.testutils.annotations.OsmApi; |
| 12 | 9 | |
| 13 | 10 | /** |
| 14 | 11 | * Unit tests of {@link JosmUrls} class. |
| 15 | 12 | */ |
| | 13 | @OsmApi(OsmApi.APIType.DEV) |
| 16 | 14 | class JosmUrlsTest { |
| 17 | | |
| 18 | | /** |
| 19 | | * Setup test. |
| 20 | | */ |
| 21 | | @RegisterExtension |
| 22 | | @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") |
| 23 | | public JOSMTestRules test = new JOSMTestRules().devAPI(); |
| 24 | | |
| 25 | 15 | /** |
| 26 | 16 | * Unit test of {@link JosmUrls#getBaseUserUrl}. |
| 27 | 17 | */ |
-
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
diff --git a/test/unit/org/openstreetmap/josm/data/projection/ProjectionRefTest.java b/test/unit/org/openstreetmap/josm/data/projection/ProjectionRefTest.java
|
a
|
b
|
|
| 36 | 36 | import java.util.regex.Pattern; |
| 37 | 37 | |
| 38 | 38 | import org.junit.jupiter.api.Test; |
| 39 | | import org.junit.jupiter.api.extension.RegisterExtension; |
| | 39 | import org.junit.jupiter.api.Timeout; |
| 40 | 40 | import org.openstreetmap.josm.data.Bounds; |
| 41 | 41 | import org.openstreetmap.josm.data.coor.EastNorth; |
| 42 | 42 | import org.openstreetmap.josm.data.coor.LatLon; |
| 43 | 43 | import org.openstreetmap.josm.gui.preferences.projection.CodeProjectionChoice; |
| 44 | | import org.openstreetmap.josm.testutils.JOSMTestRules; |
| | 44 | import org.openstreetmap.josm.testutils.annotations.ProjectionNadGrids; |
| 45 | 45 | import org.openstreetmap.josm.tools.Pair; |
| 46 | 46 | import org.openstreetmap.josm.tools.PlatformManager; |
| 47 | 47 | |
| … |
… |
|
| 56 | 56 | * the full path of the executable). Make sure the required *.gsb grid files |
| 57 | 57 | * can be accessed, i.e. copy them from <code>nodist/data/projection</code> to <code>/usr/share/proj</code> or |
| 58 | 58 | * wherever cs2cs expects them to be placed. |
| 59 | | * |
| | 59 | * <p> |
| 60 | 60 | * The input parameter for the external library is <em>not</em> the projection code |
| 61 | 61 | * (e.g. "EPSG:25828"), but the entire definition, (e.g. "+proj=utm +zone=28 +ellps=GRS80 +nadgrids=null"). |
| 62 | 62 | * This means the test does not verify our definitions, but the correctness |
| 63 | 63 | * of the algorithm, given a certain definition. |
| 64 | 64 | */ |
| | 65 | @ProjectionNadGrids |
| | 66 | @Timeout(90) |
| 65 | 67 | class ProjectionRefTest { |
| 66 | 68 | |
| 67 | 69 | private static final String CS2CS_EXE = "cs2cs"; |
| … |
… |
|
| 86 | 88 | static boolean debug; |
| 87 | 89 | static List<String> forcedCodes; |
| 88 | 90 | |
| 89 | | /** |
| 90 | | * Setup test. |
| 91 | | */ |
| 92 | | @RegisterExtension |
| 93 | | @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") |
| 94 | | public JOSMTestRules test = new JOSMTestRules().projectionNadGrids().timeout(90_000); |
| 95 | | |
| 96 | 91 | /** |
| 97 | 92 | * Program entry point. |
| 98 | 93 | * @param args optional comma-separated list of projections to update. If set, only these projections will be updated |
-
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
diff --git a/test/unit/org/openstreetmap/josm/data/projection/ProjectionRegressionTest.java b/test/unit/org/openstreetmap/josm/data/projection/ProjectionRegressionTest.java
|
a
|
b
|
|
| 24 | 24 | import org.openstreetmap.josm.data.Bounds; |
| 25 | 25 | import org.openstreetmap.josm.data.coor.EastNorth; |
| 26 | 26 | import org.openstreetmap.josm.data.coor.LatLon; |
| | 27 | import org.openstreetmap.josm.testutils.annotations.ProjectionNadGrids; |
| 27 | 28 | import org.openstreetmap.josm.tools.Pair; |
| 28 | 29 | import org.openstreetmap.josm.tools.Platform; |
| 29 | 30 | import org.openstreetmap.josm.tools.Utils; |
| … |
… |
|
| 137 | 138 | * Non-regression unit test. |
| 138 | 139 | * @throws IOException if any I/O error occurs |
| 139 | 140 | */ |
| | 141 | @ProjectionNadGrids |
| 140 | 142 | @Test |
| 141 | 143 | void testNonRegression() throws IOException { |
| 142 | 144 | // Disable on Github Windows runners + Java 8, minor differences appeared around 2021-07-20 |
-
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
diff --git a/test/unit/org/openstreetmap/josm/data/projection/ProjectionTest.java b/test/unit/org/openstreetmap/josm/data/projection/ProjectionTest.java
|
a
|
b
|
|
| 15 | 15 | import org.openstreetmap.josm.data.coor.EastNorth; |
| 16 | 16 | import org.openstreetmap.josm.data.coor.ILatLon; |
| 17 | 17 | import org.openstreetmap.josm.data.coor.LatLon; |
| | 18 | import org.openstreetmap.josm.testutils.annotations.ProjectionNadGrids; |
| 18 | 19 | |
| 19 | 20 | /** |
| 20 | 21 | * Unit tests for class {@link Projection}. |
| … |
… |
|
| 29 | 30 | /** |
| 30 | 31 | * Tests that projections are numerically stable in their definition bounds (round trip error < 1e-5) |
| 31 | 32 | */ |
| | 33 | @ProjectionNadGrids |
| 32 | 34 | @Test |
| 33 | 35 | void testProjections() { |
| 34 | 36 | error = false; |
-
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
diff --git a/test/unit/org/openstreetmap/josm/data/projection/SwissGridTest.java b/test/unit/org/openstreetmap/josm/data/projection/SwissGridTest.java
|
a
|
b
|
|
| 6 | 6 | |
| 7 | 7 | import org.junit.jupiter.api.BeforeAll; |
| 8 | 8 | import org.junit.jupiter.api.Test; |
| 9 | | import org.junit.jupiter.api.extension.RegisterExtension; |
| 10 | 9 | import org.openstreetmap.josm.data.coor.EastNorth; |
| 11 | 10 | import org.openstreetmap.josm.data.coor.LatLon; |
| 12 | | import org.openstreetmap.josm.testutils.JOSMTestRules; |
| 13 | | |
| 14 | | import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; |
| | 11 | import org.openstreetmap.josm.testutils.annotations.ProjectionNadGrids; |
| 15 | 12 | |
| 16 | 13 | /** |
| 17 | 14 | * Unit tests for the Swiss projection grid. |
| 18 | 15 | */ |
| | 16 | @ProjectionNadGrids |
| 19 | 17 | class SwissGridTest { |
| 20 | 18 | private static final String SWISS_EPSG_CODE = "EPSG:21781"; |
| 21 | 19 | private final boolean debug = false; |
| 22 | 20 | |
| 23 | | /** |
| 24 | | * Setup test. |
| 25 | | */ |
| 26 | | @RegisterExtension |
| 27 | | @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") |
| 28 | | public JOSMTestRules test = new JOSMTestRules().projectionNadGrids(); |
| 29 | | |
| 30 | 21 | /** |
| 31 | 22 | * Setup test. |
| 32 | 23 | */ |
-
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
diff --git a/test/unit/org/openstreetmap/josm/data/validation/tests/ConditionalKeysTest.java b/test/unit/org/openstreetmap/josm/data/validation/tests/ConditionalKeysTest.java
|
a
|
b
|
|
| 6 | 6 | |
| 7 | 7 | import org.junit.jupiter.api.BeforeEach; |
| 8 | 8 | import org.junit.jupiter.api.Test; |
| 9 | | import org.junit.jupiter.api.extension.RegisterExtension; |
| 10 | | import org.openstreetmap.josm.testutils.JOSMTestRules; |
| 11 | | |
| 12 | | import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; |
| | 9 | import org.openstreetmap.josm.testutils.annotations.TaggingPresets; |
| 13 | 10 | |
| 14 | 11 | /** |
| 15 | 12 | * Unit test of {@link ConditionalKeys}. |
| 16 | 13 | */ |
| | 14 | @TaggingPresets |
| 17 | 15 | class ConditionalKeysTest { |
| 18 | 16 | |
| 19 | 17 | private final ConditionalKeys test = new ConditionalKeys(); |
| 20 | 18 | |
| 21 | | /** |
| 22 | | * Setup test |
| 23 | | */ |
| 24 | | @RegisterExtension |
| 25 | | @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") |
| 26 | | public JOSMTestRules rule = new JOSMTestRules().presets(); |
| 27 | | |
| 28 | 19 | /** |
| 29 | 20 | * Setup test |
| 30 | 21 | * @throws Exception if an error occurs |
-
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
diff --git a/test/unit/org/openstreetmap/josm/data/validation/tests/CrossingWaysTest.java b/test/unit/org/openstreetmap/josm/data/validation/tests/CrossingWaysTest.java
|
a
|
b
|
|
| 11 | 11 | import java.util.List; |
| 12 | 12 | |
| 13 | 13 | import org.junit.jupiter.api.Test; |
| 14 | | import org.junit.jupiter.api.extension.RegisterExtension; |
| 15 | 14 | import org.openstreetmap.josm.TestUtils; |
| 16 | 15 | import org.openstreetmap.josm.data.coor.EastNorth; |
| 17 | 16 | import org.openstreetmap.josm.data.coor.LatLon; |
| … |
… |
|
| 24 | 23 | import org.openstreetmap.josm.data.validation.tests.CrossingWays.SelfCrossing; |
| 25 | 24 | import org.openstreetmap.josm.data.validation.tests.CrossingWays.Ways; |
| 26 | 25 | import org.openstreetmap.josm.io.OsmReader; |
| 27 | | import org.openstreetmap.josm.testutils.JOSMTestRules; |
| 28 | | |
| 29 | | import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; |
| | 26 | import org.openstreetmap.josm.testutils.annotations.BasicPreferences; |
| | 27 | import org.openstreetmap.josm.testutils.annotations.Projection; |
| 30 | 28 | |
| 31 | 29 | /** |
| 32 | 30 | * Unit test of {@link CrossingWays}. |
| 33 | 31 | */ |
| | 32 | @BasicPreferences |
| | 33 | @Projection |
| 34 | 34 | class CrossingWaysTest { |
| 35 | | |
| 36 | | /** |
| 37 | | * Setup test |
| 38 | | */ |
| 39 | | @RegisterExtension |
| 40 | | @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") |
| 41 | | public JOSMTestRules rule = new JOSMTestRules().preferences().projection(); |
| 42 | | |
| 43 | 35 | private static Way newUsableWay(String tags) { |
| 44 | 36 | return TestUtils.newWay(tags, new Node(LatLon.NORTH_POLE), new Node(LatLon.ZERO)); |
| 45 | 37 | } |
-
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
diff --git a/test/unit/org/openstreetmap/josm/data/validation/tests/MultipolygonTestTest.java b/test/unit/org/openstreetmap/josm/data/validation/tests/MultipolygonTestTest.java
|
a
|
b
|
|
| 7 | 7 | import java.io.InputStream; |
| 8 | 8 | import java.util.stream.Collectors; |
| 9 | 9 | |
| 10 | | import org.junit.jupiter.api.extension.RegisterExtension; |
| 11 | 10 | import org.junit.jupiter.api.Test; |
| 12 | 11 | import org.openstreetmap.josm.TestUtils; |
| 13 | 12 | import org.openstreetmap.josm.data.osm.Relation; |
| 14 | 13 | import org.openstreetmap.josm.io.OsmReader; |
| 15 | | import org.openstreetmap.josm.testutils.JOSMTestRules; |
| 16 | | |
| 17 | | import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; |
| | 14 | import org.openstreetmap.josm.testutils.annotations.BasicPreferences; |
| | 15 | import org.openstreetmap.josm.testutils.annotations.Main; |
| | 16 | import org.openstreetmap.josm.testutils.annotations.MapPaintStyles; |
| | 17 | import org.openstreetmap.josm.testutils.annotations.Projection; |
| | 18 | import org.openstreetmap.josm.testutils.annotations.TaggingPresets; |
| 18 | 19 | |
| 19 | 20 | /** |
| 20 | 21 | * JUnit Test of Multipolygon validation test. |
| 21 | 22 | */ |
| | 23 | @BasicPreferences |
| | 24 | @Main |
| | 25 | @MapPaintStyles |
| | 26 | @Projection |
| | 27 | @TaggingPresets |
| 22 | 28 | class MultipolygonTestTest { |
| 23 | | |
| 24 | | |
| 25 | | /** |
| 26 | | * Setup test. |
| 27 | | */ |
| 28 | | @RegisterExtension |
| 29 | | @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") |
| 30 | | public JOSMTestRules test = new JOSMTestRules().projection().mapStyles().presets().main().preferences(); |
| 31 | | |
| 32 | 29 | /** |
| 33 | 30 | * Test all error cases manually created in multipolygon.osm. |
| 34 | 31 | * @throws Exception in case of error |
-
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
diff --git a/test/unit/org/openstreetmap/josm/data/validation/tests/RelationCheckerTest.java b/test/unit/org/openstreetmap/josm/data/validation/tests/RelationCheckerTest.java
|
a
|
b
|
|
| 8 | 8 | import java.util.List; |
| 9 | 9 | |
| 10 | 10 | import org.junit.jupiter.api.Test; |
| 11 | | import org.junit.jupiter.api.extension.RegisterExtension; |
| 12 | 11 | import org.openstreetmap.josm.TestUtils; |
| 13 | 12 | import org.openstreetmap.josm.data.osm.Node; |
| 14 | 13 | import org.openstreetmap.josm.data.osm.OsmUtils; |
| … |
… |
|
| 16 | 15 | import org.openstreetmap.josm.data.osm.RelationMember; |
| 17 | 16 | import org.openstreetmap.josm.data.osm.Way; |
| 18 | 17 | import org.openstreetmap.josm.data.validation.TestError; |
| 19 | | import org.openstreetmap.josm.testutils.JOSMTestRules; |
| 20 | | |
| 21 | | import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; |
| | 18 | import org.openstreetmap.josm.testutils.annotations.TaggingPresets; |
| 22 | 19 | |
| 23 | 20 | /** |
| 24 | 21 | * Unit tests of {@link RelationChecker} class. |
| 25 | 22 | */ |
| | 23 | @TaggingPresets |
| 26 | 24 | class RelationCheckerTest { |
| 27 | | /** |
| 28 | | * Setup test. |
| 29 | | */ |
| 30 | | @RegisterExtension |
| 31 | | @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") |
| 32 | | public JOSMTestRules rule = new JOSMTestRules().presets(); |
| 33 | | |
| 34 | 25 | private static RelationChecker getRelationChecker() { |
| 35 | 26 | RelationChecker checker = new RelationChecker(); |
| 36 | 27 | checker.initialize(); |
-
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
diff --git a/test/unit/org/openstreetmap/josm/data/validation/tests/TagCheckerTest.java b/test/unit/org/openstreetmap/josm/data/validation/tests/TagCheckerTest.java
|
a
|
b
|
|
| 13 | 13 | import org.junit.jupiter.api.Assertions; |
| 14 | 14 | import org.junit.jupiter.api.Disabled; |
| 15 | 15 | import org.junit.jupiter.api.Test; |
| 16 | | import org.junit.jupiter.api.extension.RegisterExtension; |
| 17 | 16 | import org.openstreetmap.josm.TestUtils; |
| 18 | 17 | import org.openstreetmap.josm.data.osm.OsmPrimitive; |
| 19 | 18 | import org.openstreetmap.josm.data.osm.OsmUtils; |
| 20 | 19 | import org.openstreetmap.josm.data.osm.Tag; |
| 21 | 20 | import org.openstreetmap.josm.data.validation.Severity; |
| 22 | 21 | import org.openstreetmap.josm.data.validation.TestError; |
| 23 | | import org.openstreetmap.josm.testutils.JOSMTestRules; |
| 24 | | |
| 25 | | import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; |
| | 22 | import org.openstreetmap.josm.testutils.annotations.TaggingPresets; |
| 26 | 23 | |
| 27 | 24 | /** |
| 28 | 25 | * JUnit Test of {@link TagChecker}. |
| 29 | 26 | */ |
| | 27 | @TaggingPresets |
| 30 | 28 | class TagCheckerTest { |
| 31 | | |
| 32 | | /** |
| 33 | | * Setup test. |
| 34 | | */ |
| 35 | | @RegisterExtension |
| 36 | | @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") |
| 37 | | public JOSMTestRules rule = new JOSMTestRules().presets(); |
| 38 | | |
| 39 | 29 | List<TestError> test(OsmPrimitive primitive) throws IOException { |
| 40 | 30 | final TagChecker checker = new TagChecker() { |
| 41 | 31 | @Override |
-
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
diff --git a/test/unit/org/openstreetmap/josm/data/validation/tests/TurnRestrictionTestTest.java b/test/unit/org/openstreetmap/josm/data/validation/tests/TurnRestrictionTestTest.java
|
a
|
b
|
|
| 1 | 1 | // License: GPL. For details, see LICENSE file. |
| 2 | 2 | package org.openstreetmap.josm.data.validation.tests; |
| 3 | 3 | |
| 4 | | import org.junit.jupiter.api.extension.RegisterExtension; |
| 5 | 4 | import org.junit.jupiter.api.Test; |
| 6 | 5 | import org.openstreetmap.josm.data.osm.DataSet; |
| 7 | | import org.openstreetmap.josm.testutils.JOSMTestRules; |
| 8 | | |
| 9 | | import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; |
| | 6 | import org.openstreetmap.josm.testutils.annotations.Main; |
| | 7 | import org.openstreetmap.josm.testutils.annotations.MapPaintStyles; |
| | 8 | import org.openstreetmap.josm.testutils.annotations.Projection; |
| | 9 | import org.openstreetmap.josm.testutils.annotations.TaggingPresets; |
| 10 | 10 | |
| 11 | 11 | /** |
| 12 | 12 | * JUnit Test of turn restriction validation test. |
| 13 | 13 | */ |
| | 14 | @Main |
| | 15 | @MapPaintStyles |
| | 16 | @Projection |
| | 17 | @TaggingPresets |
| 14 | 18 | class TurnRestrictionTestTest { |
| 15 | 19 | |
| 16 | 20 | private static final TurnrestrictionTest TURNRESTRICTION_TEST = new TurnrestrictionTest(); |
| 17 | 21 | private static final RelationChecker RELATION_TEST = new RelationChecker(); |
| 18 | 22 | |
| 19 | | /** |
| 20 | | * Setup test. |
| 21 | | */ |
| 22 | | @RegisterExtension |
| 23 | | @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") |
| 24 | | public JOSMTestRules test = new JOSMTestRules().projection().mapStyles().presets().main(); |
| 25 | | |
| 26 | 23 | /** |
| 27 | 24 | * Test all error cases manually created in restriction.osm. |
| 28 | 25 | * @throws Exception in case of error |
-
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
diff --git a/test/unit/org/openstreetmap/josm/data/validation/tests/UnclosedWaysTest.java b/test/unit/org/openstreetmap/josm/data/validation/tests/UnclosedWaysTest.java
|
a
|
b
|
|
| 8 | 8 | import java.util.ArrayList; |
| 9 | 9 | import java.util.List; |
| 10 | 10 | |
| 11 | | import org.junit.jupiter.api.extension.RegisterExtension; |
| 12 | 11 | import org.junit.jupiter.api.Test; |
| 13 | 12 | import org.openstreetmap.josm.data.coor.LatLon; |
| 14 | 13 | import org.openstreetmap.josm.data.osm.DataSet; |
| … |
… |
|
| 18 | 17 | import org.openstreetmap.josm.data.osm.RelationMember; |
| 19 | 18 | import org.openstreetmap.josm.data.osm.Way; |
| 20 | 19 | import org.openstreetmap.josm.gui.mappaint.ElemStyles; |
| 21 | | import org.openstreetmap.josm.testutils.JOSMTestRules; |
| 22 | | |
| 23 | | import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; |
| | 20 | import org.openstreetmap.josm.testutils.annotations.MapPaintStyles; |
| | 21 | import org.openstreetmap.josm.testutils.annotations.Projection; |
| | 22 | import org.openstreetmap.josm.testutils.annotations.TaggingPresets; |
| 24 | 23 | |
| 25 | 24 | /** |
| 26 | 25 | * JUnit Test of unclosed ways validation test. |
| 27 | 26 | */ |
| | 27 | @MapPaintStyles |
| | 28 | @Projection |
| | 29 | @TaggingPresets |
| 28 | 30 | class UnclosedWaysTest { |
| 29 | | |
| 30 | | /** |
| 31 | | * Setup test. |
| 32 | | */ |
| 33 | | @RegisterExtension |
| 34 | | @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") |
| 35 | | public JOSMTestRules test = new JOSMTestRules().projection().mapStyles().presets(); |
| 36 | | |
| 37 | 31 | private static Way createUnclosedWay(String tags, DataSet ds) { |
| 38 | 32 | List<Node> nodes = new ArrayList<>(); |
| 39 | 33 | nodes.add(new Node(new LatLon(0, 1))); |
-
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
diff --git a/test/unit/org/openstreetmap/josm/data/validation/OsmValidatorTest.java b/test/unit/org/openstreetmap/josm/data/validation/OsmValidatorTest.java
|
a
|
b
|
|
| 7 | 7 | |
| 8 | 8 | import org.junit.jupiter.api.BeforeEach; |
| 9 | 9 | import org.junit.jupiter.api.Test; |
| 10 | | import org.junit.jupiter.api.extension.RegisterExtension; |
| 11 | 10 | import org.openstreetmap.josm.data.validation.tests.Addresses; |
| 12 | | import org.openstreetmap.josm.testutils.JOSMTestRules; |
| | 11 | import org.openstreetmap.josm.testutils.annotations.Projection; |
| 13 | 12 | |
| 14 | | import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; |
| 15 | 13 | import net.trajano.commons.testing.UtilityClassTestUtil; |
| 16 | 14 | |
| 17 | 15 | /** |
| 18 | 16 | * Unit tests for class {@link OsmValidator}. |
| 19 | 17 | */ |
| | 18 | @Projection |
| 20 | 19 | class OsmValidatorTest { |
| 21 | | |
| 22 | | /** |
| 23 | | * Setup test. |
| 24 | | */ |
| 25 | | @RegisterExtension |
| 26 | | @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") |
| 27 | | public JOSMTestRules test = new JOSMTestRules().projection(); |
| 28 | | |
| 29 | 20 | /** |
| 30 | 21 | * Setup test. |
| 31 | 22 | * @throws Exception if an error occurs |
-
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
diff --git a/test/unit/org/openstreetmap/josm/data/validation/ValidatorCLITest.java b/test/unit/org/openstreetmap/josm/data/validation/ValidatorCLITest.java
|
a
|
b
|
|
| 24 | 24 | import java.util.stream.Collectors; |
| 25 | 25 | import java.util.stream.Stream; |
| 26 | 26 | |
| 27 | | import jakarta.json.Json; |
| 28 | | import jakarta.json.JsonObject; |
| 29 | | import jakarta.json.JsonReader; |
| 30 | | |
| 31 | | import mockit.Mock; |
| 32 | | import mockit.MockUp; |
| 33 | 27 | import org.junit.jupiter.api.AfterEach; |
| 34 | 28 | import org.junit.jupiter.api.BeforeEach; |
| 35 | 29 | import org.junit.jupiter.api.Test; |
| … |
… |
|
| 49 | 43 | import org.openstreetmap.josm.spi.preferences.Config; |
| 50 | 44 | import org.openstreetmap.josm.testutils.annotations.AnnotationUtils; |
| 51 | 45 | import org.openstreetmap.josm.testutils.annotations.BasicPreferences; |
| | 46 | import org.openstreetmap.josm.testutils.annotations.Territories; |
| 52 | 47 | import org.openstreetmap.josm.testutils.annotations.ThreadSync; |
| 53 | 48 | import org.openstreetmap.josm.tools.Logging; |
| 54 | 49 | import org.openstreetmap.josm.tools.Utils; |
| 55 | 50 | |
| | 51 | import jakarta.json.Json; |
| | 52 | import jakarta.json.JsonObject; |
| | 53 | import jakarta.json.JsonReader; |
| | 54 | import mockit.Mock; |
| | 55 | import mockit.MockUp; |
| | 56 | |
| 56 | 57 | /** |
| 57 | 58 | * Test class for {@link ValidatorCLI} |
| 58 | 59 | * @author Taylor Smock |
| 59 | 60 | */ |
| 60 | 61 | @BasicPreferences |
| | 62 | @Territories |
| 61 | 63 | class ValidatorCLITest { |
| 62 | 64 | @RegisterExtension |
| 63 | 65 | ThreadSync.ThreadSyncExtension threadSync = new ThreadSync.ThreadSyncExtension(); |
-
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
diff --git a/test/unit/org/openstreetmap/josm/data/vector/VectorDataSetTest.java b/test/unit/org/openstreetmap/josm/data/vector/VectorDataSetTest.java
|
a
|
b
|
|
| 14 | 14 | import org.awaitility.Durations; |
| 15 | 15 | import org.junit.jupiter.api.BeforeEach; |
| 16 | 16 | import org.junit.jupiter.api.RepeatedTest; |
| 17 | | import org.junit.jupiter.api.extension.RegisterExtension; |
| 18 | 17 | import org.openstreetmap.josm.TestUtils; |
| 19 | 18 | import org.openstreetmap.josm.data.imagery.ImageryInfo; |
| 20 | 19 | import org.openstreetmap.josm.data.imagery.vectortile.mapbox.MVTTile; |
| 21 | 20 | import org.openstreetmap.josm.data.imagery.vectortile.mapbox.MapboxVectorCachedTileLoader; |
| 22 | 21 | import org.openstreetmap.josm.data.imagery.vectortile.mapbox.MapboxVectorTileSource; |
| 23 | 22 | import org.openstreetmap.josm.gui.layer.imagery.MVTLayer; |
| 24 | | import org.openstreetmap.josm.testutils.JOSMTestRules; |
| | 23 | import org.openstreetmap.josm.testutils.annotations.Projection; |
| 25 | 24 | |
| 26 | 25 | /** |
| 27 | 26 | * A test for {@link VectorDataSet} |
| 28 | 27 | */ |
| | 28 | @Projection |
| 29 | 29 | class VectorDataSetTest { |
| 30 | 30 | /** |
| 31 | 31 | * Make some methods available for this test class |
| … |
… |
|
| 63 | 63 | } |
| 64 | 64 | } |
| 65 | 65 | |
| 66 | | @RegisterExtension |
| 67 | | JOSMTestRules rule = new JOSMTestRules().projection(); |
| 68 | | |
| 69 | 66 | /** |
| 70 | 67 | * Load arbitrary tiles |
| 71 | 68 | * @param layer The layer to add the tiles to |
-
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
diff --git a/test/unit/org/openstreetmap/josm/data/vector/VectorNodeTest.java b/test/unit/org/openstreetmap/josm/data/vector/VectorNodeTest.java
|
a
|
b
|
|
| 13 | 13 | import java.util.List; |
| 14 | 14 | |
| 15 | 15 | import org.junit.jupiter.api.Test; |
| 16 | | import org.junit.jupiter.api.extension.RegisterExtension; |
| 17 | 16 | import org.openstreetmap.gui.jmapviewer.interfaces.ICoordinate; |
| 18 | 17 | import org.openstreetmap.josm.data.coor.EastNorth; |
| 19 | 18 | import org.openstreetmap.josm.data.coor.LatLon; |
| … |
… |
|
| 24 | 23 | import org.openstreetmap.josm.data.osm.OsmPrimitiveType; |
| 25 | 24 | import org.openstreetmap.josm.data.osm.visitor.PrimitiveVisitor; |
| 26 | 25 | import org.openstreetmap.josm.data.projection.ProjectionRegistry; |
| 27 | | import org.openstreetmap.josm.testutils.JOSMTestRules; |
| | 26 | import org.openstreetmap.josm.testutils.annotations.Projection; |
| 28 | 27 | |
| 29 | 28 | /** |
| 30 | 29 | * Test class for {@link VectorNode} |
| 31 | 30 | * @author Taylor Smock |
| 32 | 31 | * @since 17862 |
| 33 | 32 | */ |
| | 33 | @Projection |
| 34 | 34 | class VectorNodeTest { |
| 35 | | @RegisterExtension |
| 36 | | JOSMTestRules rule = new JOSMTestRules().projection(); |
| 37 | | |
| 38 | 35 | @Test |
| 39 | 36 | void testLatLon() { |
| 40 | 37 | VectorNode node = new VectorNode("test"); |
-
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
diff --git a/test/unit/org/openstreetmap/josm/data/PreferencesTest.java b/test/unit/org/openstreetmap/josm/data/PreferencesTest.java
|
a
|
b
|
|
| 3 | 3 | |
| 4 | 4 | import static org.junit.jupiter.api.Assertions.assertEquals; |
| 5 | 5 | |
| 6 | | import org.junit.jupiter.api.extension.RegisterExtension; |
| 7 | 6 | import org.junit.jupiter.api.Test; |
| 8 | | import org.openstreetmap.josm.testutils.JOSMTestRules; |
| 9 | | |
| 10 | | import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; |
| | 7 | import org.openstreetmap.josm.testutils.annotations.BasicPreferences; |
| | 8 | import org.openstreetmap.josm.testutils.annotations.OsmApi; |
| 11 | 9 | |
| 12 | 10 | /** |
| 13 | 11 | * Unit tests of {@link Preferences}. |
| 14 | 12 | */ |
| | 13 | @BasicPreferences |
| | 14 | @OsmApi(OsmApi.APIType.FAKE) |
| 15 | 15 | class PreferencesTest { |
| 16 | | |
| 17 | | /** |
| 18 | | * Setup test. |
| 19 | | */ |
| 20 | | @RegisterExtension |
| 21 | | @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") |
| 22 | | public JOSMTestRules test = new JOSMTestRules().preferences().fakeAPI(); |
| 23 | | |
| 24 | 16 | /** |
| 25 | 17 | * Test {@link Preferences#toXML}. |
| 26 | 18 | */ |
-
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
diff --git a/test/unit/org/openstreetmap/josm/gui/datatransfer/OsmTransferHandlerTest.java b/test/unit/org/openstreetmap/josm/gui/datatransfer/OsmTransferHandlerTest.java
|
a
|
b
|
|
| 8 | 8 | import java.util.Collections; |
| 9 | 9 | import java.util.stream.Stream; |
| 10 | 10 | |
| 11 | | import org.junit.jupiter.api.extension.RegisterExtension; |
| 12 | 11 | import org.junit.jupiter.api.Test; |
| 13 | 12 | import org.junit.jupiter.params.ParameterizedTest; |
| 14 | 13 | import org.junit.jupiter.params.provider.Arguments; |
| … |
… |
|
| 25 | 24 | import org.openstreetmap.josm.gui.MainApplication; |
| 26 | 25 | import org.openstreetmap.josm.gui.datatransfer.data.PrimitiveTransferData; |
| 27 | 26 | import org.openstreetmap.josm.gui.layer.OsmDataLayer; |
| 28 | | import org.openstreetmap.josm.testutils.JOSMTestRules; |
| 29 | | |
| 30 | | import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; |
| | 27 | import org.openstreetmap.josm.testutils.annotations.BasicPreferences; |
| | 28 | import org.openstreetmap.josm.testutils.annotations.Main; |
| | 29 | import org.openstreetmap.josm.testutils.annotations.Projection; |
| 31 | 30 | |
| 32 | 31 | /** |
| 33 | 32 | * Unit tests of {@link OsmTransferHandler} class. |
| 34 | 33 | */ |
| | 34 | @BasicPreferences |
| | 35 | @Main |
| | 36 | @Projection |
| 35 | 37 | class OsmTransferHandlerTest { |
| 36 | | /** |
| 37 | | * Prefs to use OSM primitives |
| 38 | | */ |
| 39 | | @RegisterExtension |
| 40 | | @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") |
| 41 | | public JOSMTestRules test = new JOSMTestRules().preferences().projection().main(); |
| 42 | | |
| 43 | 38 | private final OsmTransferHandler transferHandler = new OsmTransferHandler(); |
| 44 | 39 | |
| 45 | 40 | /** |
-
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
diff --git a/test/unit/org/openstreetmap/josm/gui/dialogs/changeset/ChangesetContentPanelTest.java b/test/unit/org/openstreetmap/josm/gui/dialogs/changeset/ChangesetContentPanelTest.java
|
a
|
b
|
|
| 1 | 1 | // License: GPL. For details, see LICENSE file. |
| 2 | 2 | package org.openstreetmap.josm.gui.dialogs.changeset; |
| 3 | 3 | |
| 4 | | import static org.junit.jupiter.api.Assertions.assertNotNull; |
| | 4 | import static org.junit.jupiter.api.Assertions.assertDoesNotThrow; |
| 5 | 5 | |
| 6 | | import org.openstreetmap.josm.testutils.JOSMTestRules; |
| 7 | | |
| 8 | | import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; |
| 9 | 6 | import org.junit.jupiter.api.Test; |
| 10 | | import org.junit.jupiter.api.extension.RegisterExtension; |
| | 7 | import org.openstreetmap.josm.testutils.annotations.BasicPreferences; |
| | 8 | import org.openstreetmap.josm.testutils.annotations.Main; |
| 11 | 9 | |
| 12 | 10 | /** |
| 13 | 11 | * Unit tests of {@link ChangesetContentPanel} class. |
| 14 | 12 | */ |
| | 13 | @BasicPreferences |
| | 14 | @Main |
| 15 | 15 | class ChangesetContentPanelTest { |
| 16 | | |
| 17 | | /** |
| 18 | | * Setup tests |
| 19 | | */ |
| 20 | | @RegisterExtension |
| 21 | | @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") |
| 22 | | public JOSMTestRules test = new JOSMTestRules().preferences().main(); |
| 23 | | |
| 24 | 16 | /** |
| 25 | 17 | * Unit test of {@link ChangesetContentPanel#ChangesetContentPanel}. |
| 26 | 18 | */ |
| 27 | 19 | @Test |
| 28 | 20 | void testChangesetContentPanel() { |
| 29 | | assertNotNull(new ChangesetContentPanel()); |
| | 21 | assertDoesNotThrow(ChangesetContentPanel::new); |
| 30 | 22 | } |
| 31 | 23 | } |
-
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
diff --git a/test/unit/org/openstreetmap/josm/gui/dialogs/layer/LayerVisibilityActionTest.java b/test/unit/org/openstreetmap/josm/gui/dialogs/layer/LayerVisibilityActionTest.java
|
a
|
b
|
|
| 6 | 6 | import static org.junit.jupiter.api.Assertions.assertTrue; |
| 7 | 7 | |
| 8 | 8 | import org.junit.jupiter.api.Test; |
| 9 | | import org.junit.jupiter.api.extension.RegisterExtension; |
| 10 | 9 | import org.openstreetmap.josm.gui.MainApplication; |
| 11 | 10 | import org.openstreetmap.josm.gui.dialogs.LayerListDialog; |
| 12 | 11 | import org.openstreetmap.josm.gui.dialogs.LayerListDialog.LayerListModel; |
| 13 | 12 | import org.openstreetmap.josm.gui.dialogs.layer.LayerVisibilityAction.OpacitySlider; |
| 14 | 13 | import org.openstreetmap.josm.gui.layer.TMSLayer; |
| 15 | 14 | import org.openstreetmap.josm.gui.layer.TMSLayerTest; |
| 16 | | import org.openstreetmap.josm.testutils.JOSMTestRules; |
| 17 | | |
| 18 | | import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; |
| | 15 | import org.openstreetmap.josm.testutils.annotations.BasicPreferences; |
| | 16 | import org.openstreetmap.josm.testutils.annotations.Main; |
| | 17 | import org.openstreetmap.josm.testutils.annotations.Projection; |
| 19 | 18 | |
| 20 | 19 | /** |
| 21 | 20 | * Unit tests of {@link LayerVisibilityAction} class. |
| 22 | 21 | */ |
| | 22 | @BasicPreferences |
| | 23 | @Main |
| | 24 | @Projection |
| 23 | 25 | class LayerVisibilityActionTest { |
| 24 | | /** |
| 25 | | * TMS layer needs prefs. Platform for LayerListDialog shortcuts. |
| 26 | | */ |
| 27 | | @RegisterExtension |
| 28 | | @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") |
| 29 | | public JOSMTestRules test = new JOSMTestRules().preferences().projection().main(); |
| 30 | | |
| 31 | 26 | /** |
| 32 | 27 | * Unit test of {@link LayerVisibilityAction} class. |
| 33 | 28 | */ |
-
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
diff --git a/test/unit/org/openstreetmap/josm/gui/dialogs/properties/PropertiesCellRendererTest.java b/test/unit/org/openstreetmap/josm/gui/dialogs/properties/PropertiesCellRendererTest.java
|
a
|
b
|
|
| 9 | 9 | import javax.swing.JTable; |
| 10 | 10 | import javax.swing.table.DefaultTableModel; |
| 11 | 11 | |
| 12 | | import org.junit.jupiter.api.extension.RegisterExtension; |
| 13 | 12 | import org.junit.jupiter.api.Test; |
| 14 | | import org.openstreetmap.josm.testutils.JOSMTestRules; |
| 15 | | |
| 16 | | import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; |
| | 13 | import org.openstreetmap.josm.testutils.annotations.BasicPreferences; |
| 17 | 14 | |
| 18 | 15 | /** |
| 19 | 16 | * Unit tests of {@link PropertiesCellRenderer} class. |
| 20 | 17 | */ |
| | 18 | @BasicPreferences |
| 21 | 19 | class PropertiesCellRendererTest { |
| 22 | | |
| 23 | | /** |
| 24 | | * Setup test. |
| 25 | | */ |
| 26 | | @RegisterExtension |
| 27 | | @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") |
| 28 | | public JOSMTestRules test = new JOSMTestRules().preferences(); |
| 29 | | |
| 30 | 20 | /** |
| 31 | 21 | * Test of color rendering. |
| 32 | 22 | */ |
-
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
diff --git a/test/unit/org/openstreetmap/josm/gui/dialogs/properties/PropertiesDialogTest.java b/test/unit/org/openstreetmap/josm/gui/dialogs/properties/PropertiesDialogTest.java
|
a
|
b
|
|
| 12 | 12 | import java.util.stream.Stream; |
| 13 | 13 | |
| 14 | 14 | import org.junit.jupiter.api.Test; |
| 15 | | import org.junit.jupiter.api.extension.RegisterExtension; |
| 16 | 15 | import org.junit.jupiter.params.ParameterizedTest; |
| 17 | 16 | import org.junit.jupiter.params.provider.Arguments; |
| 18 | 17 | import org.junit.jupiter.params.provider.MethodSource; |
| … |
… |
|
| 25 | 24 | import org.openstreetmap.josm.gui.NavigatableComponent; |
| 26 | 25 | import org.openstreetmap.josm.gui.PrimitiveHoverListener; |
| 27 | 26 | import org.openstreetmap.josm.gui.layer.OsmDataLayer; |
| 28 | | import org.openstreetmap.josm.testutils.JOSMTestRules; |
| 29 | 27 | import org.openstreetmap.josm.testutils.annotations.BasicPreferences; |
| | 28 | import org.openstreetmap.josm.testutils.annotations.Main; |
| | 29 | import org.openstreetmap.josm.testutils.annotations.Projection; |
| 30 | 30 | import org.openstreetmap.josm.tools.ReflectionUtils; |
| 31 | 31 | |
| 32 | 32 | /** |
| 33 | 33 | * Unit tests of {@link PropertiesDialog} class. |
| 34 | 34 | */ |
| 35 | | @BasicPreferences |
| | 35 | @BasicPreferences(true) |
| | 36 | @Main |
| | 37 | @Projection |
| 36 | 38 | class PropertiesDialogTest { |
| 37 | | @RegisterExtension |
| 38 | | static JOSMTestRules rules = new JOSMTestRules().main().projection(); |
| 39 | 39 | |
| 40 | 40 | private static String createSearchSetting(List<OsmPrimitive> sel, boolean sameType) { |
| 41 | 41 | return PropertiesDialog.createSearchSetting("foo", sel, sameType).text; |
-
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
diff --git a/test/unit/org/openstreetmap/josm/gui/dialogs/relation/actions/AbstractRelationEditorActionTest.java b/test/unit/org/openstreetmap/josm/gui/dialogs/relation/actions/AbstractRelationEditorActionTest.java
|
a
|
b
|
|
| 7 | 7 | |
| 8 | 8 | import org.junit.jupiter.api.BeforeEach; |
| 9 | 9 | import org.junit.jupiter.api.Disabled; |
| 10 | | import org.junit.jupiter.api.extension.RegisterExtension; |
| 11 | 10 | import org.openstreetmap.josm.data.osm.DataSet; |
| 12 | 11 | import org.openstreetmap.josm.data.osm.OsmPrimitive; |
| 13 | 12 | import org.openstreetmap.josm.data.osm.Relation; |
| … |
… |
|
| 22 | 21 | import org.openstreetmap.josm.gui.tagging.TagEditorModel; |
| 23 | 22 | import org.openstreetmap.josm.gui.tagging.ac.AutoCompletingTextField; |
| 24 | 23 | import org.openstreetmap.josm.gui.tagging.presets.TaggingPresetHandler; |
| 25 | | import org.openstreetmap.josm.testutils.JOSMTestRules; |
| 26 | | |
| 27 | | import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; |
| | 24 | import org.openstreetmap.josm.testutils.annotations.BasicPreferences; |
| | 25 | import org.openstreetmap.josm.testutils.annotations.Main; |
| 28 | 26 | |
| 29 | 27 | /** |
| 30 | 28 | * This class provides the basic test environment for relation editor actions. |
| 31 | 29 | * @author Michael Zangl |
| 32 | 30 | */ |
| 33 | 31 | @Disabled |
| | 32 | @BasicPreferences |
| | 33 | @Main |
| 34 | 34 | public abstract class AbstractRelationEditorActionTest { |
| 35 | | /** |
| 36 | | * Platform for tooltips. |
| 37 | | */ |
| 38 | | @RegisterExtension |
| 39 | | @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") |
| 40 | | public JOSMTestRules test = new JOSMTestRules().preferences().main(); |
| 41 | | |
| 42 | 35 | protected OsmDataLayer layer; |
| 43 | 36 | |
| 44 | 37 | private SelectionTableModel selectionTableModel; |
-
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
diff --git a/test/unit/org/openstreetmap/josm/gui/dialogs/relation/sort/RelationSorterTest.java b/test/unit/org/openstreetmap/josm/gui/dialogs/relation/sort/RelationSorterTest.java
|
a
|
b
|
|
| 12 | 12 | |
| 13 | 13 | import org.junit.jupiter.api.BeforeEach; |
| 14 | 14 | import org.junit.jupiter.api.Test; |
| 15 | | import org.junit.jupiter.api.extension.RegisterExtension; |
| 16 | 15 | import org.openstreetmap.josm.data.osm.DataSet; |
| 17 | 16 | import org.openstreetmap.josm.data.osm.Relation; |
| 18 | 17 | import org.openstreetmap.josm.data.osm.RelationMember; |
| 19 | 18 | import org.openstreetmap.josm.gui.progress.NullProgressMonitor; |
| 20 | 19 | import org.openstreetmap.josm.io.IllegalDataException; |
| 21 | 20 | import org.openstreetmap.josm.io.OsmReader; |
| 22 | | import org.openstreetmap.josm.testutils.JOSMTestRules; |
| 23 | | |
| 24 | | import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; |
| | 21 | import org.openstreetmap.josm.testutils.annotations.BasicPreferences; |
| | 22 | import org.openstreetmap.josm.testutils.annotations.Projection; |
| 25 | 23 | |
| 26 | 24 | /** |
| 27 | 25 | * Unit tests of {@link RelationSorter} class. |
| 28 | 26 | */ |
| | 27 | @BasicPreferences |
| | 28 | @Projection |
| 29 | 29 | class RelationSorterTest { |
| 30 | 30 | |
| 31 | 31 | private final RelationSorter sorter = new RelationSorter(); |
| 32 | 32 | private DataSet testDataset; |
| 33 | 33 | |
| 34 | | /** |
| 35 | | * Use Mercator projection |
| 36 | | */ |
| 37 | | @RegisterExtension |
| 38 | | @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") |
| 39 | | public JOSMTestRules test = new JOSMTestRules().preferences().projection(); |
| 40 | | |
| 41 | 34 | /** |
| 42 | 35 | * Load the test data set |
| 43 | 36 | * @throws IllegalDataException if an error was found while parsing the data |
-
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
diff --git a/test/unit/org/openstreetmap/josm/gui/dialogs/relation/sort/WayConnectionTypeCalculatorTest.java b/test/unit/org/openstreetmap/josm/gui/dialogs/relation/sort/WayConnectionTypeCalculatorTest.java
|
a
|
b
|
|
| 17 | 17 | |
| 18 | 18 | import org.junit.jupiter.api.BeforeEach; |
| 19 | 19 | import org.junit.jupiter.api.Test; |
| 20 | | import org.junit.jupiter.api.extension.RegisterExtension; |
| 21 | 20 | import org.openstreetmap.josm.data.osm.DataSet; |
| 22 | 21 | import org.openstreetmap.josm.data.osm.Node; |
| 23 | 22 | import org.openstreetmap.josm.data.osm.OsmPrimitive; |
| … |
… |
|
| 26 | 25 | import org.openstreetmap.josm.gui.progress.NullProgressMonitor; |
| 27 | 26 | import org.openstreetmap.josm.io.IllegalDataException; |
| 28 | 27 | import org.openstreetmap.josm.io.OsmReader; |
| 29 | | import org.openstreetmap.josm.testutils.JOSMTestRules; |
| 30 | | |
| 31 | | import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; |
| | 28 | import org.openstreetmap.josm.testutils.annotations.BasicPreferences; |
| | 29 | import org.openstreetmap.josm.testutils.annotations.Projection; |
| 32 | 30 | |
| 33 | 31 | /** |
| 34 | 32 | * Unit tests of {@link WayConnectionTypeCalculator} class. |
| 35 | 33 | */ |
| | 34 | @BasicPreferences |
| | 35 | @Projection |
| 36 | 36 | class WayConnectionTypeCalculatorTest { |
| 37 | 37 | |
| 38 | 38 | private final RelationSorter sorter = new RelationSorter(); |
| 39 | 39 | private final WayConnectionTypeCalculator wayConnectionTypeCalculator = new WayConnectionTypeCalculator(); |
| 40 | 40 | private DataSet testDataset; |
| 41 | 41 | |
| 42 | | /** |
| 43 | | * Use Mercator projection |
| 44 | | */ |
| 45 | | @RegisterExtension |
| 46 | | @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") |
| 47 | | public JOSMTestRules test = new JOSMTestRules().preferences().projection(); |
| 48 | | |
| 49 | 42 | /** |
| 50 | 43 | * Load the test data set |
| 51 | 44 | * @throws IllegalDataException if an error was found while parsing the data |
-
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
diff --git a/test/unit/org/openstreetmap/josm/gui/dialogs/CommandStackDialogTest.java b/test/unit/org/openstreetmap/josm/gui/dialogs/CommandStackDialogTest.java
|
a
|
b
|
|
| 4 | 4 | import static org.junit.jupiter.api.Assertions.assertFalse; |
| 5 | 5 | import static org.junit.jupiter.api.Assertions.assertTrue; |
| 6 | 6 | |
| 7 | | import org.junit.jupiter.api.extension.RegisterExtension; |
| 8 | 7 | import org.junit.jupiter.api.Test; |
| 9 | 8 | import org.openstreetmap.josm.TestUtils; |
| 10 | 9 | import org.openstreetmap.josm.command.Command; |
| … |
… |
|
| 13 | 12 | import org.openstreetmap.josm.gui.MainApplication; |
| 14 | 13 | import org.openstreetmap.josm.gui.MapFrame; |
| 15 | 14 | import org.openstreetmap.josm.gui.layer.OsmDataLayer; |
| 16 | | import org.openstreetmap.josm.testutils.JOSMTestRules; |
| 17 | | |
| 18 | | import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; |
| | 15 | import org.openstreetmap.josm.testutils.annotations.BasicPreferences; |
| | 16 | import org.openstreetmap.josm.testutils.annotations.Main; |
| | 17 | import org.openstreetmap.josm.testutils.annotations.Projection; |
| 19 | 18 | |
| 20 | 19 | /** |
| 21 | 20 | * Unit tests of {@link CommandStackDialog} class. |
| 22 | 21 | */ |
| | 22 | @BasicPreferences |
| | 23 | @Main |
| | 24 | @Projection |
| 23 | 25 | class CommandStackDialogTest { |
| 24 | | |
| 25 | | /** |
| 26 | | * Setup tests |
| 27 | | */ |
| 28 | | @RegisterExtension |
| 29 | | @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") |
| 30 | | public JOSMTestRules test = new JOSMTestRules().main().projection().preferences(); |
| 31 | | |
| 32 | 26 | /** |
| 33 | 27 | * Unit test of {@link CommandStackDialog} class - empty case. |
| 34 | 28 | */ |
-
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
diff --git a/test/unit/org/openstreetmap/josm/gui/dialogs/FilterDialogTest.java b/test/unit/org/openstreetmap/josm/gui/dialogs/FilterDialogTest.java
|
a
|
b
|
|
| 11 | 11 | |
| 12 | 12 | import javax.swing.AbstractAction; |
| 13 | 13 | |
| 14 | | import org.junit.jupiter.api.extension.RegisterExtension; |
| 15 | 14 | import org.junit.jupiter.params.ParameterizedTest; |
| 16 | 15 | import org.junit.jupiter.params.provider.ValueSource; |
| 17 | 16 | import org.openstreetmap.josm.data.osm.Filter; |
| 18 | | import org.openstreetmap.josm.testutils.JOSMTestRules; |
| 19 | 17 | import org.openstreetmap.josm.testutils.annotations.BasicPreferences; |
| | 18 | import org.openstreetmap.josm.testutils.annotations.Main; |
| 20 | 19 | import org.openstreetmap.josm.tools.ReflectionUtils; |
| 21 | 20 | |
| 22 | 21 | /** |
| 23 | 22 | * Test class for {@link FilterDialog} |
| 24 | 23 | */ |
| 25 | | @BasicPreferences |
| | 24 | @BasicPreferences(true) |
| | 25 | @Main |
| 26 | 26 | class FilterDialogTest { |
| 27 | 27 | private static final List<Filter> FILTERS = Stream.of("type:node", "type:way", "type:relation") |
| 28 | 28 | .map(Filter::readFromString).map(Filter::new).collect(Collectors.toList()); |
| 29 | 29 | |
| 30 | | @RegisterExtension |
| 31 | | static JOSMTestRules josmTestRules = new JOSMTestRules().main(); |
| 32 | | |
| 33 | 30 | @ParameterizedTest |
| 34 | 31 | @ValueSource(ints = {0, 1, 2}) |
| 35 | 32 | void testNonRegression22439(int indexToRemove) throws ReflectiveOperationException { |
-
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
diff --git a/test/unit/org/openstreetmap/josm/gui/dialogs/InspectPrimitiveDialogTest.java b/test/unit/org/openstreetmap/josm/gui/dialogs/InspectPrimitiveDialogTest.java
|
a
|
b
|
|
| 11 | 11 | import org.junit.jupiter.api.AfterEach; |
| 12 | 12 | import org.junit.jupiter.api.BeforeEach; |
| 13 | 13 | import org.junit.jupiter.api.Test; |
| 14 | | import org.junit.jupiter.api.extension.RegisterExtension; |
| 15 | 14 | import org.openstreetmap.josm.data.SystemOfMeasurement; |
| 16 | 15 | import org.openstreetmap.josm.data.coor.LatLon; |
| 17 | 16 | import org.openstreetmap.josm.data.osm.DataSet; |
| … |
… |
|
| 20 | 19 | import org.openstreetmap.josm.data.osm.Way; |
| 21 | 20 | import org.openstreetmap.josm.gui.MainApplication; |
| 22 | 21 | import org.openstreetmap.josm.gui.layer.OsmDataLayer; |
| 23 | | import org.openstreetmap.josm.testutils.JOSMTestRules; |
| 24 | | |
| 25 | | import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; |
| | 22 | import org.openstreetmap.josm.testutils.annotations.Main; |
| | 23 | import org.openstreetmap.josm.testutils.annotations.MapPaintStyles; |
| | 24 | import org.openstreetmap.josm.testutils.annotations.Projection; |
| 26 | 25 | |
| 27 | 26 | /** |
| 28 | 27 | * Unit tests of {@link InspectPrimitiveDialog} class. |
| 29 | 28 | */ |
| | 29 | @Main |
| | 30 | @MapPaintStyles |
| | 31 | @Projection |
| 30 | 32 | class InspectPrimitiveDialogTest { |
| 31 | | |
| 32 | | /** |
| 33 | | * Setup tests |
| 34 | | */ |
| 35 | | @RegisterExtension |
| 36 | | @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") |
| 37 | | static JOSMTestRules test = new JOSMTestRules().main().projection().mapStyles(); |
| 38 | | |
| 39 | 33 | /** |
| 40 | 34 | * Setup test |
| 41 | 35 | */ |
| 42 | 36 | @BeforeEach |
| 43 | 37 | public void setUp() { |
| 44 | 38 | SystemOfMeasurement.PROP_SYSTEM_OF_MEASUREMENT.put("METRIC"); |
| 45 | | |
| 46 | 39 | } |
| 47 | 40 | |
| 48 | 41 | /** |
-
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
diff --git a/test/unit/org/openstreetmap/josm/gui/dialogs/MapPaintDialogTest.java b/test/unit/org/openstreetmap/josm/gui/dialogs/MapPaintDialogTest.java
|
a
|
b
|
|
| 1 | 1 | // License: GPL. For details, see LICENSE file. |
| 2 | 2 | package org.openstreetmap.josm.gui.dialogs; |
| 3 | 3 | |
| 4 | | import org.junit.jupiter.api.extension.RegisterExtension; |
| 5 | 4 | import org.junit.jupiter.api.Test; |
| 6 | 5 | import org.openstreetmap.josm.data.osm.DataSet; |
| 7 | 6 | import org.openstreetmap.josm.gui.MainApplication; |
| 8 | 7 | import org.openstreetmap.josm.gui.layer.OsmDataLayer; |
| 9 | | import org.openstreetmap.josm.testutils.JOSMTestRules; |
| 10 | | |
| 11 | | import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; |
| | 8 | import org.openstreetmap.josm.testutils.annotations.Main; |
| | 9 | import org.openstreetmap.josm.testutils.annotations.Projection; |
| 12 | 10 | |
| 13 | 11 | /** |
| 14 | 12 | * Unit tests of {@link MapPaintDialog} class. |
| 15 | 13 | */ |
| | 14 | @Main |
| | 15 | @Projection |
| 16 | 16 | class MapPaintDialogTest { |
| 17 | | |
| 18 | | /** |
| 19 | | * Setup tests |
| 20 | | */ |
| 21 | | @RegisterExtension |
| 22 | | @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") |
| 23 | | public JOSMTestRules test = new JOSMTestRules().main().projection(); |
| 24 | | |
| 25 | 17 | /** |
| 26 | 18 | * Unit test of {@link MapPaintDialog.InfoAction} class. |
| 27 | 19 | */ |
-
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
diff --git a/test/unit/org/openstreetmap/josm/gui/dialogs/NotesDialogTest.java b/test/unit/org/openstreetmap/josm/gui/dialogs/NotesDialogTest.java
|
a
|
b
|
|
| 17 | 17 | import javax.swing.JList; |
| 18 | 18 | |
| 19 | 19 | import org.junit.jupiter.api.Test; |
| 20 | | import org.junit.jupiter.api.extension.RegisterExtension; |
| 21 | 20 | import org.junit.jupiter.params.ParameterizedTest; |
| 22 | 21 | import org.junit.jupiter.params.provider.Arguments; |
| 23 | 22 | import org.junit.jupiter.params.provider.MethodSource; |
| … |
… |
|
| 35 | 34 | import org.openstreetmap.josm.gui.layer.NoteLayer; |
| 36 | 35 | import org.openstreetmap.josm.gui.widgets.JosmTextField; |
| 37 | 36 | import org.openstreetmap.josm.spi.preferences.Config; |
| 38 | | import org.openstreetmap.josm.testutils.JOSMTestRules; |
| 39 | 37 | import org.openstreetmap.josm.testutils.annotations.BasicPreferences; |
| | 38 | import org.openstreetmap.josm.testutils.annotations.Main; |
| | 39 | import org.openstreetmap.josm.testutils.annotations.Projection; |
| 40 | 40 | import org.openstreetmap.josm.testutils.mockers.ExtendedDialogMocker; |
| 41 | 41 | |
| 42 | 42 | /** |
| 43 | 43 | * Unit tests of {@link NotesDialog} |
| 44 | 44 | */ |
| 45 | 45 | @BasicPreferences |
| | 46 | /* Only needed for {@link #testTicket21558} */ |
| | 47 | @Main |
| | 48 | @Projection |
| 46 | 49 | class NotesDialogTest { |
| 47 | | /** Only needed for {@link #testTicket21558} */ |
| 48 | | @RegisterExtension |
| 49 | | JOSMTestRules rules = new JOSMTestRules().main().projection(); |
| 50 | 50 | private Note createMultiLineNote() { |
| 51 | 51 | Note note = new Note(LatLon.ZERO); |
| 52 | 52 | note.setCreatedAt(Instant.now()); |
-
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
diff --git a/test/unit/org/openstreetmap/josm/gui/help/HelpContentReaderTest.java b/test/unit/org/openstreetmap/josm/gui/help/HelpContentReaderTest.java
|
a
|
b
|
|
| 5 | 5 | import static org.junit.jupiter.api.Assertions.assertThrows; |
| 6 | 6 | |
| 7 | 7 | import org.junit.jupiter.api.Test; |
| 8 | | import org.junit.jupiter.api.extension.RegisterExtension; |
| 9 | | import org.openstreetmap.josm.testutils.JOSMTestRules; |
| 10 | | |
| 11 | | import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; |
| | 8 | import org.junit.jupiter.api.Timeout; |
| 12 | 9 | |
| 13 | 10 | /** |
| 14 | 11 | * Unit tests of {@link HelpContentReader} class. |
| 15 | 12 | */ |
| | 13 | @Timeout(30) |
| 16 | 14 | class HelpContentReaderTest { |
| 17 | | |
| 18 | | /** |
| 19 | | * Setup tests |
| 20 | | */ |
| 21 | | @RegisterExtension |
| 22 | | @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") |
| 23 | | public JOSMTestRules test = new JOSMTestRules().timeout(30000); |
| 24 | | |
| 25 | 15 | /** |
| 26 | 16 | * Unit test of {@link HelpContentReader#fetchHelpTopicContent} - null case. |
| 27 | 17 | */ |
-
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
diff --git a/test/unit/org/openstreetmap/josm/gui/history/HistoryBrowserModelTest.java b/test/unit/org/openstreetmap/josm/gui/history/HistoryBrowserModelTest.java
|
a
|
b
|
|
| 7 | 7 | import static org.junit.jupiter.api.Assertions.assertNull; |
| 8 | 8 | import static org.junit.jupiter.api.Assertions.assertTrue; |
| 9 | 9 | |
| 10 | | import org.junit.jupiter.api.extension.RegisterExtension; |
| | 10 | import java.awt.Color; |
| | 11 | |
| 11 | 12 | import org.junit.jupiter.api.Test; |
| | 13 | import org.junit.jupiter.api.Timeout; |
| 12 | 14 | import org.openstreetmap.josm.data.osm.Node; |
| 13 | 15 | import org.openstreetmap.josm.data.osm.OsmPrimitiveType; |
| 14 | 16 | import org.openstreetmap.josm.data.osm.SimplePrimitiveId; |
| … |
… |
|
| 16 | 18 | import org.openstreetmap.josm.data.osm.history.History; |
| 17 | 19 | import org.openstreetmap.josm.data.osm.history.HistoryDataSet; |
| 18 | 20 | import org.openstreetmap.josm.data.osm.history.HistoryNode; |
| 19 | | import org.openstreetmap.josm.testutils.JOSMTestRules; |
| 20 | | |
| 21 | | import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; |
| 22 | | |
| 23 | | import java.awt.Color; |
| | 21 | import org.openstreetmap.josm.testutils.annotations.BasicPreferences; |
| | 22 | import org.openstreetmap.josm.testutils.annotations.OsmApi; |
| 24 | 23 | |
| 25 | 24 | /** |
| 26 | 25 | * Unit tests of {@link HistoryBrowserModel} class. |
| 27 | 26 | */ |
| | 27 | @BasicPreferences |
| | 28 | @OsmApi(OsmApi.APIType.DEV) |
| | 29 | @Timeout(30) |
| 28 | 30 | class HistoryBrowserModelTest { |
| 29 | | |
| 30 | | /** |
| 31 | | * Setup test. |
| 32 | | */ |
| 33 | | @RegisterExtension |
| 34 | | @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") |
| 35 | | public JOSMTestRules test = new JOSMTestRules().preferences().devAPI().timeout(30000); |
| 36 | | |
| 37 | 31 | /** |
| 38 | 32 | * Test for {@link HistoryBrowserModel#HistoryBrowserModel}. |
| 39 | 33 | */ |
-
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
diff --git a/test/unit/org/openstreetmap/josm/gui/history/HistoryLoadTaskTest.java b/test/unit/org/openstreetmap/josm/gui/history/HistoryLoadTaskTest.java
|
a
|
b
|
|
| 6 | 6 | import java.io.IOException; |
| 7 | 7 | import java.io.InputStream; |
| 8 | 8 | |
| 9 | | import org.junit.jupiter.api.extension.RegisterExtension; |
| 10 | 9 | import org.junit.jupiter.api.Test; |
| | 10 | import org.junit.jupiter.api.Timeout; |
| 11 | 11 | import org.openstreetmap.josm.TestUtils; |
| 12 | 12 | import org.openstreetmap.josm.data.osm.Node; |
| 13 | 13 | import org.openstreetmap.josm.data.osm.OsmPrimitiveType; |
| … |
… |
|
| 21 | 21 | import org.openstreetmap.josm.io.OsmHistoryReader; |
| 22 | 22 | import org.openstreetmap.josm.io.OsmServerHistoryReader; |
| 23 | 23 | import org.openstreetmap.josm.io.OsmTransferException; |
| 24 | | import org.openstreetmap.josm.testutils.JOSMTestRules; |
| | 24 | import org.openstreetmap.josm.testutils.annotations.BasicPreferences; |
| | 25 | import org.openstreetmap.josm.testutils.annotations.OsmApi; |
| 25 | 26 | import org.xml.sax.SAXException; |
| 26 | 27 | |
| 27 | | import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; |
| 28 | | |
| 29 | 28 | /** |
| 30 | 29 | * Unit tests of {@link HistoryLoadTask} class. |
| 31 | 30 | */ |
| | 31 | @BasicPreferences |
| | 32 | @OsmApi(OsmApi.APIType.DEV) |
| | 33 | @Timeout(20) |
| 32 | 34 | class HistoryLoadTaskTest { |
| 33 | | |
| 34 | | /** |
| 35 | | * Setup test. |
| 36 | | */ |
| 37 | | @RegisterExtension |
| 38 | | @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") |
| 39 | | public JOSMTestRules test = new JOSMTestRules().preferences().devAPI().timeout(20000); |
| 40 | | |
| 41 | 35 | /** |
| 42 | 36 | * Unit test of {@link HistoryLoadTask#getLoadingMessage} |
| 43 | 37 | */ |
-
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
diff --git a/test/unit/org/openstreetmap/josm/gui/io/AsynchronousUploadPrimitivesTaskTest.java b/test/unit/org/openstreetmap/josm/gui/io/AsynchronousUploadPrimitivesTaskTest.java
|
a
|
b
|
|
| 12 | 12 | import org.junit.jupiter.api.AfterEach; |
| 13 | 13 | import org.junit.jupiter.api.BeforeEach; |
| 14 | 14 | import org.junit.jupiter.api.Test; |
| 15 | | import org.junit.jupiter.api.extension.RegisterExtension; |
| 16 | 15 | import org.openstreetmap.josm.TestUtils; |
| 17 | 16 | import org.openstreetmap.josm.data.APIDataSet; |
| 18 | 17 | import org.openstreetmap.josm.data.coor.LatLon; |
| … |
… |
|
| 22 | 21 | import org.openstreetmap.josm.data.osm.Way; |
| 23 | 22 | import org.openstreetmap.josm.gui.layer.OsmDataLayer; |
| 24 | 23 | import org.openstreetmap.josm.io.UploadStrategySpecification; |
| 25 | | import org.openstreetmap.josm.testutils.JOSMTestRules; |
| | 24 | import org.openstreetmap.josm.testutils.annotations.AssertionsInEDT; |
| 26 | 25 | import org.openstreetmap.josm.testutils.mockers.JOptionPaneSimpleMocker; |
| 27 | 26 | |
| 28 | | import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; |
| 29 | | |
| 30 | 27 | /** |
| 31 | 28 | * Unit tests of {@link AsynchronousUploadPrimitivesTask}. |
| 32 | 29 | */ |
| | 30 | @AssertionsInEDT |
| 33 | 31 | class AsynchronousUploadPrimitivesTaskTest { |
| 34 | 32 | |
| 35 | 33 | private UploadStrategySpecification strategy; |
| … |
… |
|
| 38 | 36 | private Changeset changeset; |
| 39 | 37 | private AsynchronousUploadPrimitivesTask uploadPrimitivesTask; |
| 40 | 38 | |
| 41 | | /** |
| 42 | | * Setup tests |
| 43 | | */ |
| 44 | | @RegisterExtension |
| 45 | | @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") |
| 46 | | public JOSMTestRules test = new JOSMTestRules().assertionsInEDT(); |
| 47 | | |
| 48 | 39 | /** |
| 49 | 40 | * Bootstrap. |
| 50 | 41 | */ |
-
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
diff --git a/test/unit/org/openstreetmap/josm/gui/io/DownloadOpenChangesetsTaskTest.java b/test/unit/org/openstreetmap/josm/gui/io/DownloadOpenChangesetsTaskTest.java
|
a
|
b
|
|
| 14 | 14 | import javax.swing.JPanel; |
| 15 | 15 | |
| 16 | 16 | import org.junit.jupiter.api.BeforeEach; |
| 17 | | import org.junit.jupiter.api.extension.RegisterExtension; |
| 18 | 17 | import org.junit.jupiter.api.Test; |
| 19 | 18 | import org.openstreetmap.josm.TestUtils; |
| 20 | 19 | import org.openstreetmap.josm.data.UserIdentityManager; |
| 21 | 20 | import org.openstreetmap.josm.gui.oauth.OAuthAuthorizationWizard; |
| 22 | 21 | import org.openstreetmap.josm.spi.preferences.Config; |
| 23 | | import org.openstreetmap.josm.testutils.JOSMTestRules; |
| | 22 | import org.openstreetmap.josm.testutils.annotations.BasicPreferences; |
| | 23 | import org.openstreetmap.josm.testutils.annotations.OsmApi; |
| 24 | 24 | import org.openstreetmap.josm.testutils.mockers.JOptionPaneSimpleMocker; |
| 25 | 25 | import org.openstreetmap.josm.testutils.mockers.WindowMocker; |
| 26 | 26 | import org.openstreetmap.josm.tools.UserCancelException; |
| 27 | 27 | |
| 28 | | import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; |
| 29 | 28 | import mockit.Invocation; |
| 30 | 29 | import mockit.Mock; |
| 31 | 30 | import mockit.MockUp; |
| … |
… |
|
| 33 | 32 | /** |
| 34 | 33 | * Unit tests of {@link DownloadOpenChangesetsTask} class. |
| 35 | 34 | */ |
| | 35 | @BasicPreferences |
| | 36 | @OsmApi(OsmApi.APIType.DEV) |
| 36 | 37 | class DownloadOpenChangesetsTaskTest { |
| 37 | | |
| 38 | | /** |
| 39 | | * Setup tests |
| 40 | | */ |
| 41 | | @RegisterExtension |
| 42 | | @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") |
| 43 | | public JOSMTestRules test = new JOSMTestRules().preferences().devAPI(); |
| 44 | | |
| 45 | 38 | /** |
| 46 | 39 | * OAuth wizard mocker. |
| 47 | 40 | */ |
-
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
diff --git a/test/unit/org/openstreetmap/josm/gui/io/DownloadPrimitivesTaskTest.java b/test/unit/org/openstreetmap/josm/gui/io/DownloadPrimitivesTaskTest.java
|
a
|
b
|
|
| 5 | 5 | import static org.junit.jupiter.api.Assertions.assertNotNull; |
| 6 | 6 | import static org.junit.jupiter.api.Assertions.assertTrue; |
| 7 | 7 | |
| 8 | | import java.util.Arrays; |
| | 8 | import java.util.Collections; |
| 9 | 9 | |
| 10 | | import org.junit.jupiter.api.extension.RegisterExtension; |
| 11 | 10 | import org.junit.jupiter.api.Test; |
| | 11 | import org.junit.jupiter.api.Timeout; |
| 12 | 12 | import org.openstreetmap.josm.data.osm.DataSet; |
| 13 | 13 | import org.openstreetmap.josm.data.osm.OsmPrimitiveType; |
| 14 | 14 | import org.openstreetmap.josm.data.osm.SimplePrimitiveId; |
| 15 | 15 | import org.openstreetmap.josm.gui.layer.OsmDataLayer; |
| 16 | | import org.openstreetmap.josm.testutils.JOSMTestRules; |
| 17 | | |
| 18 | | import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; |
| | 16 | import org.openstreetmap.josm.testutils.annotations.BasicPreferences; |
| | 17 | import org.openstreetmap.josm.testutils.annotations.OsmApi; |
| 19 | 18 | |
| 20 | 19 | /** |
| 21 | 20 | * Unit tests of {@link DownloadPrimitivesTask} class. |
| 22 | 21 | */ |
| | 22 | @BasicPreferences |
| | 23 | @OsmApi(OsmApi.APIType.DEV) |
| | 24 | @Timeout(20) |
| 23 | 25 | class DownloadPrimitivesTaskTest { |
| 24 | | |
| 25 | | /** |
| 26 | | * Setup tests |
| 27 | | */ |
| 28 | | @RegisterExtension |
| 29 | | @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") |
| 30 | | public JOSMTestRules test = new JOSMTestRules().preferences().devAPI().timeout(20000); |
| 31 | | |
| 32 | 26 | /** |
| 33 | 27 | * Test of {@link DownloadPrimitivesTask} class. |
| 34 | 28 | */ |
| … |
… |
|
| 37 | 31 | DataSet ds = new DataSet(); |
| 38 | 32 | assertTrue(ds.allPrimitives().isEmpty()); |
| 39 | 33 | SimplePrimitiveId pid = new SimplePrimitiveId(1, OsmPrimitiveType.NODE); |
| 40 | | new DownloadPrimitivesTask(new OsmDataLayer(ds, "", null), Arrays.asList(pid), true).run(); |
| | 34 | new DownloadPrimitivesTask(new OsmDataLayer(ds, "", null), Collections.singletonList(pid), true).run(); |
| 41 | 35 | assertFalse(ds.allPrimitives().isEmpty()); |
| 42 | 36 | assertNotNull(ds.getPrimitiveById(pid)); |
| 43 | 37 | } |
-
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
diff --git a/test/unit/org/openstreetmap/josm/gui/io/UploadStrategySelectionPanelTest.java b/test/unit/org/openstreetmap/josm/gui/io/UploadStrategySelectionPanelTest.java
|
a
|
b
|
|
| 3 | 3 | |
| 4 | 4 | import static org.junit.jupiter.api.Assertions.assertEquals; |
| 5 | 5 | |
| 6 | | import org.junit.jupiter.api.extension.RegisterExtension; |
| 7 | 6 | import org.junit.jupiter.api.Test; |
| 8 | 7 | import org.openstreetmap.josm.io.UploadStrategy; |
| 9 | 8 | import org.openstreetmap.josm.io.UploadStrategySpecification; |
| 10 | | import org.openstreetmap.josm.testutils.JOSMTestRules; |
| 11 | | |
| 12 | | import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; |
| | 9 | import org.openstreetmap.josm.testutils.annotations.BasicPreferences; |
| | 10 | import org.openstreetmap.josm.testutils.annotations.OsmApi; |
| 13 | 11 | |
| 14 | 12 | /** |
| 15 | 13 | * Unit tests of {@link UploadStrategySelectionPanel} class. |
| 16 | 14 | */ |
| | 15 | @BasicPreferences |
| | 16 | @OsmApi(OsmApi.APIType.DEV) |
| 17 | 17 | class UploadStrategySelectionPanelTest { |
| 18 | | |
| 19 | | /** |
| 20 | | * Setup tests |
| 21 | | */ |
| 22 | | @RegisterExtension |
| 23 | | @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") |
| 24 | | public JOSMTestRules test = new JOSMTestRules().preferences().devAPI(); |
| 25 | | |
| 26 | 18 | /** |
| 27 | 19 | * Test of {@link UploadStrategySelectionPanel#UploadStrategySelectionPanel}. |
| 28 | 20 | */ |
-
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
diff --git a/test/unit/org/openstreetmap/josm/gui/layer/geoimage/GeoImageLayerTest.java b/test/unit/org/openstreetmap/josm/gui/layer/geoimage/GeoImageLayerTest.java
|
a
|
b
|
|
| 5 | 5 | |
| 6 | 6 | import java.util.Collections; |
| 7 | 7 | |
| 8 | | import org.junit.jupiter.api.extension.RegisterExtension; |
| | 8 | import org.junit.jupiter.api.Test; |
| 9 | 9 | import org.openstreetmap.josm.data.osm.DataSet; |
| 10 | 10 | import org.openstreetmap.josm.gui.layer.OsmDataLayer; |
| 11 | | import org.openstreetmap.josm.testutils.JOSMTestRules; |
| 12 | 11 | import org.openstreetmap.josm.testutils.annotations.BasicPreferences; |
| 13 | | |
| 14 | | import org.junit.jupiter.api.Test; |
| | 12 | import org.openstreetmap.josm.testutils.annotations.Main; |
| 15 | 13 | |
| 16 | 14 | /** |
| 17 | 15 | * Unit tests of {@link GeoImageLayer} class. |
| 18 | 16 | */ |
| 19 | 17 | // Basic preferences are needed for OSM primitives |
| 20 | 18 | @BasicPreferences |
| | 19 | @Main |
| 21 | 20 | class GeoImageLayerTest { |
| 22 | | @RegisterExtension |
| 23 | | static JOSMTestRules josmTestRules = new JOSMTestRules().main(); |
| 24 | | |
| 25 | 21 | /** |
| 26 | 22 | * Test that {@link GeoImageLayer#mergeFrom} throws IAE for invalid arguments |
| 27 | 23 | */ |
-
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
diff --git a/test/unit/org/openstreetmap/josm/gui/layer/geoimage/ImagesLoaderTest.java b/test/unit/org/openstreetmap/josm/gui/layer/geoimage/ImagesLoaderTest.java
|
a
|
b
|
|
| 10 | 10 | import java.util.List; |
| 11 | 11 | |
| 12 | 12 | import org.junit.jupiter.api.Test; |
| 13 | | import org.junit.jupiter.api.extension.RegisterExtension; |
| 14 | 13 | import org.openstreetmap.josm.TestUtils; |
| 15 | 14 | import org.openstreetmap.josm.gui.MainApplication; |
| 16 | 15 | import org.openstreetmap.josm.gui.layer.GpxLayer; |
| 17 | 16 | import org.openstreetmap.josm.io.GpxReader; |
| 18 | | import org.openstreetmap.josm.testutils.JOSMTestRules; |
| 19 | | |
| 20 | | import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; |
| | 17 | import org.openstreetmap.josm.testutils.annotations.BasicPreferences; |
| 21 | 18 | |
| 22 | 19 | /** |
| 23 | 20 | * Unit tests of {@link ImagesLoader} class. |
| 24 | 21 | */ |
| | 22 | @BasicPreferences |
| 25 | 23 | class ImagesLoaderTest { |
| 26 | | |
| 27 | | /** |
| 28 | | * We need prefs for this. |
| 29 | | */ |
| 30 | | @RegisterExtension |
| 31 | | @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") |
| 32 | | public JOSMTestRules test = new JOSMTestRules().preferences(); |
| 33 | | |
| 34 | 24 | /** |
| 35 | 25 | * Unit test of {@link ImagesLoader} class. |
| 36 | 26 | * @throws Exception if any error occurs |
-
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
diff --git a/test/unit/org/openstreetmap/josm/gui/layer/imagery/MVTLayerTest.java b/test/unit/org/openstreetmap/josm/gui/layer/imagery/MVTLayerTest.java
|
a
|
b
|
|
| 15 | 15 | import org.awaitility.Durations; |
| 16 | 16 | import org.junit.jupiter.api.BeforeEach; |
| 17 | 17 | import org.junit.jupiter.api.Test; |
| 18 | | import org.junit.jupiter.api.extension.RegisterExtension; |
| 19 | 18 | import org.junit.jupiter.params.ParameterizedTest; |
| 20 | 19 | import org.junit.jupiter.params.provider.ValueSource; |
| 21 | 20 | import org.openstreetmap.gui.jmapviewer.interfaces.TileLoaderListener; |
| … |
… |
|
| 33 | 32 | import org.openstreetmap.josm.data.projection.Projections; |
| 34 | 33 | import org.openstreetmap.josm.gui.MainApplication; |
| 35 | 34 | import org.openstreetmap.josm.testutils.FakeGraphics; |
| 36 | | import org.openstreetmap.josm.testutils.JOSMTestRules; |
| 37 | 35 | import org.openstreetmap.josm.testutils.annotations.BasicPreferences; |
| | 36 | import org.openstreetmap.josm.testutils.annotations.HTTP; |
| | 37 | import org.openstreetmap.josm.testutils.annotations.Main; |
| 38 | 38 | |
| 39 | 39 | /** |
| 40 | 40 | * Test class for {@link MVTLayer} |
| 41 | 41 | */ |
| 42 | 42 | @BasicPreferences |
| | 43 | @HTTP |
| | 44 | @Main |
| | 45 | @org.openstreetmap.josm.testutils.annotations.Projection |
| 43 | 46 | class MVTLayerTest { |
| 44 | | // Needed for setting HTTP factory and the main window/mapview |
| 45 | | @RegisterExtension |
| 46 | | JOSMTestRules josmTestRules = new JOSMTestRules().main().projection(); |
| 47 | | |
| 48 | 47 | MVTLayer testLayer; |
| 49 | 48 | |
| 50 | 49 | @BeforeEach |
| … |
… |
|
| 55 | 54 | } |
| 56 | 55 | |
| 57 | 56 | @Test |
| 58 | | void getTileLoaderClass() { |
| | 57 | void testGetTileLoaderClass() { |
| 59 | 58 | assertEquals(MapboxVectorCachedTileLoader.class, this.testLayer.getTileLoaderClass()); |
| 60 | 59 | } |
| 61 | 60 | |
| 62 | 61 | @Test |
| 63 | | void getCacheName() { |
| | 62 | void testGetCacheName() { |
| 64 | 63 | assertEquals("MVT", this.testLayer.getCacheName()); |
| 65 | 64 | } |
| 66 | 65 | |
| 67 | 66 | @Test |
| 68 | | void getCache() { |
| | 67 | void testGetCache() { |
| 69 | 68 | assertNotNull(MVTLayer.getCache()); |
| 70 | 69 | } |
| 71 | 70 | |
| 72 | 71 | @Test |
| 73 | | void getNativeProjections() { |
| | 72 | void testGetNativeProjections() { |
| 74 | 73 | assertArrayEquals(Collections.singleton(MVTFile.DEFAULT_PROJECTION).toArray(), this.testLayer.getNativeProjections().toArray()); |
| 75 | 74 | } |
| 76 | 75 | |
| … |
… |
|
| 81 | 80 | */ |
| 82 | 81 | @ParameterizedTest |
| 83 | 82 | @ValueSource(strings = {"EPSG:3857" /* WGS 84 */, "EPSG:4326" /* Mercator (default) */, "EPSG:32612" /* UTM 12 N */}) |
| 84 | | void ensureDifferentProjectionsAreFetched(final String projectionCode) throws ReflectiveOperationException { |
| | 83 | void testEnsureDifferentProjectionsAreFetched(final String projectionCode) throws ReflectiveOperationException { |
| 85 | 84 | final Projection originalProjection = ProjectionRegistry.getProjection(); |
| 86 | 85 | try { |
| 87 | 86 | ProjectionRegistry.setProjection(Projections.getProjectionByCode(projectionCode)); |
| … |
… |
|
| 103 | 102 | } |
| 104 | 103 | |
| 105 | 104 | @Test |
| 106 | | void getTileSource() { |
| | 105 | void testGetTileSource() { |
| 107 | 106 | assertEquals(this.testLayer.getInfo().getUrl(), this.testLayer.getTileSource().getBaseUrl()); |
| 108 | 107 | } |
| 109 | 108 | |
| 110 | 109 | @Test |
| 111 | | void createTile() { |
| | 110 | void testCreateTile() { |
| 112 | 111 | assertNotNull(this.testLayer.createTile(this.testLayer.getTileSource(), 3251, 6258, 14)); |
| 113 | 112 | } |
| 114 | 113 | |
| 115 | 114 | @ParameterizedTest |
| 116 | 115 | @ValueSource(booleans = {true, false}) |
| 117 | | void getMenuEntries(final boolean isExpert) { |
| | 116 | void testGetMenuEntries(final boolean isExpert) { |
| 118 | 117 | ExpertToggleAction.getInstance().setExpert(isExpert); |
| 119 | 118 | // For now, just ensure that nothing throws on implementation |
| 120 | 119 | MainApplication.getLayerManager().addLayer(this.testLayer); |
| … |
… |
|
| 122 | 121 | } |
| 123 | 122 | |
| 124 | 123 | @Test |
| 125 | | void getData() { |
| | 124 | void testGetData() { |
| 126 | 125 | assertNotNull(this.testLayer.getData()); |
| 127 | 126 | } |
| 128 | 127 | |
| 129 | 128 | @Test |
| 130 | | void finishedLoading() throws ReflectiveOperationException { |
| | 129 | void testFinishedLoading() throws ReflectiveOperationException { |
| 131 | 130 | final MVTTile mvtTile = (MVTTile) this.testLayer.createTile(this.testLayer.getTileSource(), 3248, 6258, 14); |
| 132 | 131 | final FinishedLoading finishedLoading = new FinishedLoading(); |
| 133 | 132 | mvtTile.addTileLoaderFinisher(finishedLoading); |
-
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
diff --git a/test/unit/org/openstreetmap/josm/gui/layer/markerlayer/ImageMarkerTest.java b/test/unit/org/openstreetmap/josm/gui/layer/markerlayer/ImageMarkerTest.java
|
a
|
b
|
|
| 8 | 8 | import java.net.MalformedURLException; |
| 9 | 9 | |
| 10 | 10 | import org.junit.jupiter.api.Test; |
| 11 | | import org.junit.jupiter.api.extension.RegisterExtension; |
| 12 | 11 | import org.openstreetmap.josm.TestUtils; |
| 13 | 12 | import org.openstreetmap.josm.data.coor.LatLon; |
| 14 | 13 | import org.openstreetmap.josm.data.gpx.GpxData; |
| 15 | 14 | import org.openstreetmap.josm.data.gpx.WayPoint; |
| 16 | | import org.openstreetmap.josm.testutils.JOSMTestRules; |
| 17 | 15 | import org.openstreetmap.josm.testutils.annotations.BasicPreferences; |
| | 16 | import org.openstreetmap.josm.testutils.annotations.Main; |
| 18 | 17 | |
| 19 | 18 | /** |
| 20 | 19 | * Unit tests of {@link ImageMarker} class. |
| 21 | 20 | */ |
| 22 | 21 | @BasicPreferences |
| | 22 | @Main |
| 23 | 23 | class ImageMarkerTest { |
| 24 | | @RegisterExtension |
| 25 | | static JOSMTestRules josmTestRules = new JOSMTestRules().main(); |
| 26 | | |
| 27 | 24 | /** |
| 28 | 25 | * Unit test of {@link ImageMarker#ImageMarker}. |
| 29 | 26 | * @throws MalformedURLException never |
-
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
diff --git a/test/unit/org/openstreetmap/josm/gui/layer/markerlayer/MarkerLayerTest.java b/test/unit/org/openstreetmap/josm/gui/layer/markerlayer/MarkerLayerTest.java
|
a
|
b
|
|
| 6 | 6 | import static org.junit.jupiter.api.Assertions.assertNull; |
| 7 | 7 | import static org.junit.jupiter.api.Assertions.assertTrue; |
| 8 | 8 | |
| 9 | | import java.util.Arrays; |
| | 9 | import java.util.Collections; |
| 10 | 10 | |
| 11 | 11 | import org.junit.jupiter.api.BeforeEach; |
| 12 | 12 | import org.junit.jupiter.api.Test; |
| 13 | | import org.junit.jupiter.api.extension.RegisterExtension; |
| 14 | 13 | import org.openstreetmap.josm.data.coor.LatLon; |
| 15 | 14 | import org.openstreetmap.josm.data.gpx.GpxConstants; |
| 16 | 15 | import org.openstreetmap.josm.data.gpx.GpxData; |
| … |
… |
|
| 21 | 20 | import org.openstreetmap.josm.gui.MapFrame; |
| 22 | 21 | import org.openstreetmap.josm.gui.layer.OsmDataLayer; |
| 23 | 22 | import org.openstreetmap.josm.spi.preferences.Config; |
| 24 | | import org.openstreetmap.josm.testutils.JOSMTestRules; |
| 25 | | |
| 26 | | import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; |
| | 23 | import org.openstreetmap.josm.testutils.annotations.BasicPreferences; |
| | 24 | import org.openstreetmap.josm.testutils.annotations.Main; |
| | 25 | import org.openstreetmap.josm.testutils.annotations.Projection; |
| 27 | 26 | |
| 28 | 27 | /** |
| 29 | 28 | * Unit tests of {@link MarkerLayer} class. |
| 30 | 29 | */ |
| | 30 | @BasicPreferences |
| | 31 | @Main |
| | 32 | @Projection |
| 31 | 33 | class MarkerLayerTest { |
| 32 | | |
| 33 | | /** |
| 34 | | * For creating layers |
| 35 | | */ |
| 36 | | @RegisterExtension |
| 37 | | @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") |
| 38 | | public JOSMTestRules test = new JOSMTestRules().main().preferences().projection(); |
| 39 | | |
| 40 | 34 | /** |
| 41 | 35 | * Setup tests |
| 42 | 36 | */ |
| … |
… |
|
| 62 | 56 | |
| 63 | 57 | GpxData gpx = new GpxData(); |
| 64 | 58 | WayPoint wpt = new WayPoint(LatLon.ZERO); |
| 65 | | wpt.attr.put(GpxConstants.META_LINKS, Arrays.asList(new GpxLink("https://josm.openstreetmap.de"))); |
| | 59 | wpt.attr.put(GpxConstants.META_LINKS, Collections.singletonList(new GpxLink("https://josm.openstreetmap.de"))); |
| 66 | 60 | wpt.getExtensions().add("josm", "offset", "1.0"); |
| 67 | 61 | gpx.waypoints.add(wpt); |
| 68 | 62 | wpt = new WayPoint(LatLon.ZERO); |
-
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
diff --git a/test/unit/org/openstreetmap/josm/gui/layer/AbstractTileSourceLayerTest.java b/test/unit/org/openstreetmap/josm/gui/layer/AbstractTileSourceLayerTest.java
|
a
|
b
|
|
| 1 | 1 | // License: GPL. For details, see LICENSE file. |
| 2 | 2 | package org.openstreetmap.josm.gui.layer; |
| 3 | 3 | |
| | 4 | import static org.junit.jupiter.api.Assertions.assertDoesNotThrow; |
| 4 | 5 | import static org.junit.jupiter.api.Assertions.assertEquals; |
| 5 | 6 | import static org.junit.jupiter.api.Assertions.assertFalse; |
| 6 | 7 | import static org.junit.jupiter.api.Assertions.assertNotNull; |
| … |
… |
|
| 13 | 14 | |
| 14 | 15 | import org.junit.jupiter.api.BeforeEach; |
| 15 | 16 | import org.junit.jupiter.api.Test; |
| 16 | | import org.junit.jupiter.api.extension.RegisterExtension; |
| 17 | 17 | import org.openstreetmap.gui.jmapviewer.Coordinate; |
| 18 | 18 | import org.openstreetmap.gui.jmapviewer.Projected; |
| 19 | 19 | import org.openstreetmap.gui.jmapviewer.Tile; |
| … |
… |
|
| 31 | 31 | import org.openstreetmap.josm.data.osm.DataSet; |
| 32 | 32 | import org.openstreetmap.josm.gui.MainApplication; |
| 33 | 33 | import org.openstreetmap.josm.gui.layer.imagery.ImageryFilterSettings; |
| 34 | | import org.openstreetmap.josm.testutils.JOSMTestRules; |
| 35 | | |
| 36 | | import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; |
| | 34 | import org.openstreetmap.josm.testutils.annotations.Main; |
| | 35 | import org.openstreetmap.josm.testutils.annotations.Projection; |
| 37 | 36 | |
| 38 | 37 | /** |
| 39 | 38 | * Test of the base {@link AbstractTileSourceLayer} class |
| 40 | 39 | */ |
| | 40 | @Projection |
| | 41 | @Main |
| 41 | 42 | class AbstractTileSourceLayerTest { |
| 42 | | |
| 43 | | /** |
| 44 | | * Setup test |
| 45 | | */ |
| 46 | | @RegisterExtension |
| 47 | | @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") |
| 48 | | public JOSMTestRules test = new JOSMTestRules().projection().main(); |
| 49 | | |
| 50 | 43 | private static final class TMSTileStubSource extends AbstractTMSTileSource { |
| 51 | 44 | private TMSTileStubSource() { |
| 52 | 45 | super(new TileSourceInfo()); |
| … |
… |
|
| 202 | 195 | */ |
| 203 | 196 | @Test |
| 204 | 197 | void testTileSourceLayerPopup() { |
| 205 | | assertNotNull(testLayer.new TileSourceLayerPopup(100, 100)); |
| | 198 | assertDoesNotThrow(() -> testLayer.new TileSourceLayerPopup(100, 100)); |
| 206 | 199 | } |
| 207 | 200 | } |
-
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
diff --git a/test/unit/org/openstreetmap/josm/gui/layer/AutosaveTaskTest.java b/test/unit/org/openstreetmap/josm/gui/layer/AutosaveTaskTest.java
|
a
|
b
|
|
| 22 | 22 | |
| 23 | 23 | import org.junit.jupiter.api.BeforeEach; |
| 24 | 24 | import org.junit.jupiter.api.Test; |
| 25 | | import org.junit.jupiter.api.extension.RegisterExtension; |
| 26 | 25 | import org.openstreetmap.josm.data.coor.LatLon; |
| 27 | 26 | import org.openstreetmap.josm.data.osm.DataSet; |
| 28 | 27 | import org.openstreetmap.josm.data.osm.Node; |
| 29 | 28 | import org.openstreetmap.josm.gui.MainApplication; |
| 30 | 29 | import org.openstreetmap.josm.gui.layer.AutosaveTask.AutosaveLayerInfo; |
| 31 | | import org.openstreetmap.josm.testutils.JOSMTestRules; |
| 32 | | |
| 33 | | import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; |
| | 30 | import org.openstreetmap.josm.testutils.annotations.BasicPreferences; |
| | 31 | import org.openstreetmap.josm.testutils.annotations.Projection; |
| 34 | 32 | |
| 35 | 33 | /** |
| 36 | 34 | * Unit tests for class {@link AutosaveTask}. |
| 37 | 35 | */ |
| | 36 | /* We need preferences and a home directory for this. */ |
| | 37 | @BasicPreferences |
| | 38 | @Projection |
| 38 | 39 | class AutosaveTaskTest { |
| 39 | | /** |
| 40 | | * We need preferences and a home directory for this. |
| 41 | | */ |
| 42 | | @RegisterExtension |
| 43 | | @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") |
| 44 | | public JOSMTestRules test = new JOSMTestRules().preferences().projection(); |
| 45 | | |
| 46 | 40 | private AutosaveTask task; |
| 47 | 41 | |
| 48 | 42 | /** |
-
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
diff --git a/test/unit/org/openstreetmap/josm/gui/layer/LayerTest.java b/test/unit/org/openstreetmap/josm/gui/layer/LayerTest.java
|
a
|
b
|
|
| 11 | 11 | |
| 12 | 12 | import org.junit.jupiter.api.BeforeEach; |
| 13 | 13 | import org.junit.jupiter.api.Test; |
| 14 | | import org.junit.jupiter.api.extension.RegisterExtension; |
| 15 | 14 | import org.openstreetmap.josm.data.projection.ProjectionRegistry; |
| 16 | | import org.openstreetmap.josm.testutils.JOSMTestRules; |
| 17 | | |
| 18 | | import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; |
| | 15 | import org.openstreetmap.josm.testutils.annotations.BasicPreferences; |
| | 16 | import org.openstreetmap.josm.testutils.annotations.Projection; |
| 19 | 17 | |
| 20 | 18 | /** |
| 21 | 19 | * Test of the base {@link Layer} class |
| 22 | 20 | * @author Michael Zangl |
| 23 | 21 | */ |
| | 22 | @BasicPreferences |
| | 23 | /* We need projection */ |
| | 24 | @Projection |
| 24 | 25 | class LayerTest { |
| 25 | | /** |
| 26 | | * We need projection |
| 27 | | */ |
| 28 | | @RegisterExtension |
| 29 | | @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") |
| 30 | | public JOSMTestRules test = new JOSMTestRules().preferences().projection(); |
| 31 | | |
| 32 | 26 | private Layer testLayer; |
| 33 | 27 | |
| 34 | 28 | /** |
-
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
diff --git a/test/unit/org/openstreetmap/josm/gui/layer/OsmDataLayerTest.java b/test/unit/org/openstreetmap/josm/gui/layer/OsmDataLayerTest.java
|
a
|
b
|
|
| 15 | 15 | |
| 16 | 16 | import org.junit.jupiter.api.BeforeEach; |
| 17 | 17 | import org.junit.jupiter.api.Test; |
| 18 | | import org.junit.jupiter.api.extension.RegisterExtension; |
| 19 | 18 | import org.openstreetmap.josm.TestUtils; |
| 20 | 19 | import org.openstreetmap.josm.actions.ExpertToggleAction; |
| 21 | 20 | import org.openstreetmap.josm.data.Bounds; |
| … |
… |
|
| 34 | 33 | import org.openstreetmap.josm.gui.datatransfer.ClipboardUtils; |
| 35 | 34 | import org.openstreetmap.josm.io.IllegalDataException; |
| 36 | 35 | import org.openstreetmap.josm.io.OsmReader; |
| 37 | | import org.openstreetmap.josm.testutils.JOSMTestRules; |
| | 36 | import org.openstreetmap.josm.testutils.annotations.Main; |
| | 37 | import org.openstreetmap.josm.testutils.annotations.Projection; |
| 38 | 38 | import org.openstreetmap.josm.testutils.mockers.ExtendedDialogMocker; |
| 39 | 39 | import org.openstreetmap.josm.tools.Logging; |
| 40 | 40 | |
| 41 | | import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; |
| 42 | | |
| 43 | 41 | /** |
| 44 | 42 | * Unit tests of {@link OsmDataLayer} class. |
| 45 | 43 | */ |
| | 44 | @Main |
| | 45 | @Projection |
| 46 | 46 | class OsmDataLayerTest { |
| 47 | | |
| 48 | | /** |
| 49 | | * Setup tests |
| 50 | | */ |
| 51 | | @RegisterExtension |
| 52 | | @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") |
| 53 | | public JOSMTestRules test = new JOSMTestRules().projection().main(); |
| 54 | | |
| 55 | 47 | private DataSet ds; |
| 56 | 48 | private OsmDataLayer layer; |
| 57 | 49 | |
-
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
diff --git a/test/unit/org/openstreetmap/josm/gui/layer/TMSLayerTest.java b/test/unit/org/openstreetmap/josm/gui/layer/TMSLayerTest.java
|
a
|
b
|
|
| 4 | 4 | import static org.junit.jupiter.api.Assertions.assertEquals; |
| 5 | 5 | |
| 6 | 6 | import org.junit.jupiter.api.Test; |
| 7 | | import org.junit.jupiter.api.extension.RegisterExtension; |
| 8 | 7 | import org.openstreetmap.josm.data.imagery.ImageryInfo; |
| 9 | 8 | import org.openstreetmap.josm.data.imagery.ImageryInfo.ImageryType; |
| 10 | 9 | import org.openstreetmap.josm.gui.MainApplication; |
| 11 | | import org.openstreetmap.josm.testutils.JOSMTestRules; |
| 12 | | |
| 13 | | import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; |
| | 10 | import org.openstreetmap.josm.testutils.annotations.Main; |
| | 11 | import org.openstreetmap.josm.testutils.annotations.Projection; |
| 14 | 12 | |
| 15 | 13 | /** |
| 16 | 14 | * Unit tests of {@link TMSLayer} class. |
| 17 | 15 | */ |
| | 16 | @Main |
| | 17 | @Projection |
| 18 | 18 | public class TMSLayerTest { |
| 19 | | |
| 20 | | /** |
| 21 | | * Setup tests |
| 22 | | */ |
| 23 | | @RegisterExtension |
| 24 | | @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") |
| 25 | | public JOSMTestRules test = new JOSMTestRules().main().projection(); |
| 26 | | |
| 27 | 19 | /** |
| 28 | 20 | * Creates a new TMS layer. |
| 29 | 21 | * @return a new TMS layer |
-
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
diff --git a/test/unit/org/openstreetmap/josm/gui/layer/ValidatorLayerTest.java b/test/unit/org/openstreetmap/josm/gui/layer/ValidatorLayerTest.java
|
a
|
b
|
|
| 6 | 6 | import static org.junit.jupiter.api.Assertions.assertNotNull; |
| 7 | 7 | import static org.junit.jupiter.api.Assertions.assertTrue; |
| 8 | 8 | |
| 9 | | import org.junit.jupiter.api.extension.RegisterExtension; |
| 10 | 9 | import org.junit.jupiter.api.Test; |
| 11 | 10 | import org.openstreetmap.josm.data.osm.DataSet; |
| 12 | 11 | import org.openstreetmap.josm.gui.MainApplication; |
| 13 | | import org.openstreetmap.josm.testutils.JOSMTestRules; |
| 14 | | |
| 15 | | import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; |
| | 12 | import org.openstreetmap.josm.testutils.annotations.Main; |
| | 13 | import org.openstreetmap.josm.testutils.annotations.Projection; |
| 16 | 14 | |
| 17 | 15 | /** |
| 18 | 16 | * Unit tests of {@link ValidatorLayer} class. |
| 19 | 17 | */ |
| | 18 | @Main |
| | 19 | @Projection |
| 20 | 20 | class ValidatorLayerTest { |
| 21 | | |
| 22 | | /** |
| 23 | | * Setup tests |
| 24 | | */ |
| 25 | | @RegisterExtension |
| 26 | | @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") |
| 27 | | public JOSMTestRules test = new JOSMTestRules().projection().main(); |
| 28 | | |
| 29 | 21 | /** |
| 30 | 22 | * Unit test of {@link ValidatorLayer#ValidatorLayer}. |
| 31 | 23 | */ |
-
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
diff --git a/test/unit/org/openstreetmap/josm/gui/layer/WMSLayerTest.java b/test/unit/org/openstreetmap/josm/gui/layer/WMSLayerTest.java
|
a
|
b
|
|
| 5 | 5 | import static org.junit.jupiter.api.Assertions.assertThrows; |
| 6 | 6 | |
| 7 | 7 | import org.junit.jupiter.api.Test; |
| 8 | | import org.junit.jupiter.api.extension.RegisterExtension; |
| 9 | 8 | import org.openstreetmap.josm.data.imagery.ImageryInfo; |
| 10 | 9 | import org.openstreetmap.josm.data.imagery.ImageryInfo.ImageryType; |
| 11 | 10 | import org.openstreetmap.josm.gui.MainApplication; |
| 12 | | import org.openstreetmap.josm.testutils.JOSMTestRules; |
| 13 | | |
| 14 | | import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; |
| | 11 | import org.openstreetmap.josm.testutils.annotations.Main; |
| | 12 | import org.openstreetmap.josm.testutils.annotations.Projection; |
| 15 | 13 | |
| 16 | 14 | /** |
| 17 | 15 | * Unit tests of {@link WMSLayer} class. |
| 18 | 16 | */ |
| | 17 | @Main |
| | 18 | @Projection |
| 19 | 19 | class WMSLayerTest { |
| 20 | | |
| 21 | | /** |
| 22 | | * Setup tests |
| 23 | | */ |
| 24 | | @RegisterExtension |
| 25 | | @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") |
| 26 | | public JOSMTestRules test = new JOSMTestRules().main().projection(); |
| 27 | | |
| 28 | 20 | /** |
| 29 | 21 | * Unit test of {@link WMSLayer#WMSLayer}. |
| 30 | 22 | */ |
| … |
… |
|
| 45 | 37 | */ |
| 46 | 38 | @Test |
| 47 | 39 | void testTicket13828() { |
| 48 | | assertThrows(IllegalArgumentException.class, () -> new WMSLayer(new ImageryInfo("TMS", "http://203.159.29.217/try2/{z}/{x}/{y}.png"))); |
| | 40 | final ImageryInfo info = new ImageryInfo("TMS", "http://203.159.29.217/try2/{z}/{x}/{y}.png"); |
| | 41 | assertThrows(IllegalArgumentException.class, () -> new WMSLayer(info)); |
| 49 | 42 | } |
| 50 | 43 | } |
-
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
diff --git a/test/unit/org/openstreetmap/josm/gui/layer/WMTSLayerTest.java b/test/unit/org/openstreetmap/josm/gui/layer/WMTSLayerTest.java
|
a
|
b
|
|
| 3 | 3 | |
| 4 | 4 | import static org.junit.jupiter.api.Assertions.assertEquals; |
| 5 | 5 | |
| 6 | | import org.junit.jupiter.api.extension.RegisterExtension; |
| 7 | 6 | import org.junit.jupiter.api.Test; |
| | 7 | import org.junit.jupiter.api.Timeout; |
| 8 | 8 | import org.openstreetmap.josm.data.imagery.ImageryInfo; |
| 9 | 9 | import org.openstreetmap.josm.data.imagery.ImageryInfo.ImageryType; |
| 10 | | import org.openstreetmap.josm.testutils.JOSMTestRules; |
| 11 | | |
| 12 | | import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; |
| | 10 | import org.openstreetmap.josm.testutils.annotations.BasicPreferences; |
| 13 | 11 | |
| 14 | 12 | /** |
| 15 | 13 | * Unit tests of {@link WMTSLayer} class. |
| 16 | 14 | */ |
| | 15 | @BasicPreferences |
| | 16 | @Timeout(20) |
| 17 | 17 | class WMTSLayerTest { |
| 18 | | |
| 19 | | /** |
| 20 | | * Setup tests |
| 21 | | */ |
| 22 | | @RegisterExtension |
| 23 | | @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") |
| 24 | | public JOSMTestRules test = new JOSMTestRules().preferences().timeout(20000); |
| 25 | | |
| 26 | 18 | /** |
| 27 | 19 | * Unit test of {@link WMTSLayer#WMTSLayer}. |
| 28 | 20 | */ |
-
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
diff --git a/test/unit/org/openstreetmap/josm/gui/mappaint/mapcss/ChildOrParentSelectorTest.java b/test/unit/org/openstreetmap/josm/gui/mappaint/mapcss/ChildOrParentSelectorTest.java
|
a
|
b
|
|
| 12 | 12 | import org.junit.jupiter.api.BeforeEach; |
| 13 | 13 | import org.junit.jupiter.api.Disabled; |
| 14 | 14 | import org.junit.jupiter.api.Test; |
| 15 | | import org.junit.jupiter.api.extension.RegisterExtension; |
| 16 | 15 | import org.openstreetmap.josm.data.coor.LatLon; |
| 17 | 16 | import org.openstreetmap.josm.data.osm.DataSet; |
| 18 | 17 | import org.openstreetmap.josm.data.osm.Node; |
| … |
… |
|
| 24 | 23 | import org.openstreetmap.josm.gui.mappaint.MultiCascade; |
| 25 | 24 | import org.openstreetmap.josm.gui.mappaint.mapcss.Selector.ChildOrParentSelector; |
| 26 | 25 | import org.openstreetmap.josm.io.OsmReader; |
| 27 | | import org.openstreetmap.josm.testutils.JOSMTestRules; |
| 28 | | |
| 29 | | import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; |
| | 26 | import org.openstreetmap.josm.testutils.annotations.Projection; |
| 30 | 27 | |
| 31 | 28 | /** |
| 32 | 29 | * Unit tests of {@link ChildOrParentSelector}. |
| 33 | 30 | */ |
| | 31 | @Projection |
| 34 | 32 | class ChildOrParentSelectorTest { |
| 35 | 33 | |
| 36 | 34 | private DataSet ds; |
| 37 | 35 | |
| 38 | | /** |
| 39 | | * Setup rule |
| 40 | | */ |
| 41 | | @RegisterExtension |
| 42 | | @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") |
| 43 | | public JOSMTestRules test = new JOSMTestRules().projection(); |
| 44 | | |
| 45 | 36 | /** |
| 46 | 37 | * Setup test |
| 47 | 38 | */ |
-
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
diff --git a/test/unit/org/openstreetmap/josm/gui/mappaint/mapcss/FunctionsTest.java b/test/unit/org/openstreetmap/josm/gui/mappaint/mapcss/FunctionsTest.java
|
a
|
b
|
|
| 32 | 32 | import org.openstreetmap.josm.gui.util.GuiHelper; |
| 33 | 33 | import org.openstreetmap.josm.spi.preferences.Config; |
| 34 | 34 | import org.openstreetmap.josm.testutils.annotations.BasicPreferences; |
| | 35 | import org.openstreetmap.josm.testutils.annotations.MapPaintStyles; |
| 35 | 36 | import org.openstreetmap.josm.testutils.annotations.Projection; |
| 36 | 37 | |
| 37 | 38 | /** |
| … |
… |
|
| 171 | 172 | /** |
| 172 | 173 | * Unit test of {@link Functions#JOSM_pref}, color handling |
| 173 | 174 | */ |
| | 175 | @MapPaintStyles |
| 174 | 176 | @Test |
| 175 | 177 | void testPrefColor() { |
| 176 | 178 | String key = "Functions.JOSM_pref"; |
-
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
diff --git a/test/unit/org/openstreetmap/josm/gui/mappaint/mapcss/KeyConditionTest.java b/test/unit/org/openstreetmap/josm/gui/mappaint/mapcss/KeyConditionTest.java
|
a
|
b
|
|
| 16 | 16 | |
| 17 | 17 | import org.junit.jupiter.api.BeforeEach; |
| 18 | 18 | import org.junit.jupiter.api.Test; |
| 19 | | import org.junit.jupiter.api.extension.RegisterExtension; |
| 20 | 19 | import org.junit.jupiter.params.ParameterizedTest; |
| 21 | 20 | import org.junit.jupiter.params.provider.EnumSource; |
| 22 | 21 | import org.openstreetmap.josm.TestUtils; |
| … |
… |
|
| 31 | 30 | import org.openstreetmap.josm.gui.mappaint.mapcss.Condition.Context; |
| 32 | 31 | import org.openstreetmap.josm.gui.mappaint.mapcss.ConditionFactory.KeyCondition; |
| 33 | 32 | import org.openstreetmap.josm.gui.mappaint.mapcss.ConditionFactory.KeyMatchType; |
| 34 | | import org.openstreetmap.josm.testutils.JOSMTestRules; |
| | 33 | import org.openstreetmap.josm.testutils.annotations.Projection; |
| 35 | 34 | import org.openstreetmap.josm.tools.Logging; |
| 36 | 35 | |
| 37 | | import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; |
| 38 | | |
| 39 | 36 | /** |
| 40 | 37 | * Unit tests of {@link KeyCondition}. |
| 41 | 38 | */ |
| | 39 | @Projection |
| 42 | 40 | class KeyConditionTest { |
| 43 | 41 | |
| 44 | 42 | private DataSet ds; |
| 45 | 43 | |
| 46 | | /** |
| 47 | | * Setup rule |
| 48 | | */ |
| 49 | | @RegisterExtension |
| 50 | | @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") |
| 51 | | public JOSMTestRules test = new JOSMTestRules().projection(); |
| 52 | | |
| 53 | 44 | /** |
| 54 | 45 | * Setup test |
| 55 | 46 | */ |
| … |
… |
|
| 165 | 156 | * Ensure that we are accounting for all necessary {@link ConditionFactory.KeyMatchType} are accounted for. |
| 166 | 157 | * If this fails, and the key should not be fully matched against (i.e., it is a regex), please modify |
| 167 | 158 | * {@link MapCSSRuleIndex#findAnyRequiredKey}. |
| 168 | | * |
| | 159 | * <p> |
| 169 | 160 | * Non-regression test for JOSM #22073. |
| 170 | 161 | */ |
| 171 | 162 | @ParameterizedTest |
-
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
diff --git a/test/unit/org/openstreetmap/josm/gui/mappaint/mapcss/KeyValueConditionTest.java b/test/unit/org/openstreetmap/josm/gui/mappaint/mapcss/KeyValueConditionTest.java
|
a
|
b
|
|
| 9 | 9 | |
| 10 | 10 | import org.junit.jupiter.api.BeforeEach; |
| 11 | 11 | import org.junit.jupiter.api.Test; |
| 12 | | import org.junit.jupiter.api.extension.RegisterExtension; |
| 13 | 12 | import org.openstreetmap.josm.data.coor.LatLon; |
| 14 | 13 | import org.openstreetmap.josm.data.osm.DataSet; |
| 15 | 14 | import org.openstreetmap.josm.data.osm.Node; |
| … |
… |
|
| 21 | 20 | import org.openstreetmap.josm.gui.mappaint.mapcss.ConditionFactory.KeyValueCondition; |
| 22 | 21 | import org.openstreetmap.josm.gui.mappaint.mapcss.ConditionFactory.Op; |
| 23 | 22 | import org.openstreetmap.josm.gui.mappaint.mapcss.parsergen.MapCSSParser; |
| 24 | | import org.openstreetmap.josm.testutils.JOSMTestRules; |
| | 23 | import org.openstreetmap.josm.testutils.annotations.Projection; |
| 25 | 24 | import org.openstreetmap.josm.tools.Logging; |
| 26 | 25 | |
| 27 | | import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; |
| 28 | | |
| 29 | 26 | /** |
| 30 | 27 | * Unit tests of {@link KeyValueCondition}. |
| 31 | 28 | */ |
| | 29 | @Projection |
| 32 | 30 | class KeyValueConditionTest { |
| 33 | 31 | |
| 34 | 32 | private DataSet ds; |
| 35 | 33 | |
| 36 | | /** |
| 37 | | * Setup rule |
| 38 | | */ |
| 39 | | @RegisterExtension |
| 40 | | @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") |
| 41 | | public JOSMTestRules test = new JOSMTestRules().projection(); |
| 42 | | |
| 43 | 34 | /** |
| 44 | 35 | * Setup test |
| 45 | 36 | */ |
-
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
diff --git a/test/unit/org/openstreetmap/josm/gui/mappaint/mapcss/MapCSSParserTest.java b/test/unit/org/openstreetmap/josm/gui/mappaint/mapcss/MapCSSParserTest.java
|
a
|
b
|
|
| 17 | 17 | import java.util.regex.Pattern; |
| 18 | 18 | |
| 19 | 19 | import org.junit.jupiter.api.Test; |
| 20 | | import org.junit.jupiter.api.extension.RegisterExtension; |
| 21 | 20 | import org.junit.jupiter.params.ParameterizedTest; |
| 22 | 21 | import org.junit.jupiter.params.provider.ValueSource; |
| 23 | 22 | import org.openstreetmap.josm.TestUtils; |
| … |
… |
|
| 42 | 41 | import org.openstreetmap.josm.gui.mappaint.mapcss.Selector.ChildOrParentSelector; |
| 43 | 42 | import org.openstreetmap.josm.gui.mappaint.mapcss.parsergen.MapCSSParser; |
| 44 | 43 | import org.openstreetmap.josm.gui.mappaint.mapcss.parsergen.ParseException; |
| 45 | | import org.openstreetmap.josm.testutils.JOSMTestRules; |
| | 44 | import org.openstreetmap.josm.testutils.annotations.Projection; |
| 46 | 45 | import org.openstreetmap.josm.tools.ColorHelper; |
| 47 | 46 | |
| 48 | | import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; |
| 49 | | |
| 50 | 47 | /** |
| 51 | 48 | * Unit tests of {@link MapCSSParser}. |
| 52 | 49 | */ |
| | 50 | @Projection |
| 53 | 51 | class MapCSSParserTest { |
| 54 | 52 | |
| 55 | 53 | protected static Environment getEnvironment(String key, String value) { |
| … |
… |
|
| 60 | 58 | return new MapCSSParser(new StringReader(stringToParse)); |
| 61 | 59 | } |
| 62 | 60 | |
| 63 | | /** |
| 64 | | * Setup rule |
| 65 | | */ |
| 66 | | @RegisterExtension |
| 67 | | @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") |
| 68 | | public JOSMTestRules test = new JOSMTestRules().projection(); |
| 69 | | |
| 70 | 61 | @Test |
| 71 | 62 | void testDeclarations() throws Exception { |
| 72 | 63 | getParser("{ opacity: 0.5; color: rgb(1.0, 0.0, 0.0); }").declaration(); |
-
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
diff --git a/test/unit/org/openstreetmap/josm/gui/mappaint/mapcss/ParsingLinkSelectorTest.java b/test/unit/org/openstreetmap/josm/gui/mappaint/mapcss/ParsingLinkSelectorTest.java
|
a
|
b
|
|
| 3 | 3 | |
| 4 | 4 | import static org.junit.jupiter.api.Assertions.assertEquals; |
| 5 | 5 | |
| 6 | | import org.junit.jupiter.api.extension.RegisterExtension; |
| 7 | 6 | import org.junit.jupiter.api.Test; |
| 8 | | import org.openstreetmap.josm.testutils.JOSMTestRules; |
| 9 | | |
| 10 | | import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; |
| | 7 | import org.openstreetmap.josm.testutils.annotations.Projection; |
| 11 | 8 | |
| 12 | 9 | /** |
| 13 | 10 | * Unit tests of {@code ParsingLinkSelector}. |
| 14 | 11 | */ |
| | 12 | @Projection |
| 15 | 13 | class ParsingLinkSelectorTest { |
| 16 | | |
| 17 | | /** |
| 18 | | * Setup rule |
| 19 | | */ |
| 20 | | @RegisterExtension |
| 21 | | @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") |
| 22 | | public JOSMTestRules test = new JOSMTestRules().projection(); |
| 23 | | |
| 24 | 14 | @Test |
| 25 | | public void parseEmptyChildSelector() { |
| | 15 | void testParseEmptyChildSelector() { |
| 26 | 16 | String css = "relation > way {}"; |
| 27 | 17 | MapCSSStyleSource source = new MapCSSStyleSource(css); |
| 28 | 18 | source.loadStyleSource(); |
| … |
… |
|
| 30 | 20 | } |
| 31 | 21 | |
| 32 | 22 | @Test |
| 33 | | public void parseEmptyParentSelector() { |
| | 23 | void testParseEmptyParentSelector() { |
| 34 | 24 | String css = "way < relation {}"; |
| 35 | 25 | MapCSSStyleSource source = new MapCSSStyleSource(css); |
| 36 | 26 | source.loadStyleSource(); |
| … |
… |
|
| 38 | 28 | } |
| 39 | 29 | |
| 40 | 30 | @Test |
| 41 | | public void parseChildSelectorWithKeyValueCondition() { |
| | 31 | void testParseChildSelectorWithKeyValueCondition() { |
| 42 | 32 | String css = "relation >[role=\"my_role\"] way {}"; |
| 43 | 33 | MapCSSStyleSource source = new MapCSSStyleSource(css); |
| 44 | 34 | source.loadStyleSource(); |
| … |
… |
|
| 46 | 36 | } |
| 47 | 37 | |
| 48 | 38 | @Test |
| 49 | | public void parseChildSelectorWithKeyCondition() { |
| | 39 | void testParseChildSelectorWithKeyCondition() { |
| 50 | 40 | String css = "relation >[\"my_role\"] way{}"; |
| 51 | 41 | MapCSSStyleSource source = new MapCSSStyleSource(css); |
| 52 | 42 | source.loadStyleSource(); |
-
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
diff --git a/test/unit/org/openstreetmap/josm/gui/preferences/advanced/ExportProfileActionTest.java b/test/unit/org/openstreetmap/josm/gui/preferences/advanced/ExportProfileActionTest.java
|
a
|
b
|
|
| 5 | 5 | |
| 6 | 6 | import javax.swing.JOptionPane; |
| 7 | 7 | |
| 8 | | import org.junit.jupiter.api.extension.RegisterExtension; |
| 9 | 8 | import org.junit.jupiter.api.Test; |
| 10 | 9 | import org.openstreetmap.josm.TestUtils; |
| 11 | 10 | import org.openstreetmap.josm.data.Preferences; |
| 12 | | import org.openstreetmap.josm.testutils.JOSMTestRules; |
| | 11 | import org.openstreetmap.josm.testutils.annotations.AssertionsInEDT; |
| | 12 | import org.openstreetmap.josm.testutils.annotations.BasicPreferences; |
| 13 | 13 | import org.openstreetmap.josm.testutils.mockers.JOptionPaneSimpleMocker; |
| 14 | 14 | |
| 15 | | import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; |
| 16 | | |
| 17 | 15 | /** |
| 18 | 16 | * Unit tests of {@link ExportProfileAction} class. |
| 19 | 17 | */ |
| | 18 | @AssertionsInEDT |
| | 19 | @BasicPreferences |
| 20 | 20 | class ExportProfileActionTest { |
| 21 | | /** |
| 22 | | * Setup tests |
| 23 | | */ |
| 24 | | @RegisterExtension |
| 25 | | @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") |
| 26 | | public JOSMTestRules test = new JOSMTestRules().preferences().assertionsInEDT(); |
| 27 | | |
| 28 | 21 | /** |
| 29 | 22 | * Unit test of {@link ExportProfileAction#actionPerformed}. |
| 30 | 23 | */ |
-
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
diff --git a/test/unit/org/openstreetmap/josm/gui/preferences/advanced/PreferencesTableTest.java b/test/unit/org/openstreetmap/josm/gui/preferences/advanced/PreferencesTableTest.java
|
a
|
b
|
|
| 6 | 6 | import static org.junit.jupiter.api.Assertions.assertNull; |
| 7 | 7 | import static org.junit.jupiter.api.Assertions.assertTrue; |
| 8 | 8 | |
| 9 | | import java.util.Arrays; |
| | 9 | import java.util.Collections; |
| 10 | 10 | |
| 11 | 11 | import javax.swing.JOptionPane; |
| 12 | 12 | |
| 13 | | import org.junit.jupiter.api.extension.RegisterExtension; |
| 14 | 13 | import org.junit.jupiter.api.Test; |
| 15 | 14 | import org.openstreetmap.josm.TestUtils; |
| 16 | 15 | import org.openstreetmap.josm.gui.ExtendedDialog; |
| 17 | 16 | import org.openstreetmap.josm.gui.preferences.advanced.PreferencesTable.AllSettingsTableModel; |
| 18 | 17 | import org.openstreetmap.josm.spi.preferences.StringSetting; |
| 19 | | import org.openstreetmap.josm.testutils.JOSMTestRules; |
| | 18 | import org.openstreetmap.josm.testutils.annotations.AssertionsInEDT; |
| | 19 | import org.openstreetmap.josm.testutils.annotations.BasicPreferences; |
| 20 | 20 | import org.openstreetmap.josm.testutils.mockers.ExtendedDialogMocker; |
| 21 | 21 | import org.openstreetmap.josm.testutils.mockers.JOptionPaneSimpleMocker; |
| 22 | 22 | |
| 23 | | import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; |
| 24 | | |
| 25 | 23 | /** |
| 26 | 24 | * Unit tests of {@link PreferencesTable} class. |
| 27 | 25 | */ |
| | 26 | @AssertionsInEDT |
| | 27 | @BasicPreferences |
| 28 | 28 | class PreferencesTableTest { |
| 29 | | /** |
| 30 | | * Setup tests |
| 31 | | */ |
| 32 | | @RegisterExtension |
| 33 | | @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") |
| 34 | | public JOSMTestRules test = new JOSMTestRules().preferences().assertionsInEDT(); |
| 35 | | |
| 36 | 29 | private static PrefEntry newPrefEntry(String value) { |
| 37 | 30 | StringSetting val = new StringSetting(value); |
| 38 | 31 | StringSetting def = new StringSetting("defaultValue"); |
| … |
… |
|
| 40 | 33 | } |
| 41 | 34 | |
| 42 | 35 | private static PreferencesTable newTable() { |
| 43 | | return new PreferencesTable(Arrays.asList(newPrefEntry("value"))); |
| | 36 | return new PreferencesTable(Collections.singletonList(newPrefEntry("value"))); |
| 44 | 37 | } |
| 45 | 38 | |
| 46 | 39 | /** |
-
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
diff --git a/test/unit/org/openstreetmap/josm/gui/preferences/imagery/ImageryPreferenceTest.java b/test/unit/org/openstreetmap/josm/gui/preferences/imagery/ImageryPreferenceTest.java
|
a
|
b
|
|
| 4 | 4 | import static org.junit.jupiter.api.Assertions.assertNotNull; |
| 5 | 5 | |
| 6 | 6 | import java.io.File; |
| 7 | | import java.util.Arrays; |
| | 7 | import java.util.Collections; |
| 8 | 8 | |
| 9 | | import org.junit.jupiter.api.extension.RegisterExtension; |
| 10 | 9 | import org.junit.jupiter.api.Test; |
| 11 | 10 | import org.openstreetmap.josm.TestUtils; |
| 12 | 11 | import org.openstreetmap.josm.gui.preferences.PreferencesTestUtils; |
| 13 | 12 | import org.openstreetmap.josm.spi.preferences.Config; |
| 14 | | import org.openstreetmap.josm.testutils.JOSMTestRules; |
| 15 | | |
| 16 | | import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; |
| | 13 | import org.openstreetmap.josm.testutils.annotations.Main; |
| 17 | 14 | |
| 18 | 15 | /** |
| 19 | 16 | * Unit tests of {@link ImageryPreference} class. |
| 20 | 17 | */ |
| | 18 | @Main |
| 21 | 19 | class ImageryPreferenceTest { |
| 22 | | |
| 23 | | /** |
| 24 | | * Setup tests |
| 25 | | */ |
| 26 | | @RegisterExtension |
| 27 | | @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") |
| 28 | | public JOSMTestRules test = new JOSMTestRules().main(); |
| 29 | | |
| 30 | 20 | /** |
| 31 | 21 | * Unit test of {@link ImageryPreference#ImageryPreference}. |
| 32 | 22 | */ |
| … |
… |
|
| 41 | 31 | @Test |
| 42 | 32 | void testAddGui() { |
| 43 | 33 | String fileUrl = new File(TestUtils.getTestDataRoot()+"__files/imagery/maps.xml").toURI().toString(); |
| 44 | | Config.getPref().putList("imagery.layers.sites", Arrays.asList(fileUrl)); |
| | 34 | Config.getPref().putList("imagery.layers.sites", Collections.singletonList(fileUrl)); |
| 45 | 35 | PreferencesTestUtils.doTestPreferenceSettingAddGui(new ImageryPreference.Factory(), null); |
| 46 | 36 | } |
| 47 | 37 | } |
-
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
diff --git a/test/unit/org/openstreetmap/josm/gui/preferences/imagery/ImageryPreferenceTestIT.java b/test/unit/org/openstreetmap/josm/gui/preferences/imagery/ImageryPreferenceTestIT.java
|
a
|
b
|
|
| 28 | 28 | import org.apache.commons.jcs3.access.CacheAccess; |
| 29 | 29 | import org.junit.jupiter.api.AfterAll; |
| 30 | 30 | import org.junit.jupiter.api.BeforeAll; |
| | 31 | import org.junit.jupiter.api.Disabled; |
| 31 | 32 | import org.junit.jupiter.api.extension.RegisterExtension; |
| 32 | 33 | import org.junit.jupiter.api.parallel.Execution; |
| 33 | 34 | import org.junit.jupiter.api.parallel.ExecutionMode; |
| … |
… |
|
| 434 | 435 | @Execution(ExecutionMode.CONCURRENT) |
| 435 | 436 | @ParameterizedTest(name = "{0}") |
| 436 | 437 | @MethodSource("data") |
| | 438 | @Disabled("Takes a long time") |
| 437 | 439 | void testImageryEntryValidity(String id, ImageryInfo info) { |
| 438 | 440 | checkEntry(info); |
| 439 | 441 | assertTrue(errors.isEmpty(), format(id, errors)); |
-
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
diff --git a/test/unit/org/openstreetmap/josm/gui/preferences/plugin/PluginPreferenceTest.java b/test/unit/org/openstreetmap/josm/gui/preferences/plugin/PluginPreferenceTest.java
|
a
|
b
|
|
| 5 | 5 | import static org.junit.jupiter.api.Assertions.assertNotNull; |
| 6 | 6 | |
| 7 | 7 | import java.io.File; |
| 8 | | import java.util.Arrays; |
| 9 | 8 | import java.util.Collection; |
| 10 | 9 | import java.util.Collections; |
| 11 | 10 | |
| 12 | 11 | import org.junit.jupiter.api.Test; |
| 13 | | import org.junit.jupiter.api.extension.RegisterExtension; |
| 14 | 12 | import org.openstreetmap.josm.TestUtils; |
| 15 | 13 | import org.openstreetmap.josm.gui.preferences.PreferencesTestUtils; |
| 16 | 14 | import org.openstreetmap.josm.gui.progress.NullProgressMonitor; |
| 17 | 15 | import org.openstreetmap.josm.plugins.PluginDownloadTask; |
| 18 | 16 | import org.openstreetmap.josm.plugins.PluginException; |
| 19 | 17 | import org.openstreetmap.josm.plugins.PluginInformation; |
| 20 | | import org.openstreetmap.josm.testutils.JOSMTestRules; |
| | 18 | import org.openstreetmap.josm.testutils.annotations.AssertionsInEDT; |
| | 19 | import org.openstreetmap.josm.testutils.annotations.BasicPreferences; |
| 21 | 20 | import org.openstreetmap.josm.testutils.mockers.HelpAwareOptionPaneMocker; |
| 22 | 21 | |
| 23 | | import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; |
| 24 | | |
| 25 | 22 | /** |
| 26 | 23 | * Unit tests of {@link PluginPreference} class. |
| 27 | 24 | */ |
| | 25 | @AssertionsInEDT |
| | 26 | @BasicPreferences |
| 28 | 27 | public class PluginPreferenceTest { |
| 29 | | /** |
| 30 | | * Setup test. |
| 31 | | */ |
| 32 | | @RegisterExtension |
| 33 | | @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") |
| 34 | | public JOSMTestRules test = new JOSMTestRules().preferences().assertionsInEDT(); |
| 35 | | |
| 36 | 28 | /** |
| 37 | 29 | * Unit test of {@link PluginPreference#PluginPreference}. |
| 38 | 30 | */ |
| … |
… |
|
| 59 | 51 | void testBuildDownloadSummary() throws Exception { |
| 60 | 52 | final PluginInformation dummy = getDummyPluginInformation(); |
| 61 | 53 | assertEquals("", PluginPreference.buildDownloadSummary( |
| 62 | | new PluginDownloadTask(NullProgressMonitor.INSTANCE, Collections.<PluginInformation>emptyList(), ""))); |
| | 54 | new PluginDownloadTask(NullProgressMonitor.INSTANCE, Collections.emptyList(), ""))); |
| 63 | 55 | assertEquals("", PluginPreference.buildDownloadSummary( |
| 64 | | new PluginDownloadTask(NullProgressMonitor.INSTANCE, Arrays.asList(dummy), ""))); |
| | 56 | new PluginDownloadTask(NullProgressMonitor.INSTANCE, Collections.singletonList(dummy), ""))); |
| 65 | 57 | assertEquals("The following plugin has been downloaded <strong>successfully</strong>:<ul><li>dummy_plugin (31772)</li></ul>"+ |
| 66 | 58 | "Downloading the following plugin has <strong>failed</strong>:<ul><li>dummy_plugin</li></ul>"+ |
| 67 | 59 | "<br>Error message(untranslated): test", |
| 68 | 60 | PluginPreference.buildDownloadSummary( |
| 69 | | new PluginDownloadTask(NullProgressMonitor.INSTANCE, Arrays.asList(dummy), "") { |
| | 61 | new PluginDownloadTask(NullProgressMonitor.INSTANCE, Collections.singletonList(dummy), "") { |
| 70 | 62 | @Override |
| 71 | 63 | public Collection<PluginInformation> getFailedPlugins() { |
| 72 | 64 | return Collections.singleton(dummy); |
-
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
diff --git a/test/unit/org/openstreetmap/josm/gui/tagging/presets/items/CheckTest.java b/test/unit/org/openstreetmap/josm/gui/tagging/presets/items/CheckTest.java
|
a
|
b
|
|
| 6 | 6 | |
| 7 | 7 | import javax.swing.JPanel; |
| 8 | 8 | |
| 9 | | import org.junit.jupiter.api.extension.RegisterExtension; |
| 10 | 9 | import org.junit.jupiter.api.Test; |
| 11 | 10 | import org.openstreetmap.josm.gui.tagging.presets.TaggingPresetItemGuiSupport; |
| 12 | | import org.openstreetmap.josm.testutils.JOSMTestRules; |
| 13 | | |
| 14 | | import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; |
| | 11 | import org.openstreetmap.josm.testutils.annotations.Main; |
| 15 | 12 | |
| 16 | 13 | /** |
| 17 | 14 | * Unit tests of {@link Check} class. |
| 18 | 15 | */ |
| | 16 | @Main |
| 19 | 17 | class CheckTest { |
| 20 | | |
| 21 | | /** |
| 22 | | * Setup test. |
| 23 | | */ |
| 24 | | @RegisterExtension |
| 25 | | @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") |
| 26 | | public JOSMTestRules test = new JOSMTestRules().main(); |
| 27 | | |
| 28 | 18 | /** |
| 29 | 19 | * Unit test for {@link Check#addToPanel}. |
| 30 | 20 | */ |
-
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
diff --git a/test/unit/org/openstreetmap/josm/gui/tagging/presets/items/ComboTest.java b/test/unit/org/openstreetmap/josm/gui/tagging/presets/items/ComboTest.java
|
a
|
b
|
|
| 9 | 9 | import javax.swing.JPanel; |
| 10 | 10 | |
| 11 | 11 | import org.junit.jupiter.api.Test; |
| 12 | | import org.junit.jupiter.api.extension.RegisterExtension; |
| 13 | 12 | import org.openstreetmap.josm.data.osm.OsmPrimitive; |
| 14 | 13 | import org.openstreetmap.josm.data.osm.OsmUtils; |
| 15 | 14 | import org.openstreetmap.josm.gui.tagging.presets.TaggingPresetItemGuiSupport; |
| 16 | | import org.openstreetmap.josm.testutils.JOSMTestRules; |
| 17 | | |
| 18 | | import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; |
| | 15 | import org.openstreetmap.josm.testutils.annotations.BasicPreferences; |
| | 16 | import org.openstreetmap.josm.testutils.annotations.I18n; |
| | 17 | import org.openstreetmap.josm.testutils.annotations.Main; |
| 19 | 18 | |
| 20 | 19 | /** |
| 21 | 20 | * Unit tests of {@link Combo} class. |
| 22 | 21 | */ |
| | 22 | @BasicPreferences |
| | 23 | @I18n("de") |
| | 24 | @Main |
| 23 | 25 | class ComboTest { |
| 24 | | |
| 25 | | /** |
| 26 | | * Setup test. |
| 27 | | */ |
| 28 | | @RegisterExtension |
| 29 | | @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") |
| 30 | | public JOSMTestRules test = new JOSMTestRules().preferences().main().i18n("de"); |
| 31 | | |
| 32 | 26 | /** |
| 33 | 27 | * Unit test for {@link Combo#addToPanel}. |
| 34 | 28 | */ |
-
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
diff --git a/test/unit/org/openstreetmap/josm/gui/tagging/presets/items/MultiSelectTest.java b/test/unit/org/openstreetmap/josm/gui/tagging/presets/items/MultiSelectTest.java
|
a
|
b
|
|
| 8 | 8 | |
| 9 | 9 | import org.junit.jupiter.api.Test; |
| 10 | 10 | import org.openstreetmap.josm.gui.tagging.presets.TaggingPresetItemGuiSupport; |
| | 11 | import org.openstreetmap.josm.testutils.annotations.Main; |
| 11 | 12 | |
| 12 | 13 | /** |
| 13 | 14 | * Unit tests of {@link MultiSelect} class. |
| 14 | 15 | */ |
| | 16 | @Main |
| 15 | 17 | class MultiSelectTest { |
| 16 | 18 | /** |
| 17 | 19 | * Unit test for {@link MultiSelect#addToPanel}. |
-
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
diff --git a/test/unit/org/openstreetmap/josm/gui/tagging/presets/items/PresetLinkTest.java b/test/unit/org/openstreetmap/josm/gui/tagging/presets/items/PresetLinkTest.java
|
a
|
b
|
|
| 7 | 7 | |
| 8 | 8 | import javax.swing.JPanel; |
| 9 | 9 | |
| 10 | | import org.junit.jupiter.api.extension.RegisterExtension; |
| 11 | 10 | import org.junit.jupiter.api.Test; |
| 12 | 11 | import org.openstreetmap.josm.gui.tagging.presets.TaggingPresetItemGuiSupport; |
| 13 | | import org.openstreetmap.josm.testutils.JOSMTestRules; |
| 14 | | |
| 15 | | import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; |
| | 12 | import org.openstreetmap.josm.testutils.annotations.TaggingPresets; |
| 16 | 13 | |
| 17 | 14 | /** |
| 18 | 15 | * Unit tests of {@link PresetLink} class. |
| 19 | 16 | */ |
| | 17 | @TaggingPresets |
| 20 | 18 | class PresetLinkTest { |
| 21 | | |
| 22 | | /** |
| 23 | | * Setup test. |
| 24 | | */ |
| 25 | | @RegisterExtension |
| 26 | | @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") |
| 27 | | public JOSMTestRules rule = new JOSMTestRules().presets(); |
| 28 | | |
| 29 | 19 | /** |
| 30 | 20 | * Unit test for {@link PresetLink#addToPanel}. |
| 31 | 21 | */ |
-
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
diff --git a/test/unit/org/openstreetmap/josm/gui/tagging/presets/items/TextTest.java b/test/unit/org/openstreetmap/josm/gui/tagging/presets/items/TextTest.java
|
a
|
b
|
|
| 6 | 6 | |
| 7 | 7 | import javax.swing.JPanel; |
| 8 | 8 | |
| 9 | | import org.junit.jupiter.api.extension.RegisterExtension; |
| 10 | 9 | import org.junit.jupiter.api.Test; |
| 11 | 10 | import org.openstreetmap.josm.gui.tagging.presets.TaggingPresetItemGuiSupport; |
| 12 | | import org.openstreetmap.josm.testutils.JOSMTestRules; |
| 13 | | |
| 14 | | import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; |
| | 11 | import org.openstreetmap.josm.testutils.annotations.Main; |
| 15 | 12 | |
| 16 | 13 | /** |
| 17 | 14 | * Unit tests of {@link Text} class. |
| 18 | 15 | */ |
| | 16 | @Main |
| 19 | 17 | class TextTest { |
| 20 | | |
| 21 | | /** |
| 22 | | * Setup test. |
| 23 | | */ |
| 24 | | @RegisterExtension |
| 25 | | @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") |
| 26 | | public JOSMTestRules test = new JOSMTestRules().main(); |
| 27 | | |
| 28 | 18 | /** |
| 29 | 19 | * Unit test for {@link Text#addToPanel}. |
| 30 | 20 | */ |
-
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
diff --git a/test/unit/org/openstreetmap/josm/gui/tagging/presets/TaggingPresetReaderTest.java b/test/unit/org/openstreetmap/josm/gui/tagging/presets/TaggingPresetReaderTest.java
|
a
|
b
|
|
| 77 | 77 | * @throws IOException if any I/O error occurs |
| 78 | 78 | */ |
| 79 | 79 | @Test |
| 80 | | void testReadDefaulPresets() throws SAXException, IOException { |
| | 80 | void testReadDefaultPresets() throws SAXException, IOException { |
| 81 | 81 | String presetfile = "resource://data/defaultpresets.xml"; |
| 82 | 82 | final Collection<TaggingPreset> presets = TaggingPresetReader.readAll(presetfile, true); |
| 83 | 83 | assertTrue(presets.size() > 0, "Default presets are empty"); |
-
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
diff --git a/test/unit/org/openstreetmap/josm/gui/tagging/presets/TaggingPresetsTest.java b/test/unit/org/openstreetmap/josm/gui/tagging/presets/TaggingPresetsTest.java
|
a
|
b
|
|
| 14 | 14 | import javax.swing.JMenu; |
| 15 | 15 | import javax.swing.JSeparator; |
| 16 | 16 | |
| 17 | | import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; |
| 18 | | import net.trajano.commons.testing.UtilityClassTestUtil; |
| 19 | 17 | import org.junit.jupiter.api.Test; |
| 20 | | import org.junit.jupiter.api.extension.RegisterExtension; |
| 21 | 18 | import org.junit.jupiter.params.ParameterizedTest; |
| 22 | 19 | import org.junit.jupiter.params.provider.ValueSource; |
| 23 | 20 | import org.openstreetmap.josm.actions.PreferencesAction; |
| 24 | 21 | import org.openstreetmap.josm.gui.MainApplication; |
| 25 | 22 | import org.openstreetmap.josm.gui.MainMenu; |
| 26 | | import org.openstreetmap.josm.testutils.JOSMTestRules; |
| | 23 | import org.openstreetmap.josm.testutils.annotations.Main; |
| 27 | 24 | import org.openstreetmap.josm.tools.Logging; |
| 28 | 25 | |
| | 26 | import net.trajano.commons.testing.UtilityClassTestUtil; |
| | 27 | |
| 29 | 28 | /** |
| 30 | 29 | * Unit tests of {@link TaggingPresets} class. |
| 31 | 30 | */ |
| | 31 | @Main |
| 32 | 32 | public class TaggingPresetsTest { |
| 33 | | |
| 34 | | /** |
| 35 | | * Setup rule |
| 36 | | */ |
| 37 | | @RegisterExtension |
| 38 | | @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") |
| 39 | | public JOSMTestRules test = new JOSMTestRules().main(); |
| 40 | | |
| 41 | 33 | /** |
| 42 | 34 | * Tests that {@code TaggingPresets} satisfies utility class criteria. |
| 43 | 35 | * @throws ReflectiveOperationException if an error occurs |
-
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
diff --git a/test/unit/org/openstreetmap/josm/gui/tagging/presets/TaggingPresetValidationTest.java b/test/unit/org/openstreetmap/josm/gui/tagging/presets/TaggingPresetValidationTest.java
|
a
|
b
|
|
| 4 | 4 | import static org.junit.jupiter.api.Assertions.assertEquals; |
| 5 | 5 | import static org.junit.jupiter.api.Assertions.assertTrue; |
| 6 | 6 | |
| 7 | | import java.util.Arrays; |
| 8 | | import java.util.Locale; |
| | 7 | import java.util.Collections; |
| 9 | 8 | |
| 10 | 9 | import javax.swing.JLabel; |
| 11 | 10 | |
| 12 | 11 | import org.junit.jupiter.api.BeforeEach; |
| 13 | 12 | import org.junit.jupiter.api.Test; |
| 14 | | import org.junit.jupiter.api.extension.RegisterExtension; |
| 15 | 13 | import org.openstreetmap.josm.data.osm.DataSet; |
| 16 | 14 | import org.openstreetmap.josm.data.osm.OsmPrimitive; |
| 17 | 15 | import org.openstreetmap.josm.data.osm.OsmUtils; |
| 18 | 16 | import org.openstreetmap.josm.data.osm.Tag; |
| 19 | 17 | import org.openstreetmap.josm.data.validation.OsmValidator; |
| 20 | | import org.openstreetmap.josm.testutils.JOSMTestRules; |
| 21 | | |
| 22 | | import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; |
| | 18 | import org.openstreetmap.josm.testutils.annotations.I18n; |
| | 19 | import org.openstreetmap.josm.testutils.annotations.Projection; |
| 23 | 20 | |
| 24 | 21 | /** |
| 25 | 22 | * Unit tests for {@code TaggingPresetValidation} |
| 26 | 23 | */ |
| | 24 | @Projection |
| | 25 | @I18n |
| 27 | 26 | class TaggingPresetValidationTest { |
| 28 | | |
| 29 | | /** |
| 30 | | * Setup test. |
| 31 | | */ |
| 32 | | @RegisterExtension |
| 33 | | @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") |
| 34 | | public JOSMTestRules rule = new JOSMTestRules().projection(); |
| 35 | | |
| 36 | 27 | @BeforeEach |
| 37 | 28 | void setUp() { |
| 38 | | Locale.setDefault(Locale.ENGLISH); |
| 39 | 29 | OsmValidator.initialize(); |
| 40 | 30 | } |
| 41 | 31 | |
| … |
… |
|
| 68 | 58 | void testApplyChangedTags() { |
| 69 | 59 | OsmPrimitive primitive = OsmUtils.createPrimitive("way incline=10m width=1mm opening_hours=\"Mo-Fr 8-10\""); |
| 70 | 60 | new DataSet(primitive); |
| 71 | | OsmPrimitive clone = TaggingPresetValidation.applyChangedTags(primitive, Arrays.asList(new Tag("incline", "20m"))); |
| | 61 | OsmPrimitive clone = TaggingPresetValidation.applyChangedTags(primitive, Collections.singletonList(new Tag("incline", "20m"))); |
| 72 | 62 | assertEquals("20m", clone.get("incline")); |
| 73 | 63 | assertEquals("1mm", clone.get("width")); |
| 74 | 64 | } |
-
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
diff --git a/test/unit/org/openstreetmap/josm/gui/MapScalerTest.java b/test/unit/org/openstreetmap/josm/gui/MapScalerTest.java
|
a
|
b
|
|
| 7 | 7 | |
| 8 | 8 | import java.awt.Color; |
| 9 | 9 | |
| 10 | | import org.junit.jupiter.api.extension.RegisterExtension; |
| 11 | 10 | import org.junit.jupiter.api.Test; |
| 12 | 11 | import org.openstreetmap.josm.TestUtils; |
| 13 | 12 | import org.openstreetmap.josm.data.osm.DataSet; |
| 14 | 13 | import org.openstreetmap.josm.gui.MapScaler.AccessibleMapScaler; |
| 15 | 14 | import org.openstreetmap.josm.gui.layer.OsmDataLayer; |
| 16 | | import org.openstreetmap.josm.testutils.JOSMTestRules; |
| 17 | | |
| 18 | | import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; |
| | 15 | import org.openstreetmap.josm.testutils.annotations.Main; |
| | 16 | import org.openstreetmap.josm.testutils.annotations.Projection; |
| 19 | 17 | |
| 20 | 18 | /** |
| 21 | 19 | * Unit tests of {@link MapScaler} class. |
| 22 | 20 | */ |
| | 21 | @Main |
| | 22 | @Projection |
| 23 | 23 | class MapScalerTest { |
| 24 | | |
| 25 | | /** |
| 26 | | * Setup tests |
| 27 | | */ |
| 28 | | @RegisterExtension |
| 29 | | @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") |
| 30 | | public JOSMTestRules test = new JOSMTestRules().main().projection(); |
| 31 | | |
| 32 | 24 | /** |
| 33 | 25 | * Unit test of {@link MapScaler#MapScaler}. |
| 34 | 26 | */ |
-
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
diff --git a/test/unit/org/openstreetmap/josm/gui/MapViewStateTest.java b/test/unit/org/openstreetmap/josm/gui/MapViewStateTest.java
|
a
|
b
|
|
| 8 | 8 | import java.util.Arrays; |
| 9 | 9 | import java.util.function.Function; |
| 10 | 10 | |
| 11 | | import org.junit.jupiter.api.BeforeAll; |
| 12 | 11 | import org.junit.jupiter.api.BeforeEach; |
| 13 | 12 | import org.junit.jupiter.api.Test; |
| 14 | | import org.openstreetmap.josm.JOSMFixture; |
| 15 | 13 | import org.openstreetmap.josm.data.coor.EastNorth; |
| 16 | 14 | import org.openstreetmap.josm.data.coor.LatLon; |
| 17 | 15 | import org.openstreetmap.josm.data.projection.ProjectionRegistry; |
| 18 | 16 | import org.openstreetmap.josm.gui.MapViewState.MapViewPoint; |
| 19 | 17 | import org.openstreetmap.josm.gui.MapViewState.MapViewRectangle; |
| | 18 | import org.openstreetmap.josm.testutils.annotations.Projection; |
| 20 | 19 | |
| 21 | 20 | /** |
| 22 | 21 | * Test {@link MapViewState} |
| 23 | 22 | * @author Michael Zangl |
| 24 | 23 | */ |
| | 24 | @Projection |
| 25 | 25 | class MapViewStateTest { |
| 26 | 26 | |
| 27 | 27 | private static final int WIDTH = 301; |
| 28 | 28 | private static final int HEIGHT = 200; |
| 29 | 29 | private MapViewState state; |
| 30 | 30 | |
| 31 | | /** |
| 32 | | * Setup test. |
| 33 | | */ |
| 34 | | @BeforeAll |
| 35 | | public static void setUpBeforeClass() { |
| 36 | | JOSMFixture.createUnitTestFixture().init(); |
| 37 | | } |
| 38 | | |
| 39 | 31 | /** |
| 40 | 32 | * Create the default state. |
| 41 | 33 | */ |
-
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
diff --git a/test/unit/org/openstreetmap/josm/gui/NavigatableComponentTest.java b/test/unit/org/openstreetmap/josm/gui/NavigatableComponentTest.java
|
a
|
b
|
|
| 21 | 21 | import org.hamcrest.Matcher; |
| 22 | 22 | import org.junit.jupiter.api.BeforeEach; |
| 23 | 23 | import org.junit.jupiter.api.Test; |
| 24 | | import org.junit.jupiter.api.extension.RegisterExtension; |
| 25 | 24 | import org.openstreetmap.josm.data.Bounds; |
| 26 | 25 | import org.openstreetmap.josm.data.ProjectionBounds; |
| 27 | 26 | import org.openstreetmap.josm.data.coor.EastNorth; |
| … |
… |
|
| 31 | 30 | import org.openstreetmap.josm.data.projection.ProjectionRegistry; |
| 32 | 31 | import org.openstreetmap.josm.gui.layer.OsmDataLayer; |
| 33 | 32 | import org.openstreetmap.josm.gui.util.GuiHelper; |
| 34 | | import org.openstreetmap.josm.testutils.JOSMTestRules; |
| 35 | | |
| 36 | | import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; |
| | 33 | import org.openstreetmap.josm.testutils.annotations.BasicPreferences; |
| | 34 | import org.openstreetmap.josm.testutils.annotations.Projection; |
| 37 | 35 | |
| 38 | 36 | /** |
| 39 | 37 | * Some tests for the {@link NavigatableComponent} class. |
| 40 | 38 | * @author Michael Zangl |
| 41 | 39 | * |
| 42 | 40 | */ |
| | 41 | @BasicPreferences |
| | 42 | @Projection // We need the projection for coordinate conversions. |
| 43 | 43 | class NavigatableComponentTest { |
| 44 | 44 | |
| 45 | 45 | private static final class NavigatableComponentMock extends NavigatableComponent { |
| … |
… |
|
| 63 | 63 | private static final int WIDTH = 300; |
| 64 | 64 | private NavigatableComponentMock component; |
| 65 | 65 | |
| 66 | | /** |
| 67 | | * We need the projection for coordinate conversions. |
| 68 | | */ |
| 69 | | @RegisterExtension |
| 70 | | @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") |
| 71 | | public JOSMTestRules test = new JOSMTestRules().preferences().projection(); |
| 72 | | |
| 73 | 66 | /** |
| 74 | 67 | * Create a new, fresh {@link NavigatableComponent} |
| 75 | 68 | */ |
| … |
… |
|
| 264 | 257 | |
| 265 | 258 | /** |
| 266 | 259 | * Check that EastNorth is the same as expected after zooming the NavigatableComponent. |
| 267 | | * |
| | 260 | * <p> |
| 268 | 261 | * Adds tolerance of 0.5 pixel for pixel grid alignment, see |
| 269 | 262 | * {@link NavigatableComponent#zoomTo(EastNorth, double, boolean)} |
| 270 | 263 | * @param expected expected |
-
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
diff --git a/test/unit/org/openstreetmap/josm/gui/TableCellRendererTest.java b/test/unit/org/openstreetmap/josm/gui/TableCellRendererTest.java
|
a
|
b
|
|
| 14 | 14 | import javax.swing.JTable; |
| 15 | 15 | import javax.swing.table.TableCellRenderer; |
| 16 | 16 | |
| 17 | | import org.junit.jupiter.api.extension.RegisterExtension; |
| 18 | 17 | import org.junit.jupiter.api.Test; |
| 19 | 18 | import org.openstreetmap.josm.TestUtils; |
| 20 | | import org.openstreetmap.josm.testutils.JOSMTestRules; |
| | 19 | import org.openstreetmap.josm.testutils.annotations.Main; |
| 21 | 20 | import org.openstreetmap.josm.tools.Logging; |
| 22 | 21 | import org.openstreetmap.josm.tools.ReflectionUtils; |
| 23 | 22 | |
| 24 | | import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; |
| 25 | | |
| 26 | 23 | /** |
| 27 | 24 | * Checks if all classes implementing the {@link TableCellRenderer} interface do |
| 28 | 25 | * accept a null value as second parameter for |
| 29 | 26 | * {@link TableCellRenderer#getTableCellRendererComponent(javax.swing.JTable, |
| 30 | 27 | * java.lang.Object, boolean, boolean, int, int)}. |
| 31 | | * |
| | 28 | * <p> |
| 32 | 29 | * For unknown reason java sometimes call getTableCellRendererComponent method |
| 33 | 30 | * with value = null. Every implementation of {@code getTableCellRendererComponent} |
| 34 | 31 | * must fail gracefully when null is passed as value parameter. |
| 35 | | * |
| | 32 | * <p> |
| 36 | 33 | * This test scans the classpath for classes implementing {@code TableCellRenderer}, |
| 37 | 34 | * creates an instance and calls {@code getTableCellRendererComponent} with null |
| 38 | 35 | * value to check if a NPE is thrown. |
| 39 | 36 | * |
| 40 | 37 | * @see <a href="https://josm.openstreetmap.de/ticket/6301">#6301</a> |
| 41 | 38 | */ |
| | 39 | @Main |
| 42 | 40 | class TableCellRendererTest { |
| 43 | 41 | |
| 44 | 42 | // list of classes that cannot be easily tested and are verified either manually or another unit tests |
| … |
… |
|
| 47 | 45 | "org.openstreetmap.josm.gui.dialogs.relation.SelectionTableCellRenderer" |
| 48 | 46 | ); |
| 49 | 47 | |
| 50 | | /** |
| 51 | | * Setup test. |
| 52 | | */ |
| 53 | | @RegisterExtension |
| 54 | | @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") |
| 55 | | public JOSMTestRules test = new JOSMTestRules().main(); |
| 56 | | |
| 57 | 48 | /** |
| 58 | 49 | * Unit test of all table cell renderers against null values. |
| 59 | | * @throws NoSuchMethodException no default constructor - to fix this, add a default constructor to the class |
| 60 | | * or add the class to the SKIP_TEST list above |
| 61 | | * @throws ReflectiveOperationException if an error occurs |
| 62 | 50 | */ |
| 63 | 51 | @Test |
| 64 | | void testTableCellRenderer() throws ReflectiveOperationException { |
| | 52 | void testTableCellRenderer() { |
| 65 | 53 | Set<Class<? extends TableCellRenderer>> renderers = TestUtils.getJosmSubtypes(TableCellRenderer.class); |
| 66 | 54 | assertTrue(renderers.size() >= 10); // if it finds less than 10 classes, something is broken |
| 67 | 55 | JTable tbl = new JTable(2, 2); |
-
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
diff --git a/test/unit/org/openstreetmap/josm/io/imagery/WMSImageryTest.java b/test/unit/org/openstreetmap/josm/io/imagery/WMSImageryTest.java
|
a
|
b
|
|
| 11 | 11 | import java.util.List; |
| 12 | 12 | |
| 13 | 13 | import org.junit.jupiter.api.Test; |
| 14 | | import org.junit.jupiter.api.extension.RegisterExtension; |
| 15 | 14 | import org.openstreetmap.josm.TestUtils; |
| 16 | 15 | import org.openstreetmap.josm.io.imagery.WMSImagery.WMSGetCapabilitiesException; |
| 17 | | import org.openstreetmap.josm.testutils.JOSMTestRules; |
| | 16 | import org.openstreetmap.josm.testutils.annotations.BasicPreferences; |
| 18 | 17 | import org.openstreetmap.josm.testutils.annotations.BasicWiremock; |
| | 18 | import org.openstreetmap.josm.testutils.annotations.Projection; |
| 19 | 19 | |
| 20 | 20 | import com.github.tomakehurst.wiremock.WireMockServer; |
| 21 | 21 | import com.github.tomakehurst.wiremock.client.WireMock; |
| 22 | 22 | |
| 23 | | import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; |
| 24 | | |
| 25 | 23 | /** |
| 26 | 24 | * Unit tests of {@link WMSImagery} class. |
| 27 | 25 | */ |
| | 26 | @BasicPreferences(true) |
| 28 | 27 | @BasicWiremock |
| | 28 | @Projection |
| 29 | 29 | class WMSImageryTest { |
| 30 | | |
| 31 | | /** |
| 32 | | * Setup test |
| 33 | | */ |
| 34 | | @RegisterExtension |
| 35 | | @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") |
| 36 | | JOSMTestRules test = new JOSMTestRules().projection(); |
| 37 | | |
| 38 | 30 | @BasicWiremock |
| 39 | 31 | WireMockServer tileServer; |
| 40 | 32 | |
-
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
diff --git a/test/unit/org/openstreetmap/josm/io/remotecontrol/handler/AddNodeHandlerTest.java b/test/unit/org/openstreetmap/josm/io/remotecontrol/handler/AddNodeHandlerTest.java
|
a
|
b
|
|
| 5 | 5 | import static org.junit.jupiter.api.Assertions.assertEquals; |
| 6 | 6 | import static org.junit.jupiter.api.Assertions.assertThrows; |
| 7 | 7 | |
| 8 | | import org.junit.jupiter.api.extension.RegisterExtension; |
| 9 | 8 | import org.junit.jupiter.api.Test; |
| 10 | 9 | import org.openstreetmap.josm.data.osm.DataSet; |
| 11 | 10 | import org.openstreetmap.josm.gui.MainApplication; |
| 12 | 11 | import org.openstreetmap.josm.gui.layer.OsmDataLayer; |
| 13 | 12 | import org.openstreetmap.josm.io.remotecontrol.handler.RequestHandler.RequestHandlerBadRequestException; |
| 14 | | import org.openstreetmap.josm.testutils.JOSMTestRules; |
| 15 | | |
| 16 | | import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; |
| | 13 | import org.openstreetmap.josm.testutils.annotations.AssertionsInEDT; |
| | 14 | import org.openstreetmap.josm.testutils.annotations.Main; |
| | 15 | import org.openstreetmap.josm.testutils.annotations.Projection; |
| 17 | 16 | |
| 18 | 17 | /** |
| 19 | 18 | * Unit tests of {@link AddNodeHandler} class. |
| 20 | 19 | */ |
| | 20 | @AssertionsInEDT |
| | 21 | @Main |
| | 22 | @Projection |
| 21 | 23 | class AddNodeHandlerTest { |
| 22 | | /** |
| 23 | | * Setup test. |
| 24 | | */ |
| 25 | | @RegisterExtension |
| 26 | | @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") |
| 27 | | public JOSMTestRules test = new JOSMTestRules().main().assertionsInEDT().projection(); |
| 28 | | |
| 29 | 24 | private static AddNodeHandler newHandler(String url) throws RequestHandlerBadRequestException { |
| 30 | 25 | AddNodeHandler req = new AddNodeHandler(); |
| 31 | 26 | if (url != null) |
| … |
… |
|
| 37 | 32 | * Unit test for bad request - no layer. |
| 38 | 33 | */ |
| 39 | 34 | @Test |
| 40 | | void testBadRequestNoLayer() { |
| 41 | | Exception e = assertThrows(RequestHandlerBadRequestException.class, () -> newHandler("https://localhost?lat=0&lon=0").handle()); |
| | 35 | void testBadRequestNoLayer() throws RequestHandlerBadRequestException { |
| | 36 | final AddNodeHandler handler = newHandler("https://localhost?lat=0&lon=0"); |
| | 37 | Exception e = assertThrows(RequestHandlerBadRequestException.class, handler::handle); |
| 42 | 38 | assertEquals("There is no layer opened to add node", e.getMessage()); |
| 43 | 39 | } |
| 44 | 40 | |
| … |
… |
|
| 46 | 42 | * Unit test for bad request - no param. |
| 47 | 43 | */ |
| 48 | 44 | @Test |
| 49 | | void testBadRequestNoParam() { |
| | 45 | void testBadRequestNoParam() throws RequestHandlerBadRequestException { |
| 50 | 46 | OsmDataLayer layer = new OsmDataLayer(new DataSet(), "", null); |
| 51 | 47 | MainApplication.getLayerManager().addLayer(layer); |
| 52 | | Exception e = assertThrows(RequestHandlerBadRequestException.class, () -> newHandler(null).handle()); |
| | 48 | final AddNodeHandler handler = newHandler(null); |
| | 49 | Exception e = assertThrows(RequestHandlerBadRequestException.class, handler::handle); |
| 53 | 50 | assertEquals("NumberFormatException (empty String)", e.getMessage()); |
| 54 | 51 | } |
| 55 | 52 | |
| … |
… |
|
| 57 | 54 | * Unit test for bad request - invalid URL. |
| 58 | 55 | */ |
| 59 | 56 | @Test |
| 60 | | void testBadRequestInvalidUrl() { |
| 61 | | Exception e = assertThrows(RequestHandlerBadRequestException.class, () -> newHandler("invalid_url").handle()); |
| | 57 | void testBadRequestInvalidUrl() throws RequestHandlerBadRequestException { |
| | 58 | final AddNodeHandler handler = newHandler("invalid_url"); |
| | 59 | Exception e = assertThrows(RequestHandlerBadRequestException.class, handler::handle); |
| 62 | 60 | assertEquals("The following keys are mandatory, but have not been provided: lat, lon", e.getMessage()); |
| 63 | 61 | } |
| 64 | 62 | |
| … |
… |
|
| 66 | 64 | * Unit test for bad request - incomplete URL. |
| 67 | 65 | */ |
| 68 | 66 | @Test |
| 69 | | void testBadRequestIncompleteUrl() { |
| 70 | | Exception e = assertThrows(RequestHandlerBadRequestException.class, () -> newHandler("https://localhost").handle()); |
| | 67 | void testBadRequestIncompleteUrl() throws RequestHandlerBadRequestException { |
| | 68 | final AddNodeHandler handler = newHandler("https://localhost"); |
| | 69 | Exception e = assertThrows(RequestHandlerBadRequestException.class, handler::handle); |
| 71 | 70 | assertEquals("The following keys are mandatory, but have not been provided: lat, lon", e.getMessage()); |
| 72 | 71 | } |
| 73 | 72 | |
-
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
diff --git a/test/unit/org/openstreetmap/josm/io/remotecontrol/handler/ImportHandlerTest.java b/test/unit/org/openstreetmap/josm/io/remotecontrol/handler/ImportHandlerTest.java
|
a
|
b
|
|
| 1 | 1 | // License: GPL. For details, see LICENSE file. |
| 2 | 2 | package org.openstreetmap.josm.io.remotecontrol.handler; |
| 3 | 3 | |
| 4 | | import static org.junit.jupiter.api.Assertions.assertEquals; |
| 5 | 4 | import static org.junit.jupiter.api.Assertions.assertDoesNotThrow; |
| | 5 | import static org.junit.jupiter.api.Assertions.assertEquals; |
| 6 | 6 | import static org.junit.jupiter.api.Assertions.assertThrows; |
| 7 | 7 | |
| 8 | 8 | import java.io.File; |
| 9 | 9 | |
| 10 | | import org.junit.jupiter.api.extension.RegisterExtension; |
| 11 | 10 | import org.junit.jupiter.api.Test; |
| 12 | 11 | import org.openstreetmap.josm.TestUtils; |
| 13 | 12 | import org.openstreetmap.josm.gui.MainApplication; |
| 14 | 13 | import org.openstreetmap.josm.gui.layer.OsmDataLayer; |
| 15 | 14 | import org.openstreetmap.josm.io.remotecontrol.handler.RequestHandler.RequestHandlerBadRequestException; |
| 16 | | import org.openstreetmap.josm.testutils.JOSMTestRules; |
| | 15 | import org.openstreetmap.josm.testutils.annotations.Main; |
| 17 | 16 | import org.openstreetmap.josm.tools.Utils; |
| 18 | 17 | |
| 19 | | import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; |
| 20 | | |
| 21 | 18 | /** |
| 22 | 19 | * Unit tests of {@link ImportHandler} class. |
| 23 | 20 | */ |
| | 21 | @Main |
| 24 | 22 | class ImportHandlerTest { |
| 25 | | /** |
| 26 | | * Setup test. |
| 27 | | */ |
| 28 | | @RegisterExtension |
| 29 | | @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") |
| 30 | | public JOSMTestRules test = new JOSMTestRules().main(); |
| 31 | | |
| 32 | 23 | private static ImportHandler newHandler(String url) throws RequestHandlerBadRequestException { |
| 33 | 24 | ImportHandler req = new ImportHandler(); |
| 34 | 25 | if (url != null) |
| … |
… |
|
| 52 | 43 | */ |
| 53 | 44 | @Test |
| 54 | 45 | void testBadRequestNoParam() throws Exception { |
| 55 | | Exception e = assertThrows(RequestHandlerBadRequestException.class, () -> newHandler(null).handle()); |
| 56 | | assertEquals("MalformedURLException: null", e.getMessage()); |
| | 46 | final ImportHandler handler = newHandler(null); |
| | 47 | Exception e = assertThrows(RequestHandlerBadRequestException.class, handler::handle); |
| | 48 | // This has differing behavior after Java 15 |
| | 49 | if ("MalformedURLException: null".length() == e.getMessage().length()) { |
| | 50 | assertEquals("MalformedURLException: null", e.getMessage()); |
| | 51 | } else { |
| | 52 | assertEquals("MalformedURLException: Cannot invoke \"String.length()\" because \"spec\" is null", e.getMessage()); |
| | 53 | } |
| 57 | 54 | } |
| 58 | 55 | |
| 59 | 56 | /** |
| … |
… |
|
| 62 | 59 | */ |
| 63 | 60 | @Test |
| 64 | 61 | void testBadRequestInvalidUrl() throws Exception { |
| 65 | | Exception e = assertThrows(RequestHandlerBadRequestException.class, () -> newHandler("https://localhost?url=invalid_url").handle()); |
| | 62 | final ImportHandler handler = newHandler("https://localhost?url=invalid_url"); |
| | 63 | Exception e = assertThrows(RequestHandlerBadRequestException.class, handler::handle); |
| 66 | 64 | assertEquals("MalformedURLException: no protocol: invalid_url", e.getMessage()); |
| 67 | 65 | } |
| 68 | 66 | |
| … |
… |
|
| 72 | 70 | */ |
| 73 | 71 | @Test |
| 74 | 72 | void testBadRequestIncompleteUrl() throws Exception { |
| 75 | | Exception e = assertThrows(RequestHandlerBadRequestException.class, () -> newHandler("https://localhost").handle()); |
| | 73 | final ImportHandler handler = newHandler("https://localhost?lat=0&lon=0"); |
| | 74 | Exception e = assertThrows(RequestHandlerBadRequestException.class, handler::handle); |
| 76 | 75 | assertEquals("The following keys are mandatory, but have not been provided: url", e.getMessage()); |
| 77 | 76 | } |
| 78 | 77 | |
-
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
diff --git a/test/unit/org/openstreetmap/josm/io/session/SessionWriterTest.java b/test/unit/org/openstreetmap/josm/io/session/SessionWriterTest.java
|
a
|
b
|
|
| 23 | 23 | |
| 24 | 24 | import org.junit.jupiter.api.BeforeEach; |
| 25 | 25 | import org.junit.jupiter.api.Test; |
| 26 | | import org.junit.jupiter.api.extension.RegisterExtension; |
| 27 | 26 | import org.openstreetmap.josm.TestUtils; |
| 28 | 27 | import org.openstreetmap.josm.data.coor.LatLon; |
| 29 | 28 | import org.openstreetmap.josm.data.gpx.GpxData; |
| … |
… |
|
| 41 | 40 | import org.openstreetmap.josm.gui.layer.OsmDataLayer; |
| 42 | 41 | import org.openstreetmap.josm.gui.layer.TMSLayer; |
| 43 | 42 | import org.openstreetmap.josm.gui.layer.markerlayer.MarkerLayer; |
| 44 | | import org.openstreetmap.josm.testutils.JOSMTestRules; |
| | 43 | import org.openstreetmap.josm.testutils.annotations.Main; |
| | 44 | import org.openstreetmap.josm.testutils.annotations.Projection; |
| 45 | 45 | import org.openstreetmap.josm.tools.MultiMap; |
| 46 | 46 | import org.openstreetmap.josm.tools.Utils; |
| 47 | 47 | |
| 48 | | import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; |
| 49 | | |
| 50 | 48 | /** |
| 51 | 49 | * Unit tests for Session writing. |
| 52 | 50 | */ |
| | 51 | @Main |
| | 52 | @Projection |
| 53 | 53 | public class SessionWriterTest { |
| 54 | 54 | |
| 55 | 55 | protected static final class OsmHeadlessJosExporter extends OsmDataSessionExporter { |
| … |
… |
|
| 96 | 96 | } |
| 97 | 97 | } |
| 98 | 98 | |
| 99 | | /** |
| 100 | | * Setup tests. |
| 101 | | */ |
| 102 | | @RegisterExtension |
| 103 | | @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") |
| 104 | | public JOSMTestRules test = new JOSMTestRules().projection().main(); |
| 105 | | |
| 106 | 99 | /** |
| 107 | 100 | * Setup tests. |
| 108 | 101 | */ |
-
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
diff --git a/test/unit/org/openstreetmap/josm/io/GeoJSONWriterTest.java b/test/unit/org/openstreetmap/josm/io/GeoJSONWriterTest.java
|
a
|
b
|
|
| 9 | 9 | import java.nio.file.Paths; |
| 10 | 10 | import java.util.Arrays; |
| 11 | 11 | |
| 12 | | import org.junit.jupiter.api.BeforeAll; |
| 13 | 12 | import org.junit.jupiter.api.Test; |
| 14 | | import org.openstreetmap.josm.JOSMFixture; |
| 15 | 13 | import org.openstreetmap.josm.TestUtils; |
| 16 | 14 | import org.openstreetmap.josm.data.coor.LatLon; |
| 17 | 15 | import org.openstreetmap.josm.data.osm.DataSet; |
| 18 | 16 | import org.openstreetmap.josm.data.osm.Node; |
| 19 | 17 | import org.openstreetmap.josm.data.osm.Way; |
| | 18 | import org.openstreetmap.josm.testutils.annotations.Projection; |
| 20 | 19 | |
| 21 | 20 | /** |
| 22 | 21 | * Unit tests of {@link GeoJSONWriter} class. |
| 23 | 22 | */ |
| | 23 | @Projection |
| 24 | 24 | class GeoJSONWriterTest { |
| 25 | | |
| 26 | | /** |
| 27 | | * Setup test. |
| 28 | | */ |
| 29 | | @BeforeAll |
| 30 | | public static void setUp() { |
| 31 | | JOSMFixture.createUnitTestFixture().init(); |
| 32 | | } |
| 33 | | |
| 34 | 25 | /** |
| 35 | 26 | * Unit test for Point |
| 36 | 27 | */ |
-
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
diff --git a/test/unit/org/openstreetmap/josm/io/ValidatorErrorWriterTest.java b/test/unit/org/openstreetmap/josm/io/ValidatorErrorWriterTest.java
|
a
|
b
|
|
| 6 | 6 | import java.io.ByteArrayOutputStream; |
| 7 | 7 | import java.io.IOException; |
| 8 | 8 | import java.nio.charset.StandardCharsets; |
| 9 | | import java.util.Arrays; |
| 10 | 9 | import java.util.Collection; |
| 11 | 10 | import java.util.Collections; |
| 12 | 11 | import java.util.Locale; |
| 13 | 12 | |
| 14 | 13 | import org.junit.jupiter.api.Test; |
| 15 | | import org.junit.jupiter.api.extension.RegisterExtension; |
| 16 | 14 | import org.openstreetmap.josm.data.coor.LatLon; |
| 17 | 15 | import org.openstreetmap.josm.data.osm.Node; |
| 18 | 16 | import org.openstreetmap.josm.data.validation.Severity; |
| 19 | 17 | import org.openstreetmap.josm.data.validation.TestError; |
| 20 | 18 | import org.openstreetmap.josm.data.validation.tests.RightAngleBuildingTest; |
| 21 | | import org.openstreetmap.josm.testutils.JOSMTestRules; |
| 22 | | |
| 23 | | import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; |
| | 19 | import org.openstreetmap.josm.testutils.annotations.BasicPreferences; |
| 24 | 20 | |
| 25 | 21 | /** |
| 26 | 22 | * Unit tests of {@link ValidatorErrorWriter} |
| 27 | 23 | */ |
| | 24 | @BasicPreferences |
| 28 | 25 | class ValidatorErrorWriterTest { |
| 29 | | |
| 30 | | /** |
| 31 | | * Setup rule |
| 32 | | */ |
| 33 | | @RegisterExtension |
| 34 | | @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") |
| 35 | | public JOSMTestRules test = new JOSMTestRules().preferences(); |
| 36 | | |
| 37 | 26 | @Test |
| 38 | 27 | void testEmpty() throws IOException { |
| 39 | 28 | doTest(Collections.emptyList(), ""); |
| … |
… |
|
| 42 | 31 | @Test |
| 43 | 32 | void testErrors() throws IOException { |
| 44 | 33 | Locale.setDefault(Locale.ENGLISH); |
| 45 | | doTest(Arrays.asList(TestError.builder(new RightAngleBuildingTest(), Severity.OTHER, 3701) |
| 46 | | .message("Building with an almost square angle") |
| 47 | | .primitives(new Node(LatLon.NORTH_POLE)).build()), |
| | 34 | doTest(Collections.singletonList(TestError.builder(new RightAngleBuildingTest(), Severity.OTHER, 3701) |
| | 35 | .message("Building with an almost square angle") |
| | 36 | .primitives(new Node(LatLon.NORTH_POLE)).build()), |
| 48 | 37 | " <analyser timestamp='\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{3,9}Z' name='Almost right angle buildings'>" |
| 49 | 38 | + " <class id='1' level='3'>" |
| 50 | 39 | + " <classtext lang='en' title='Building with an almost square angle'/>" |
-
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
diff --git a/test/unit/org/openstreetmap/josm/plugins/PluginHandlerJOSMTooOldTest.java b/test/unit/org/openstreetmap/josm/plugins/PluginHandlerJOSMTooOldTest.java
|
a
|
b
|
|
| 17 | 17 | import java.util.List; |
| 18 | 18 | import java.util.stream.Collectors; |
| 19 | 19 | |
| 20 | | import com.github.tomakehurst.wiremock.client.WireMock; |
| 21 | | import com.github.tomakehurst.wiremock.junit5.WireMockExtension; |
| 22 | | import com.github.tomakehurst.wiremock.junit5.WireMockRuntimeInfo; |
| 23 | | import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; |
| 24 | 20 | import org.junit.jupiter.api.BeforeEach; |
| 25 | 21 | import org.junit.jupiter.api.Test; |
| 26 | 22 | import org.junit.jupiter.api.extension.RegisterExtension; |
| … |
… |
|
| 28 | 24 | import org.openstreetmap.josm.data.Preferences; |
| 29 | 25 | import org.openstreetmap.josm.gui.MainApplication; |
| 30 | 26 | import org.openstreetmap.josm.spi.preferences.Config; |
| 31 | | import org.openstreetmap.josm.testutils.JOSMTestRules; |
| 32 | 27 | import org.openstreetmap.josm.testutils.PluginServer; |
| 33 | 28 | import org.openstreetmap.josm.testutils.annotations.AssumeRevision; |
| 34 | 29 | import org.openstreetmap.josm.testutils.annotations.FullPreferences; |
| | 30 | import org.openstreetmap.josm.testutils.annotations.Main; |
| 35 | 31 | import org.openstreetmap.josm.testutils.mockers.ExtendedDialogMocker; |
| 36 | 32 | import org.openstreetmap.josm.testutils.mockers.HelpAwareOptionPaneMocker; |
| 37 | 33 | |
| | 34 | import com.github.tomakehurst.wiremock.client.WireMock; |
| | 35 | import com.github.tomakehurst.wiremock.junit5.WireMockExtension; |
| | 36 | import com.github.tomakehurst.wiremock.junit5.WireMockRuntimeInfo; |
| | 37 | |
| 38 | 38 | /** |
| 39 | 39 | * Test parts of {@link PluginHandler} class when the reported JOSM version is too old for the plugin. |
| 40 | 40 | */ |
| 41 | 41 | @AssumeRevision("Revision: 6000\n") |
| 42 | 42 | @FullPreferences |
| | 43 | @Main |
| 43 | 44 | class PluginHandlerJOSMTooOldTest { |
| 44 | | /** |
| 45 | | * Setup test. |
| 46 | | */ |
| 47 | | @RegisterExtension |
| 48 | | @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") |
| 49 | | static JOSMTestRules test = new JOSMTestRules().main(); |
| 50 | | |
| 51 | 45 | /** |
| 52 | 46 | * Plugin server mock. |
| 53 | 47 | */ |
-
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
diff --git a/test/unit/org/openstreetmap/josm/plugins/PluginHandlerMultiVersionTest.java b/test/unit/org/openstreetmap/josm/plugins/PluginHandlerMultiVersionTest.java
|
a
|
b
|
|
| 16 | 16 | import java.util.Map; |
| 17 | 17 | import java.util.stream.Collectors; |
| 18 | 18 | |
| 19 | | import com.github.tomakehurst.wiremock.client.WireMock; |
| 20 | | import com.github.tomakehurst.wiremock.junit5.WireMockExtension; |
| 21 | | import com.github.tomakehurst.wiremock.junit5.WireMockRuntimeInfo; |
| 22 | | import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; |
| 23 | 19 | import org.junit.jupiter.api.BeforeEach; |
| 24 | 20 | import org.junit.jupiter.api.Test; |
| 25 | 21 | import org.junit.jupiter.api.extension.RegisterExtension; |
| … |
… |
|
| 27 | 23 | import org.openstreetmap.josm.data.Preferences; |
| 28 | 24 | import org.openstreetmap.josm.gui.MainApplication; |
| 29 | 25 | import org.openstreetmap.josm.spi.preferences.Config; |
| 30 | | import org.openstreetmap.josm.testutils.JOSMTestRules; |
| 31 | 26 | import org.openstreetmap.josm.testutils.PluginServer; |
| 32 | 27 | import org.openstreetmap.josm.testutils.annotations.AssumeRevision; |
| 33 | 28 | import org.openstreetmap.josm.testutils.annotations.FullPreferences; |
| | 29 | import org.openstreetmap.josm.testutils.annotations.Main; |
| 34 | 30 | import org.openstreetmap.josm.testutils.mockers.ExtendedDialogMocker; |
| 35 | 31 | |
| | 32 | import com.github.tomakehurst.wiremock.client.WireMock; |
| | 33 | import com.github.tomakehurst.wiremock.junit5.WireMockExtension; |
| | 34 | import com.github.tomakehurst.wiremock.junit5.WireMockRuntimeInfo; |
| | 35 | |
| 36 | 36 | /** |
| 37 | 37 | * Test parts of {@link PluginHandler} class with plugins that advertise multiple versions for compatibility. |
| 38 | 38 | */ |
| 39 | 39 | @FullPreferences |
| | 40 | @Main |
| 40 | 41 | class PluginHandlerMultiVersionTest { |
| 41 | | /** |
| 42 | | * Setup test. |
| 43 | | */ |
| 44 | | @RegisterExtension |
| 45 | | @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") |
| 46 | | static JOSMTestRules test = new JOSMTestRules().main(); |
| 47 | | |
| 48 | 42 | /** |
| 49 | 43 | * Plugin server mock. |
| 50 | 44 | */ |
-
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
diff --git a/test/unit/org/openstreetmap/josm/testutils/annotations/BasicPreferences.java b/test/unit/org/openstreetmap/josm/testutils/annotations/BasicPreferences.java
|
a
|
b
|
|
| 27 | 27 | |
| 28 | 28 | /** |
| 29 | 29 | * Allow tests to use JOSM preferences (see {@link JOSMTestRules#preferences()}). |
| 30 | | * This is often enough for basic tests. |
| | 30 | * This is often enough for basic tests. There are two modes: |
| | 31 | * <ul> |
| | 32 | * <li>Between test classes (usually enough) if annotated at the class level ({@link ElementType#TYPE})</li> |
| | 33 | * <li>Between test methods if annotated at the method level ({@link ElementType#METHOD})</li> |
| | 34 | * <li>Between test method if annotated at the class level <i>and</i> the annotated value is {@code true}</li> |
| | 35 | * </ul> |
| 31 | 36 | * |
| 32 | 37 | * @author Taylor Smock |
| 33 | 38 | * @see FullPreferences |
| … |
… |
|
| 39 | 44 | @Inherited |
| 40 | 45 | @ExtendWith(BasicPreferences.BasicPreferencesExtension.class) |
| 41 | 46 | public @interface BasicPreferences { |
| | 47 | /** |
| | 48 | * Clear preferences between tests |
| | 49 | * @return {@code true} if the preferences should be cleared between tests |
| | 50 | */ |
| | 51 | boolean value() default false; |
| 42 | 52 | |
| 43 | 53 | /** |
| 44 | 54 | * Initialize basic preferences. This is often more than enough for basic tests. |
| … |
… |
|
| 79 | 89 | |
| 80 | 90 | @Override |
| 81 | 91 | public void beforeEach(ExtensionContext context) throws Exception { |
| 82 | | if (AnnotationSupport.isAnnotated(context.getElement(), BasicPreferences.class) || Config.getPref() == null) { |
| | 92 | if (AnnotationSupport.isAnnotated(context.getElement(), BasicPreferences.class) || Config.getPref() == null |
| | 93 | || AnnotationUtils.findFirstParentAnnotation(context, BasicPreferences.class).map(BasicPreferences::value).orElse(false)) { |
| 83 | 94 | this.beforeAll(context); |
| 84 | 95 | } |
| 85 | 96 | } |
-
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
diff --git a/test/unit/org/openstreetmap/josm/testutils/annotations/I18n.java b/test/unit/org/openstreetmap/josm/testutils/annotations/I18n.java
|
a
|
b
|
|
| 3 | 3 | |
| 4 | 4 | import java.lang.annotation.Documented; |
| 5 | 5 | import java.lang.annotation.ElementType; |
| | 6 | import java.lang.annotation.Inherited; |
| 6 | 7 | import java.lang.annotation.Retention; |
| 7 | 8 | import java.lang.annotation.RetentionPolicy; |
| 8 | 9 | import java.lang.annotation.Target; |
| … |
… |
|
| 12 | 13 | import org.junit.jupiter.api.extension.BeforeEachCallback; |
| 13 | 14 | import org.junit.jupiter.api.extension.ExtendWith; |
| 14 | 15 | import org.junit.jupiter.api.extension.ExtensionContext; |
| 15 | | import org.junit.platform.commons.support.AnnotationSupport; |
| 16 | 16 | import org.openstreetmap.josm.tools.LanguageInfo; |
| 17 | 17 | |
| 18 | 18 | /** |
| … |
… |
|
| 22 | 22 | * @since 17914 |
| 23 | 23 | */ |
| 24 | 24 | @Documented |
| | 25 | @Inherited |
| 25 | 26 | @Retention(RetentionPolicy.RUNTIME) |
| 26 | 27 | @Target({ElementType.TYPE, ElementType.METHOD}) |
| 27 | 28 | @ExtendWith(I18n.I18nExtension.class) |
| … |
… |
|
| 41 | 42 | class I18nExtension implements AfterEachCallback, BeforeEachCallback { |
| 42 | 43 | @Override |
| 43 | 44 | public void beforeEach(ExtensionContext context) { |
| 44 | | String language = AnnotationSupport.findAnnotation(context.getElement(), I18n.class).map(I18n::value).orElse("en"); |
| | 45 | String language = AnnotationUtils.findFirstParentAnnotation(context, I18n.class).map(I18n::value).orElse("en"); |
| 45 | 46 | if (!Locale.getDefault().equals(LanguageInfo.getLocale(language, false))) { |
| 46 | 47 | org.openstreetmap.josm.tools.I18n.set(language); |
| 47 | 48 | } |
-
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
diff --git a/test/unit/org/openstreetmap/josm/testutils/annotations/JosmDefaults.java b/test/unit/org/openstreetmap/josm/testutils/annotations/JosmDefaults.java
|
a
|
b
|
|
| 9 | 9 | import java.lang.annotation.Target; |
| 10 | 10 | import java.util.Arrays; |
| 11 | 11 | |
| | 12 | import org.junit.jupiter.api.extension.AfterAllCallback; |
| 12 | 13 | import org.junit.jupiter.api.extension.AfterEachCallback; |
| | 14 | import org.junit.jupiter.api.extension.BeforeAllCallback; |
| 13 | 15 | import org.junit.jupiter.api.extension.BeforeEachCallback; |
| 14 | 16 | import org.junit.jupiter.api.extension.ExtendWith; |
| 15 | 17 | import org.junit.jupiter.api.extension.ExtensionContext; |
| … |
… |
|
| 24 | 26 | import org.openstreetmap.josm.testutils.JOSMTestRules; |
| 25 | 27 | import org.openstreetmap.josm.tools.Logging; |
| 26 | 28 | import org.openstreetmap.josm.tools.MemoryManagerTest; |
| | 29 | import org.openstreetmap.josm.tools.Utils; |
| 27 | 30 | |
| 28 | 31 | /** |
| 29 | 32 | * Default actions taken by {@link JOSMTestRules}. Automatically registered. |
| … |
… |
|
| 37 | 40 | * Default actions taken by {@link JOSMTestRules}. Automatically registered. |
| 38 | 41 | * Functionality that this provides may be moved to other classes. |
| 39 | 42 | */ |
| 40 | | class DefaultsExtension implements BeforeEachCallback, AfterEachCallback { |
| | 43 | class DefaultsExtension implements BeforeAllCallback, BeforeEachCallback, AfterAllCallback, AfterEachCallback { |
| | 44 | private static final boolean PERFORM_MEMORY_CLEANUP = |
| | 45 | !Boolean.parseBoolean(System.getProperty("test.without.gc", Boolean.FALSE.toString())); |
| | 46 | private static final int JAVA_VERSION = Utils.getJavaVersion(); |
| | 47 | |
| | 48 | @Override |
| | 49 | public void beforeAll(ExtensionContext extensionContext) throws Exception { |
| | 50 | cleanUpFromJosmFixture(); |
| | 51 | } |
| | 52 | |
| 41 | 53 | @Override |
| 42 | 54 | public void beforeEach(ExtensionContext context) throws Exception { |
| 43 | | cleanUpFromJosmFixture(); |
| 44 | 55 | // Assume anonymous user |
| 45 | 56 | if (!UserIdentityManager.getInstance().isAnonymous()) { |
| 46 | 57 | UserIdentityManager.getInstance().setAnonymous(); |
| … |
… |
|
| 69 | 80 | window.dispose(); |
| 70 | 81 | } |
| 71 | 82 | }); |
| | 83 | } |
| 72 | 84 | |
| | 85 | @Override |
| | 86 | public void afterAll(ExtensionContext extensionContext) throws Exception { |
| 73 | 87 | // Parts of JOSM uses weak references - destroy them. |
| 74 | | System.gc(); |
| | 88 | memoryCleanup(); |
| 75 | 89 | } |
| 76 | 90 | |
| 77 | 91 | /** |
| … |
… |
|
| 83 | 97 | JOSMTestRules.cleanLayerEnvironment(); |
| 84 | 98 | Preferences.main().resetToInitialState(); |
| 85 | 99 | Preferences.main().enableSaveOnPut(false); |
| 86 | | System.gc(); |
| | 100 | memoryCleanup(); |
| | 101 | } |
| | 102 | |
| | 103 | /** |
| | 104 | * Call {@link System#gc()} |
| | 105 | * Warning: This is a very expensive method! GC is expensive! |
| | 106 | * For reference, a test run without gc will take ~7 minutes. |
| | 107 | * A test run with gc will take 20 minutes (if run before/after each test method) or 10 minutes (if run before/after each test class). |
| | 108 | * <p> |
| | 109 | * If you want to do a test run without manual calls to gc, add `-Dtest.without.gc=true` to the arguments. |
| | 110 | */ |
| | 111 | public static void memoryCleanup() { |
| | 112 | if (PERFORM_MEMORY_CLEANUP) { |
| | 113 | System.gc(); |
| | 114 | // Finalization was deprecated in Java 18 |
| | 115 | if (JAVA_VERSION <= 17) { |
| | 116 | System.runFinalization(); |
| | 117 | } |
| | 118 | } |
| 87 | 119 | } |
| 88 | 120 | } |
| 89 | 121 | } |
-
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
diff --git a/test/unit/org/openstreetmap/josm/testutils/annotations/MapPaintStyles.java b/test/unit/org/openstreetmap/josm/testutils/annotations/MapPaintStyles.java
new file mode 100644
|
-
|
+
|
|
| | 1 | // License: GPL. For details, see LICENSE file. |
| | 2 | package org.openstreetmap.josm.testutils.annotations; |
| | 3 | |
| | 4 | import java.lang.annotation.Documented; |
| | 5 | import java.lang.annotation.ElementType; |
| | 6 | import java.lang.annotation.Retention; |
| | 7 | import java.lang.annotation.RetentionPolicy; |
| | 8 | import java.lang.annotation.Target; |
| | 9 | |
| | 10 | import org.junit.jupiter.api.extension.BeforeEachCallback; |
| | 11 | import org.junit.jupiter.api.extension.ExtendWith; |
| | 12 | import org.junit.jupiter.api.extension.ExtensionContext; |
| | 13 | import org.openstreetmap.josm.gui.mappaint.ElemStyles; |
| | 14 | import org.openstreetmap.josm.testutils.JOSMTestRules; |
| | 15 | |
| | 16 | /** |
| | 17 | * Use map styles in tests. |
| | 18 | * |
| | 19 | * @author Taylor Smock |
| | 20 | * @see JOSMTestRules#mapStyles() |
| | 21 | */ |
| | 22 | @Documented |
| | 23 | @Retention(RetentionPolicy.RUNTIME) |
| | 24 | @Target({ ElementType.METHOD, ElementType.TYPE }) |
| | 25 | @BasicPreferences |
| | 26 | @ExtendWith(MapPaintStyles.MapPaintStylesExtension.class) |
| | 27 | public @interface MapPaintStyles { |
| | 28 | class MapPaintStylesExtension implements BeforeEachCallback { |
| | 29 | private static int lastHashcode; |
| | 30 | |
| | 31 | @Override |
| | 32 | public void beforeEach(ExtensionContext extensionContext) throws Exception { |
| | 33 | setup(); |
| | 34 | } |
| | 35 | |
| | 36 | public static void setup() { |
| | 37 | final ElemStyles styles = org.openstreetmap.josm.gui.mappaint.MapPaintStyles.getStyles(); |
| | 38 | if (styles.getStyleSources().hashCode() != lastHashcode || styles.getStyleSources().isEmpty()) { |
| | 39 | org.openstreetmap.josm.gui.mappaint.MapPaintStyles.readFromPreferences(); |
| | 40 | lastHashcode = org.openstreetmap.josm.gui.mappaint.MapPaintStyles.getStyles().getStyleSources().hashCode(); |
| | 41 | } |
| | 42 | } |
| | 43 | } |
| | 44 | } |
-
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
diff --git a/test/unit/org/openstreetmap/josm/testutils/annotations/ProjectionNadGrids.java b/test/unit/org/openstreetmap/josm/testutils/annotations/ProjectionNadGrids.java
new file mode 100644
|
-
|
+
|
|
| | 1 | // License: GPL. For details, see LICENSE file. |
| | 2 | package org.openstreetmap.josm.testutils.annotations; |
| | 3 | |
| | 4 | import java.lang.annotation.Documented; |
| | 5 | import java.lang.annotation.ElementType; |
| | 6 | import java.lang.annotation.Retention; |
| | 7 | import java.lang.annotation.RetentionPolicy; |
| | 8 | import java.lang.annotation.Target; |
| | 9 | import java.nio.file.Paths; |
| | 10 | |
| | 11 | import org.junit.jupiter.api.extension.BeforeEachCallback; |
| | 12 | import org.junit.jupiter.api.extension.ExtendWith; |
| | 13 | import org.junit.jupiter.api.extension.ExtensionContext; |
| | 14 | import org.openstreetmap.josm.gui.MainApplication; |
| | 15 | import org.openstreetmap.josm.testutils.JOSMTestRules; |
| | 16 | import org.openstreetmap.josm.tools.Utils; |
| | 17 | |
| | 18 | /** |
| | 19 | * Use NAD projections in tests. |
| | 20 | * |
| | 21 | * @author Taylor Smock |
| | 22 | * @see JOSMTestRules#projectionNadGrids() |
| | 23 | * |
| | 24 | */ |
| | 25 | @Documented |
| | 26 | @Retention(RetentionPolicy.RUNTIME) |
| | 27 | @Target({ ElementType.METHOD, ElementType.TYPE }) |
| | 28 | @ExtendWith(ProjectionNadGrids.NadGridsExtension.class) |
| | 29 | public @interface ProjectionNadGrids { |
| | 30 | class NadGridsExtension implements BeforeEachCallback { |
| | 31 | @Override |
| | 32 | public void beforeEach(ExtensionContext extensionContext) throws Exception { |
| | 33 | if (Utils.isBlank(Utils.getSystemProperty("PROJ_LIB"))) { |
| | 34 | Utils.updateSystemProperty("PROJ_LIB", Paths.get("nodist", "data", "projection").toString()); |
| | 35 | } |
| | 36 | MainApplication.setupNadGridSources(); |
| | 37 | } |
| | 38 | } |
| | 39 | } |
-
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
diff --git a/test/unit/org/openstreetmap/josm/testutils/annotations/ResetUniquePrimitiveIdCounters.java b/test/unit/org/openstreetmap/josm/testutils/annotations/ResetUniquePrimitiveIdCounters.java
new file mode 100644
|
-
|
+
|
|
| | 1 | // License: GPL. For details, see LICENSE file. |
| | 2 | package org.openstreetmap.josm.testutils.annotations; |
| | 3 | |
| | 4 | import java.lang.annotation.Documented; |
| | 5 | import java.lang.annotation.ElementType; |
| | 6 | import java.lang.annotation.Inherited; |
| | 7 | import java.lang.annotation.Retention; |
| | 8 | import java.lang.annotation.RetentionPolicy; |
| | 9 | import java.lang.annotation.Target; |
| | 10 | import java.lang.reflect.Field; |
| | 11 | import java.util.ArrayList; |
| | 12 | import java.util.Arrays; |
| | 13 | import java.util.List; |
| | 14 | import java.util.concurrent.atomic.AtomicLong; |
| | 15 | |
| | 16 | import org.junit.jupiter.api.extension.BeforeEachCallback; |
| | 17 | import org.junit.jupiter.api.extension.ExtendWith; |
| | 18 | import org.junit.jupiter.api.extension.ExtensionContext; |
| | 19 | import org.junit.platform.commons.function.Try; |
| | 20 | import org.junit.platform.commons.support.ReflectionSupport; |
| | 21 | import org.openstreetmap.josm.data.osm.Node; |
| | 22 | import org.openstreetmap.josm.data.osm.Relation; |
| | 23 | import org.openstreetmap.josm.data.osm.UniqueIdGenerator; |
| | 24 | import org.openstreetmap.josm.data.osm.Way; |
| | 25 | import org.openstreetmap.josm.spi.preferences.Config; |
| | 26 | import org.openstreetmap.josm.spi.preferences.MemoryPreferences; |
| | 27 | |
| | 28 | /** |
| | 29 | * Reset {@link org.openstreetmap.josm.data.osm.OsmPrimitive} id counters for tests where it makes a difference. |
| | 30 | * This is most likely an ordering issue with a {@link java.util.Set} collection. |
| | 31 | */ |
| | 32 | @Documented |
| | 33 | @Retention(RetentionPolicy.RUNTIME) |
| | 34 | @Target(ElementType.METHOD) |
| | 35 | @Inherited |
| | 36 | @BasicPreferences |
| | 37 | @ExtendWith(ResetUniquePrimitiveIdCounters.Reset.class) |
| | 38 | public @interface ResetUniquePrimitiveIdCounters { |
| | 39 | class Reset implements BeforeEachCallback { |
| | 40 | private static AtomicLong[] ID_COUNTERS; |
| | 41 | |
| | 42 | @Override |
| | 43 | public void beforeEach(ExtensionContext extensionContext) throws Exception { |
| | 44 | if (ID_COUNTERS == null) { |
| | 45 | ID_COUNTERS = getIdCounters(); |
| | 46 | } |
| | 47 | |
| | 48 | for (AtomicLong counter : ID_COUNTERS) { |
| | 49 | counter.set(0); |
| | 50 | } |
| | 51 | } |
| | 52 | |
| | 53 | private static AtomicLong[] getIdCounters() throws ReflectiveOperationException { |
| | 54 | Config.setPreferencesInstance(new MemoryPreferences()); |
| | 55 | List<AtomicLong> idCounters = new ArrayList<>(3); |
| | 56 | final Field idCounter = UniqueIdGenerator.class.getDeclaredField("idCounter"); |
| | 57 | for (Try<Object> primitive : Arrays.asList( |
| | 58 | ReflectionSupport.tryToReadFieldValue(Node.class.getDeclaredField("idGenerator"), null), |
| | 59 | ReflectionSupport.tryToReadFieldValue(Way.class.getDeclaredField("idGenerator"), null), |
| | 60 | ReflectionSupport.tryToReadFieldValue(Relation.class.getDeclaredField("idGenerator"), null) |
| | 61 | )) { |
| | 62 | primitive.andThen(generator -> ReflectionSupport.tryToReadFieldValue(idCounter, generator)) |
| | 63 | .ifSuccess(counter -> idCounters.add((AtomicLong) counter)); |
| | 64 | } |
| | 65 | return idCounters.toArray(new AtomicLong[0]); |
| | 66 | } |
| | 67 | } |
| | 68 | } |
-
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
diff --git a/test/unit/org/openstreetmap/josm/testutils/annotations/TaggingPresets.java b/test/unit/org/openstreetmap/josm/testutils/annotations/TaggingPresets.java
new file mode 100644
|
-
|
+
|
|
| | 1 | // License: GPL. For details, see LICENSE file. |
| | 2 | package org.openstreetmap.josm.testutils.annotations; |
| | 3 | |
| | 4 | import java.lang.annotation.Documented; |
| | 5 | import java.lang.annotation.ElementType; |
| | 6 | import java.lang.annotation.Retention; |
| | 7 | import java.lang.annotation.RetentionPolicy; |
| | 8 | import java.lang.annotation.Target; |
| | 9 | import java.util.Collection; |
| | 10 | |
| | 11 | import org.junit.jupiter.api.extension.BeforeEachCallback; |
| | 12 | import org.junit.jupiter.api.extension.ExtendWith; |
| | 13 | import org.junit.jupiter.api.extension.ExtensionContext; |
| | 14 | import org.openstreetmap.josm.gui.tagging.presets.TaggingPreset; |
| | 15 | import org.openstreetmap.josm.testutils.JOSMTestRules; |
| | 16 | |
| | 17 | /** |
| | 18 | * Use presets in tests. |
| | 19 | * |
| | 20 | * @author Taylor Smock |
| | 21 | * @see JOSMTestRules#presets() |
| | 22 | */ |
| | 23 | @Documented |
| | 24 | @Retention(RetentionPolicy.RUNTIME) |
| | 25 | @Target({ ElementType.METHOD, ElementType.TYPE }) |
| | 26 | @BasicPreferences |
| | 27 | @ExtendWith(TaggingPresets.TaggingPresetsExtension.class) |
| | 28 | public @interface TaggingPresets { |
| | 29 | |
| | 30 | class TaggingPresetsExtension implements BeforeEachCallback { |
| | 31 | private static int expectedHashcode = 0; |
| | 32 | |
| | 33 | @Override |
| | 34 | public void beforeEach(ExtensionContext extensionContext) { |
| | 35 | setup(); |
| | 36 | } |
| | 37 | |
| | 38 | /** |
| | 39 | * Setup the tagging presets |
| | 40 | */ |
| | 41 | public static synchronized void setup() { |
| | 42 | final Collection<TaggingPreset> oldPresets = org.openstreetmap.josm.gui.tagging.presets.TaggingPresets.getTaggingPresets(); |
| | 43 | if (oldPresets.isEmpty() || expectedHashcode != oldPresets.hashCode()) { |
| | 44 | org.openstreetmap.josm.gui.tagging.presets.TaggingPresets.readFromPreferences(); |
| | 45 | expectedHashcode = org.openstreetmap.josm.gui.tagging.presets.TaggingPresets.getTaggingPresets().hashCode(); |
| | 46 | } |
| | 47 | } |
| | 48 | } |
| | 49 | } |
-
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
diff --git a/test/unit/org/openstreetmap/josm/testutils/annotations/Territories.java b/test/unit/org/openstreetmap/josm/testutils/annotations/Territories.java
|
a
|
b
|
|
| 3 | 3 | |
| 4 | 4 | import java.lang.annotation.Documented; |
| 5 | 5 | import java.lang.annotation.ElementType; |
| | 6 | import java.lang.annotation.Inherited; |
| 6 | 7 | import java.lang.annotation.Retention; |
| 7 | 8 | import java.lang.annotation.RetentionPolicy; |
| 8 | 9 | import java.lang.annotation.Target; |
| … |
… |
|
| 27 | 28 | @Target({ElementType.TYPE, ElementType.METHOD}) |
| 28 | 29 | @BasicPreferences // Needed for nodes |
| 29 | 30 | @Projection // Needed for getEastNorth |
| | 31 | @Inherited |
| 30 | 32 | @ExtendWith(Territories.TerritoriesExtension.class) |
| 31 | 33 | public @interface Territories { |
| 32 | 34 | /** |
| … |
… |
|
| 62 | 64 | private static Initialize last = Initialize.NONE; |
| 63 | 65 | |
| 64 | 66 | @Override |
| 65 | | public void beforeAll(ExtensionContext context) throws Exception { |
| | 67 | public void beforeAll(ExtensionContext context) { |
| 66 | 68 | this.beforeEach(context); |
| 67 | 69 | } |
| 68 | 70 | |
| 69 | 71 | @Override |
| 70 | | public void beforeEach(ExtensionContext context) throws Exception { |
| | 72 | public void beforeEach(ExtensionContext context) { |
| 71 | 73 | Optional<Territories> annotation = AnnotationSupport.findAnnotation(context.getElement(), |
| 72 | 74 | Territories.class); |
| 73 | 75 | if (annotation.isPresent()) { |
| 74 | 76 | Initialize current = annotation.get().value(); |
| 75 | | if (current.ordinal() <= last.ordinal()) { |
| 76 | | return; |
| 77 | | } |
| 78 | | last = current; |
| 79 | | // Avoid potential race conditions if tests are parallelized |
| 80 | | synchronized (TerritoriesExtension.class) { |
| 81 | | if (current == Initialize.INTERNAL) { |
| 82 | | org.openstreetmap.josm.tools.Territories.initializeInternalData(); |
| 83 | | } else if (current == Initialize.ALL) { |
| 84 | | org.openstreetmap.josm.tools.Territories.initialize(); |
| 85 | | } |
| | 77 | setup(current); |
| | 78 | } |
| | 79 | } |
| | 80 | |
| | 81 | /** |
| | 82 | * Set up the test |
| | 83 | * @param current The current level to initialize {@link org.openstreetmap.josm.tools.Territories} to |
| | 84 | */ |
| | 85 | public static void setup(Initialize current) { |
| | 86 | if (current.ordinal() <= last.ordinal()) { |
| | 87 | return; |
| | 88 | } |
| | 89 | last = current; |
| | 90 | // Avoid potential race conditions if tests are parallelized |
| | 91 | synchronized (TerritoriesExtension.class) { |
| | 92 | if (current == Initialize.INTERNAL) { |
| | 93 | org.openstreetmap.josm.tools.Territories.initializeInternalData(); |
| | 94 | } else if (current == Initialize.ALL) { |
| | 95 | org.openstreetmap.josm.tools.Territories.initialize(); |
| 86 | 96 | } |
| 87 | 97 | } |
| 88 | 98 | } |
-
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
diff --git a/test/unit/org/openstreetmap/josm/testutils/JOSMTestRules.java b/test/unit/org/openstreetmap/josm/testutils/JOSMTestRules.java
|
a
|
b
|
|
| 23 | 23 | import java.util.Arrays; |
| 24 | 24 | import java.util.Map; |
| 25 | 25 | import java.util.TimeZone; |
| | 26 | import java.util.concurrent.TimeUnit; |
| 26 | 27 | import java.util.logging.Handler; |
| 27 | 28 | import java.util.logging.Level; |
| 28 | 29 | |
| 29 | | import mockit.internal.state.SavePoint; |
| 30 | 30 | import org.awaitility.Awaitility; |
| | 31 | import org.awaitility.Durations; |
| 31 | 32 | import org.junit.jupiter.api.extension.AfterAllCallback; |
| 32 | 33 | import org.junit.jupiter.api.extension.AfterEachCallback; |
| 33 | 34 | import org.junit.jupiter.api.extension.BeforeAllCallback; |
| … |
… |
|
| 53 | 54 | import org.openstreetmap.josm.data.projection.ProjectionRegistry; |
| 54 | 55 | import org.openstreetmap.josm.data.projection.Projections; |
| 55 | 56 | import org.openstreetmap.josm.gui.MainApplication; |
| 56 | | import org.openstreetmap.josm.gui.mappaint.MapPaintStyles; |
| 57 | 57 | import org.openstreetmap.josm.gui.oauth.OAuthAuthorizationWizard; |
| 58 | 58 | import org.openstreetmap.josm.gui.preferences.imagery.ImageryPreferenceTestIT; |
| 59 | | import org.openstreetmap.josm.gui.tagging.presets.TaggingPresets; |
| 60 | 59 | import org.openstreetmap.josm.gui.util.GuiHelper; |
| 61 | 60 | import org.openstreetmap.josm.io.CertificateAmendment; |
| 62 | 61 | import org.openstreetmap.josm.io.OsmApi; |
| … |
… |
|
| 65 | 64 | import org.openstreetmap.josm.io.OsmTransferCanceledException; |
| 66 | 65 | import org.openstreetmap.josm.spi.preferences.Config; |
| 67 | 66 | import org.openstreetmap.josm.spi.preferences.Setting; |
| | 67 | import org.openstreetmap.josm.testutils.annotations.JosmDefaults; |
| | 68 | import org.openstreetmap.josm.testutils.annotations.MapPaintStyles; |
| | 69 | import org.openstreetmap.josm.testutils.annotations.TaggingPresets; |
| | 70 | import org.openstreetmap.josm.testutils.annotations.Territories; |
| 68 | 71 | import org.openstreetmap.josm.testutils.mockers.EDTAssertionMocker; |
| 69 | 72 | import org.openstreetmap.josm.testutils.mockers.WindowlessMapViewStateMocker; |
| 70 | 73 | import org.openstreetmap.josm.testutils.mockers.WindowlessNavigatableComponentMocker; |
| … |
… |
|
| 75 | 78 | import org.openstreetmap.josm.tools.Logging; |
| 76 | 79 | import org.openstreetmap.josm.tools.MemoryManagerTest; |
| 77 | 80 | import org.openstreetmap.josm.tools.PlatformManager; |
| 78 | | import org.openstreetmap.josm.tools.Territories; |
| 79 | 81 | import org.openstreetmap.josm.tools.Utils; |
| 80 | 82 | import org.openstreetmap.josm.tools.bugreport.ReportedException; |
| 81 | 83 | import org.openstreetmap.josm.tools.date.DateUtils; |
| 82 | 84 | |
| 83 | 85 | import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; |
| | 86 | import mockit.internal.state.SavePoint; |
| 84 | 87 | |
| 85 | 88 | /** |
| 86 | 89 | * This class runs a test in an environment that resembles the one used by the JOSM main application. |
| … |
… |
|
| 590 | 593 | |
| 591 | 594 | if (useMapStyles) { |
| 592 | 595 | // Reset the map paint styles. |
| 593 | | MapPaintStyles.readFromPreferences(); |
| | 596 | MapPaintStyles.MapPaintStylesExtension.setup(); |
| 594 | 597 | } |
| 595 | 598 | |
| 596 | 599 | if (usePresets) { |
| 597 | 600 | // Reset the presets. |
| 598 | | TaggingPresets.readFromPreferences(); |
| | 601 | TaggingPresets.TaggingPresetsExtension.setup(); |
| 599 | 602 | } |
| 600 | 603 | |
| 601 | 604 | if (territories) { |
| 602 | | Territories.initializeInternalData(); |
| | 605 | Territories.TerritoriesExtension.setup(Territories.Initialize.INTERNAL); |
| 603 | 606 | } |
| 604 | 607 | |
| 605 | 608 | if (this.edtAssertionMockingRunnable != null) { |
| … |
… |
|
| 631 | 634 | } |
| 632 | 635 | |
| 633 | 636 | private void workaroundJdkBug8159956() { |
| | 637 | // Note: This has been backported to Java 8u381 (2023-07-18) |
| 634 | 638 | try { |
| 635 | 639 | if (PlatformManager.isPlatformWindows() && Utils.getJavaVersion() == 8 && GraphicsEnvironment.isHeadless()) { |
| 636 | 640 | // https://bugs.openjdk.java.net/browse/JDK-8159956 |
| … |
… |
|
| 651 | 655 | MemoryManagerTest.resetState(true); |
| 652 | 656 | cleanLayerEnvironment(); |
| 653 | 657 | Preferences.main().resetToInitialState(); |
| 654 | | System.gc(); |
| | 658 | JosmDefaults.DefaultsExtension.memoryCleanup(); |
| 655 | 659 | } |
| 656 | 660 | |
| 657 | 661 | /** |
| … |
… |
|
| 688 | 692 | // Sync worker thread |
| 689 | 693 | final boolean[] queueEmpty = {false}; |
| 690 | 694 | MainApplication.worker.submit(() -> queueEmpty[0] = true); |
| 691 | | Awaitility.await().forever().until(() -> queueEmpty[0]); |
| | 695 | // Default pollInterval is 100ms, which means that each test takes (at minimum) .1s. |
| | 696 | Awaitility.await().pollDelay(0, TimeUnit.SECONDS).pollInterval(Durations.ONE_MILLISECOND).forever().until(() -> queueEmpty[0]); |
| 692 | 697 | // Remove all layers |
| 693 | 698 | cleanLayerEnvironment(); |
| 694 | 699 | MemoryManagerTest.resetState(allowMemoryManagerLeaks); |
| … |
… |
|
| 717 | 722 | }); |
| 718 | 723 | |
| 719 | 724 | // Parts of JOSM uses weak references - destroy them. |
| 720 | | System.gc(); |
| | 725 | JosmDefaults.DefaultsExtension.memoryCleanup(); |
| 721 | 726 | } |
| 722 | 727 | |
| 723 | 728 | private final class CreateJosmEnvironment extends Statement { |
-
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
diff --git a/test/unit/org/openstreetmap/josm/tools/date/DateUtilsTest.java b/test/unit/org/openstreetmap/josm/tools/date/DateUtilsTest.java
|
a
|
b
|
|
| 16 | 16 | import java.util.TimeZone; |
| 17 | 17 | import java.util.concurrent.ForkJoinPool; |
| 18 | 18 | |
| 19 | | import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; |
| 20 | | import net.trajano.commons.testing.UtilityClassTestUtil; |
| 21 | 19 | import org.junit.jupiter.api.Disabled; |
| 22 | 20 | import org.junit.jupiter.api.Test; |
| 23 | | import org.junit.jupiter.api.extension.RegisterExtension; |
| 24 | 21 | import org.junit.jupiter.params.ParameterizedTest; |
| 25 | 22 | import org.junit.jupiter.params.provider.ValueSource; |
| 26 | | import org.openstreetmap.josm.testutils.JOSMTestRules; |
| | 23 | import org.openstreetmap.josm.testutils.annotations.BasicPreferences; |
| | 24 | import org.openstreetmap.josm.testutils.annotations.I18n; |
| 27 | 25 | import org.openstreetmap.josm.tools.UncheckedParseException; |
| 28 | 26 | |
| | 27 | import net.trajano.commons.testing.UtilityClassTestUtil; |
| | 28 | |
| 29 | 29 | /** |
| 30 | 30 | * Unit tests of {@link DateUtils} class. |
| 31 | 31 | */ |
| | 32 | @BasicPreferences |
| | 33 | @I18n |
| 32 | 34 | public class DateUtilsTest { |
| 33 | | |
| 34 | | /** |
| 35 | | * Set the timezone and timeout. |
| 36 | | * <p> |
| 37 | | * Timeouts need to be disabled because we change the time zone. |
| 38 | | */ |
| 39 | | @RegisterExtension |
| 40 | | @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") |
| 41 | | public JOSMTestRules test = new JOSMTestRules().i18n().preferences(); |
| 42 | | |
| 43 | 35 | /** |
| 44 | 36 | * Tests that {@code DateUtils} satisfies utility class criteria. |
| 45 | 37 | * @throws ReflectiveOperationException if an error occurs |
-
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
diff --git a/test/unit/org/openstreetmap/josm/tools/date/IntervalTest.java b/test/unit/org/openstreetmap/josm/tools/date/IntervalTest.java
|
a
|
b
|
|
| 1 | 1 | // License: GPL. For details, see LICENSE file. |
| 2 | 2 | package org.openstreetmap.josm.tools.date; |
| 3 | 3 | |
| 4 | | import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; |
| 5 | | import org.junit.jupiter.api.BeforeEach; |
| 6 | | import org.junit.jupiter.api.Test; |
| 7 | | import org.junit.jupiter.api.extension.RegisterExtension; |
| 8 | | import org.openstreetmap.josm.testutils.JOSMTestRules; |
| | 4 | import static org.junit.jupiter.api.Assertions.assertEquals; |
| 9 | 5 | |
| 10 | 6 | import java.time.Instant; |
| 11 | 7 | import java.util.Locale; |
| 12 | 8 | |
| 13 | | import static org.junit.jupiter.api.Assertions.assertEquals; |
| | 9 | import org.junit.jupiter.api.BeforeEach; |
| | 10 | import org.junit.jupiter.api.Test; |
| | 11 | import org.openstreetmap.josm.testutils.annotations.BasicPreferences; |
| 14 | 12 | |
| | 13 | @BasicPreferences |
| 15 | 14 | class IntervalTest { |
| 16 | | |
| 17 | | /** |
| 18 | | * Setup test. |
| 19 | | */ |
| 20 | | @RegisterExtension |
| 21 | | @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") |
| 22 | | public JOSMTestRules test = new JOSMTestRules().preferences(); |
| 23 | | |
| 24 | 15 | /** |
| 25 | 16 | * Setup test. |
| 26 | 17 | */ |
-
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
diff --git a/test/unit/org/openstreetmap/josm/tools/ExceptionUtilTest.java b/test/unit/org/openstreetmap/josm/tools/ExceptionUtilTest.java
|
a
|
b
|
|
| 12 | 12 | |
| 13 | 13 | import org.junit.jupiter.api.BeforeEach; |
| 14 | 14 | import org.junit.jupiter.api.Test; |
| 15 | | import org.junit.jupiter.api.extension.RegisterExtension; |
| 16 | 15 | import org.openstreetmap.josm.io.ChangesetClosedException; |
| 17 | 16 | import org.openstreetmap.josm.io.IllegalDataException; |
| 18 | 17 | import org.openstreetmap.josm.io.MissingOAuthAccessTokenException; |
| … |
… |
|
| 21 | 20 | import org.openstreetmap.josm.io.OsmApiException; |
| 22 | 21 | import org.openstreetmap.josm.io.OsmApiInitializationException; |
| 23 | 22 | import org.openstreetmap.josm.io.auth.CredentialsManager; |
| 24 | | import org.openstreetmap.josm.testutils.JOSMTestRules; |
| | 23 | import org.openstreetmap.josm.testutils.annotations.BasicPreferences; |
| 25 | 24 | import org.openstreetmap.josm.tools.date.DateUtils; |
| 26 | 25 | import org.openstreetmap.josm.tools.date.DateUtilsTest; |
| 27 | 26 | |
| 28 | | import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; |
| 29 | | |
| 30 | 27 | /** |
| 31 | 28 | * Unit tests of {@link ExceptionUtil} class. |
| 32 | 29 | */ |
| | 30 | @BasicPreferences |
| | 31 | @org.openstreetmap.josm.testutils.annotations.OsmApi(org.openstreetmap.josm.testutils.annotations.OsmApi.APIType.FAKE) |
| 33 | 32 | class ExceptionUtilTest { |
| 34 | | |
| 35 | | /** |
| 36 | | * Setup rule. |
| 37 | | */ |
| 38 | | @RegisterExtension |
| 39 | | @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") |
| 40 | | public JOSMTestRules test = new JOSMTestRules().preferences().fakeAPI(); |
| 41 | | |
| 42 | 33 | private static String baseUrl; |
| 43 | 34 | private static String serverUrl; |
| 44 | 35 | private static String host; |
-
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
diff --git a/test/unit/org/openstreetmap/josm/tools/LanguageInfoTest.java b/test/unit/org/openstreetmap/josm/tools/LanguageInfoTest.java
|
a
|
b
|
|
| 9 | 9 | import java.util.stream.Collectors; |
| 10 | 10 | import java.util.stream.Stream; |
| 11 | 11 | |
| 12 | | import org.junit.jupiter.api.extension.RegisterExtension; |
| 13 | 12 | import org.junit.jupiter.api.Test; |
| 14 | | import org.openstreetmap.josm.testutils.JOSMTestRules; |
| 15 | | |
| 16 | | import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; |
| | 13 | import org.openstreetmap.josm.testutils.annotations.I18n; |
| 17 | 14 | |
| 18 | 15 | /** |
| 19 | 16 | * Unit tests of {@link LanguageInfo}. |
| 20 | 17 | */ |
| | 18 | @I18n("ca@valencia") |
| 21 | 19 | class LanguageInfoTest { |
| 22 | | |
| 23 | | /** |
| 24 | | * Setup test. |
| 25 | | */ |
| 26 | | @RegisterExtension |
| 27 | | @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") |
| 28 | | public JOSMTestRules test = new JOSMTestRules().i18n("ca@valencia"); |
| 29 | | |
| 30 | 20 | private static final Locale EN_NZ = new Locale("en", "NZ"); |
| 31 | 21 | private static final Locale DE_DE = Locale.GERMANY; |
| 32 | 22 | private static final Locale PT_BR = new Locale("pt", "BR"); |
-
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
diff --git a/test/unit/org/openstreetmap/josm/tools/OsmPrimitiveImageProviderTest.java b/test/unit/org/openstreetmap/josm/tools/OsmPrimitiveImageProviderTest.java
|
a
|
b
|
|
| 10 | 10 | |
| 11 | 11 | import javax.swing.ImageIcon; |
| 12 | 12 | |
| 13 | | import org.junit.jupiter.api.BeforeAll; |
| 14 | 13 | import org.junit.jupiter.api.Test; |
| 15 | | import org.junit.jupiter.api.extension.RegisterExtension; |
| 16 | | import org.openstreetmap.josm.JOSMFixture; |
| 17 | 14 | import org.openstreetmap.josm.data.osm.Node; |
| 18 | 15 | import org.openstreetmap.josm.data.osm.OsmUtils; |
| 19 | 16 | import org.openstreetmap.josm.gui.tagging.presets.TaggingPresets; |
| 20 | 17 | import org.openstreetmap.josm.gui.tagging.presets.TaggingPresetsTest; |
| 21 | | import org.openstreetmap.josm.testutils.JOSMTestRules; |
| | 18 | import org.openstreetmap.josm.testutils.annotations.MapPaintStyles; |
| 22 | 19 | import org.openstreetmap.josm.tools.OsmPrimitiveImageProvider.Options; |
| 23 | 20 | |
| 24 | | import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; |
| 25 | | |
| 26 | 21 | /** |
| 27 | 22 | * Unit tests of {@link OsmPrimitiveImageProvider} |
| 28 | 23 | */ |
| | 24 | @MapPaintStyles |
| | 25 | @org.openstreetmap.josm.testutils.annotations.TaggingPresets |
| 29 | 26 | class OsmPrimitiveImageProviderTest { |
| 30 | | |
| 31 | | /** |
| 32 | | * Setup test. |
| 33 | | */ |
| 34 | | @RegisterExtension |
| 35 | | @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") |
| 36 | | public JOSMTestRules test = new JOSMTestRules().mapStyles().presets(); |
| 37 | | |
| 38 | | /** |
| 39 | | * Setup test. |
| 40 | | */ |
| 41 | | @BeforeAll |
| 42 | | public static void setUp() { |
| 43 | | JOSMFixture.createUnitTestFixture().init(); |
| 44 | | } |
| 45 | | |
| 46 | 27 | /** |
| 47 | 28 | * Unit test of {@link OsmPrimitiveImageProvider#getResource}. |
| 48 | 29 | */ |
-
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
diff --git a/test/unit/org/openstreetmap/josm/tools/TerritoriesTestIT.java b/test/unit/org/openstreetmap/josm/tools/TerritoriesTestIT.java
|
a
|
b
|
|
| 7 | 7 | import java.util.Collections; |
| 8 | 8 | |
| 9 | 9 | import org.junit.jupiter.api.Test; |
| 10 | | import org.junit.jupiter.api.extension.RegisterExtension; |
| 11 | | import org.openstreetmap.josm.testutils.JOSMTestRules; |
| 12 | | |
| 13 | | import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; |
| | 10 | import org.openstreetmap.josm.testutils.annotations.Projection; |
| 14 | 11 | |
| 15 | 12 | /** |
| 16 | 13 | * Integration tests of {@link Territories} class. |
| 17 | 14 | */ |
| | 15 | @Projection |
| 18 | 16 | class TerritoriesTestIT { |
| 19 | | |
| 20 | | /** |
| 21 | | * Test rules. |
| 22 | | */ |
| 23 | | @RegisterExtension |
| 24 | | @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") |
| 25 | | public JOSMTestRules rules = new JOSMTestRules().projection(); |
| 26 | | |
| 27 | | |
| 28 | 17 | /** |
| 29 | 18 | * Test of {@link Territories#initialize} method. |
| 30 | 19 | */ |