Changeset 18870 in josm for trunk/test/unit/org/openstreetmap
- Timestamp:
- 2023-10-16T15:19:07+02:00 (13 months ago)
- Location:
- trunk/test/unit/org/openstreetmap/josm
- Files:
-
- 3 added
- 150 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/test/unit/org/openstreetmap/josm/actions/AboutActionTest.java
r17275 r18870 2 2 package org.openstreetmap.josm.actions; 3 3 4 import static org.junit.jupiter.api.Assertions.assert NotNull;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 @RegisterExtension21 @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}. … … 27 18 @Test 28 19 void testBuildAboutPanel() { 29 assert NotNull(new AboutAction().buildAboutPanel());20 assertDoesNotThrow(() -> new AboutAction().buildAboutPanel()); 30 21 } 31 22 } -
trunk/test/unit/org/openstreetmap/josm/actions/AddImageryLayerActionTest.java
r18630 r18870 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; … … 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 25 import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;26 24 27 25 /** 28 26 * Unit tests for class {@link AddImageryLayerAction}. 29 27 */ 28 @BasicPreferences 30 29 @BasicWiremock 31 @BasicPreferences 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 @RegisterExtension37 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")38 public JOSMTestRules test = new JOSMTestRules().fakeAPI().projection();39 40 33 /** 41 34 * HTTP mock. -
trunk/test/unit/org/openstreetmap/josm/actions/AlignInCircleActionTest.java
r18615 r18870 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; … … 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 35 import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;36 33 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 @RegisterExtension46 @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 … … 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 } … … 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 … … 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 } -
trunk/test/unit/org/openstreetmap/josm/actions/AlignInLineActionTest.java
r17275 r18870 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; … … 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; … … 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 @RegisterExtension33 @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; … … 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 overlapping53 * 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 */ … … 211 203 @Test 212 204 void testLineDifferentCoordinates() throws InvalidSelection { 213 assert NotNull(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 assert NotNull(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 assert NotNull(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 } -
trunk/test/unit/org/openstreetmap/josm/actions/CombineWayActionTest.java
r18853 r18870 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; … … 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")) { -
trunk/test/unit/org/openstreetmap/josm/actions/CopyActionTest.java
r18690 r18870 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; … … 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 { … … 42 46 } 43 47 } 44 45 /**46 * We need prefs for this.47 */48 @RegisterExtension49 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")50 public static JOSMTestRules test = new JOSMTestRules().preferences().fakeAPI().main().projection();51 48 52 49 /** -
trunk/test/unit/org/openstreetmap/josm/actions/CreateCircleActionTest.java
r17333 r18870 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; … … 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; … … 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 @RegisterExtension37 @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 occurs45 34 */ 46 35 @Test 47 void testTicket7421case0() throws ReflectiveOperationException{36 void testTicket7421case0() { 48 37 DataSet dataSet = new DataSet(); 49 38 -
trunk/test/unit/org/openstreetmap/josm/actions/CreateMultipolygonActionTest.java
r17429 r18870 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; … … 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 36 import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;37 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 @RegisterExtension47 @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<>(); -
trunk/test/unit/org/openstreetmap/josm/actions/ExitActionTest.java
r18350 r18870 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; … … 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; … … 29 26 * Unit tests for class {@link ExitAction}. 30 27 */ 28 @Main 31 29 final class ExitActionTest { 32 33 /**34 * Setup test.35 */36 @RegisterExtension37 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")38 public JOSMTestRules test = new JOSMTestRules().main();39 40 30 @BeforeAll 41 31 static void beforeAll() { -
trunk/test/unit/org/openstreetmap/josm/actions/FullscreenToggleActionTest.java
r17275 r18870 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 @RegisterExtension18 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")19 public JOSMTestRules test = new JOSMTestRules().main();20 21 12 /** 22 13 * Test {@link FullscreenToggleAction} -
trunk/test/unit/org/openstreetmap/josm/actions/JoinAreasActionTest.java
r18690 r18870 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; … … 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 import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;43 42 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 @RegisterExtension53 @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. -
trunk/test/unit/org/openstreetmap/josm/actions/JoinNodeWayActionTest.java
r17275 r18870 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; … … 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 import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;33 32 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 @RegisterExtension42 @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 … … 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 */ 64 @Test 65 void testTicket18189() throws Exception { 57 */ 58 @Test 59 void testTicket18189() { 66 60 DataSet dataSet = new DataSet(); 67 61 OsmDataLayer layer = new OsmDataLayer(dataSet, OsmDataLayer.createNewName(), null); -
trunk/test/unit/org/openstreetmap/josm/actions/MergeLayerActionTest.java
r17275 r18870 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; … … 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 26 import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;27 25 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 @RegisterExtension37 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")38 public JOSMTestRules test = new JOSMTestRules().main().projection();39 40 32 /** 41 33 * MergeLayerExtendedDialog mocker. -
trunk/test/unit/org/openstreetmap/josm/actions/MergeNodesActionTest.java
r17275 r18870 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 @RegisterExtension30 @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 … … 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 … … 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 … … 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 … … 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 } -
trunk/test/unit/org/openstreetmap/josm/actions/OrthogonalizeActionTest.java
r17275 r18870 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; … … 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 … … 33 31 * Unit tests for class {@link OrthogonalizeAction}. 34 32 */ 33 @Projection 35 34 class OrthogonalizeActionTest { 36 37 /**38 * Setup test.39 */40 @RegisterExtension41 @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 } -
trunk/test/unit/org/openstreetmap/josm/actions/PurgeActionTest.java
r18487 r18870 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; … … 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 @RegisterExtension33 @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 found40 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); -
trunk/test/unit/org/openstreetmap/josm/actions/RestorePropertyActionTest.java
r18690 r18870 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; … … 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 @RegisterExtension29 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")30 public JOSMTestRules test = new JOSMTestRules().preferences();31 32 22 @Test 33 23 void testTicket20965() { -
trunk/test/unit/org/openstreetmap/josm/actions/SelectAllActionTest.java
r17275 r18870 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 @RegisterExtension23 @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. -
trunk/test/unit/org/openstreetmap/josm/actions/SelectByInternalPointActionTest.java
r17275 r18870 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; … … 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 … … 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 @RegisterExtension34 @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. -
trunk/test/unit/org/openstreetmap/josm/actions/SessionSaveAsActionTest.java
r18466 r18870 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 @RegisterExtension21 @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} -
trunk/test/unit/org/openstreetmap/josm/actions/SimplifyWayActionTest.java
r18317 r18870 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; … … 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 34 import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;35 33 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 44 /**45 * Setup test.46 */47 @RegisterExtension48 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")49 public JOSMTestRules test = new JOSMTestRules().main().projection();50 43 51 44 /** -
trunk/test/unit/org/openstreetmap/josm/actions/SplitWayActionTest.java
r18690 r18870 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; … … 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 @RegisterExtension32 @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 -
trunk/test/unit/org/openstreetmap/josm/actions/UnGlueActionTest.java
r17275 r18870 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; … … 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 28 /**29 * Setup test.30 */31 @RegisterExtension32 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")33 public JOSMTestRules test = new JOSMTestRules().main().projection().preferences();34 29 35 30 /** -
trunk/test/unit/org/openstreetmap/josm/actions/UnJoinNodeWayActionTest.java
r18487 r18870 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; … … 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 … … 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 @RegisterExtension43 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")44 public static JOSMTestRules test = new JOSMTestRules().projection().main();45 38 46 39 /** … … 65 58 66 59 Way w = new Way(); 67 w.setNodes(Arrays.asList(n ew Node[] {n1, n2, n3}));60 w.setNodes(Arrays.asList(n1, n2, n3)); 68 61 dataSet.addPrimitive(w); 69 62 -
trunk/test/unit/org/openstreetmap/josm/actions/UploadActionTest.java
r18799 r18870 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; … … 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; … … 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 … … 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 @RegisterExtension52 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(); … … 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(); … … 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; -
trunk/test/unit/org/openstreetmap/josm/actions/mapmode/AddNoteActionTest.java
r17275 r18870 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; … … 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 @RegisterExtension27 @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}. -
trunk/test/unit/org/openstreetmap/josm/actions/mapmode/DeleteActionTest.java
r17275 r18870 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; … … 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 @RegisterExtension28 @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}. -
trunk/test/unit/org/openstreetmap/josm/actions/mapmode/DrawActionTest.java
r17275 r18870 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; … … 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 @RegisterExtension41 @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 details49 * @throws IllegalAccessException see {@link Field#set} for details50 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); … … 67 59 68 60 Way w = new Way(); 69 w.setNodes(Arrays.asList(n ew Node[] {n1, n2}));61 w.setNodes(Arrays.asList(n1, n2)); 70 62 dataSet.addPrimitive(w); 71 63 -
trunk/test/unit/org/openstreetmap/josm/actions/mapmode/DrawSnapHelperTest.java
r18612 r18870 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; … … 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 … … 32 31 * Test class for {@link DrawSnapHelper} 33 32 */ 33 @Main 34 @org.openstreetmap.josm.testutils.annotations.Projection 34 35 class DrawSnapHelperTest { 35 @RegisterExtension36 static JOSMTestRules rule = new JOSMTestRules().projection().main();37 38 36 static Stream<Arguments> testNonRegression13097() { 39 37 return Stream.of( -
trunk/test/unit/org/openstreetmap/josm/actions/mapmode/ExtrudeActionTest.java
r17275 r18870 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; … … 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 @RegisterExtension28 @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}. -
trunk/test/unit/org/openstreetmap/josm/actions/mapmode/ImproveWayAccuracyActionTest.java
r17275 r18870 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; … … 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 @RegisterExtension28 @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}. -
trunk/test/unit/org/openstreetmap/josm/actions/mapmode/ParallelWayActionTest.java
r17275 r18870 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; … … 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 @RegisterExtension29 @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}. -
trunk/test/unit/org/openstreetmap/josm/actions/mapmode/PlayHeadDragModeTest.java
r17275 r18870 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; … … 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 @RegisterExtension27 @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}. -
trunk/test/unit/org/openstreetmap/josm/actions/mapmode/SelectActionTest.java
r18526 r18870 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; … … 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; … … 35 35 * Unit tests for class {@link SelectAction}. 36 36 */ 37 @Main 38 @Projection 37 39 class SelectActionTest { 38 40 … … 54 56 } 55 57 } 56 57 /**58 * Setup test.59 */60 @RegisterExtension61 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")62 public JOSMTestRules test = new JOSMTestRules().projection().main();63 58 64 59 /** -
trunk/test/unit/org/openstreetmap/josm/actions/upload/FixDataHookTest.java
r18690 r18870 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; … … 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 @RegisterExtension36 @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. -
trunk/test/unit/org/openstreetmap/josm/actions/upload/UploadNotesTaskTest.java
r18443 r18870 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; … … 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 … … 43 42 */ 44 43 @BasicPreferences 44 @OsmApi(OsmApi.APIType.FAKE) 45 45 class UploadNotesTaskTest { 46 @RegisterExtension47 static JOSMTestRules josmTestRules = new JOSMTestRules().fakeAPI();48 49 46 static Stream<Arguments> testUpload() { 50 47 final NoteData commonData = new NoteData(); -
trunk/test/unit/org/openstreetmap/josm/actions/upload/ValidateUploadHookTest.java
r18776 r18870 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; … … 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 32 import mockit.Mock; 31 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 @RegisterExtension41 @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. -
trunk/test/unit/org/openstreetmap/josm/command/MoveCommandTest.java
r17275 r18870 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; … … 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; 28 29 import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; 26 import org.openstreetmap.josm.testutils.annotations.BasicPreferences; 27 import org.openstreetmap.josm.testutils.annotations.I18n; 28 import org.openstreetmap.josm.testutils.annotations.Projection; 29 30 30 import nl.jqno.equalsverifier.EqualsVerifier; 31 31 import nl.jqno.equalsverifier.Warning; … … 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 @RegisterExtension41 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")42 public JOSMTestRules test = new JOSMTestRules().preferences().i18n().projection();43 40 private CommandTestDataWithRelation testData; 44 41 … … 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)); … … 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()); … … 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}, … … 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 } -
trunk/test/unit/org/openstreetmap/josm/command/RotateCommandTest.java
r17275 r18870 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; … … 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; … … 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 @RegisterExtension37 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")38 public JOSMTestRules test = new JOSMTestRules().preferences().projection();39 34 private CommandTestData testData; 40 35 … … 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 … … 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()); … … 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", -
trunk/test/unit/org/openstreetmap/josm/command/ScaleCommandTest.java
r17275 r18870 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; … … 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; … … 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 @RegisterExtension37 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")38 public JOSMTestRules test = new JOSMTestRules().preferences().projection();39 34 private CommandTestData testData; 40 35 … … 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 … … 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()); … … 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", -
trunk/test/unit/org/openstreetmap/josm/command/SplitWayCommandTest.java
r18539 r18870 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; … … 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 @RegisterExtension53 @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}. … … 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. … … 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 * -
trunk/test/unit/org/openstreetmap/josm/command/conflict/DeletedStateConflictResolveCommandTest.java
r18853 r18870 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; … … 17 18 * Unit tests of {@link DeletedStateConflictResolveCommand} class. 18 19 */ 20 @MapPaintStyles 19 21 class DeletedStateConflictResolveCommandTest { 20 22 /** -
trunk/test/unit/org/openstreetmap/josm/command/conflict/ModifiedConflictResolveCommandTest.java
r18853 r18870 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; … … 17 18 * Unit tests of {@link ModifiedConflictResolveCommand} class. 18 19 */ 20 @MapPaintStyles 19 21 class ModifiedConflictResolveCommandTest { 20 22 /** -
trunk/test/unit/org/openstreetmap/josm/command/conflict/RelationMemberConflictResolverCommandTest.java
r18853 r18870 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; … … 17 18 * Unit tests of {@link RelationMemberConflictResolverCommand} class. 18 19 */ 20 @MapPaintStyles 19 21 class RelationMemberConflictResolverCommandTest { 20 22 /** -
trunk/test/unit/org/openstreetmap/josm/command/conflict/TagConflictResolveCommandTest.java
r18853 r18870 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; … … 17 18 * Unit tests of {@link TagConflictResolveCommand} class. 18 19 */ 20 @MapPaintStyles 19 21 class TagConflictResolveCommandTest { 20 22 /** -
trunk/test/unit/org/openstreetmap/josm/command/conflict/VersionConflictResolveCommandTest.java
r18853 r18870 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; … … 17 18 * Unit tests of {@link VersionConflictResolveCommand} class. 18 19 */ 20 @MapPaintStyles 19 21 class VersionConflictResolveCommandTest { 20 22 /** -
trunk/test/unit/org/openstreetmap/josm/command/conflict/WayNodesConflictResolverCommandTest.java
r18853 r18870 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; … … 17 18 * Unit tests of {@link WayNodesConflictResolverCommand} class. 18 19 */ 20 @MapPaintStyles 19 21 class WayNodesConflictResolverCommandTest { 20 22 /** -
trunk/test/unit/org/openstreetmap/josm/data/PreferencesTest.java
r17275 r18870 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 @RegisterExtension21 @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}. -
trunk/test/unit/org/openstreetmap/josm/data/cache/HostLimitQueueTest.java
r17275 r18870 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 ver yfing, that this pair works OK22 * 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 @RegisterExtension32 @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 -
trunk/test/unit/org/openstreetmap/josm/data/coor/LatLonTest.java
r18494 r18870 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; … … 22 21 * Unit tests for class {@link LatLon}. 23 22 */ 23 @Projection 24 24 public class LatLonTest { 25 26 /**27 * Setup test.28 */29 @RegisterExtension30 @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 … … 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 -
trunk/test/unit/org/openstreetmap/josm/data/coor/PolarCoorTest.java
r17275 r18870 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 … … 18 16 * Test the {@link PolarCoor} class. 19 17 */ 18 @Projection 20 19 class PolarCoorTest { 21 22 /**23 * Setup test.24 */25 @RegisterExtension26 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")27 public JOSMTestRules test = new JOSMTestRules().projection();28 29 20 /** 30 21 * Test {@link PolarCoor#PolarCoor} -
trunk/test/unit/org/openstreetmap/josm/data/coor/conversion/ICoordinateFormatTest.java
r17275 r18870 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 @RegisterExtension22 @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)} -
trunk/test/unit/org/openstreetmap/josm/data/coor/conversion/LatLonParserTest.java
r17275 r18870 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 @RegisterExtension23 @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. -
trunk/test/unit/org/openstreetmap/josm/data/gpx/GpxDataTest.java
r18494 r18870 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; … … 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; … … 44 42 * Unit tests for class {@link GpxData}. 45 43 */ 44 @Projection 46 45 class GpxDataTest { 47 48 /**49 * Setup test.50 */51 @RegisterExtension52 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")53 public JOSMTestRules test = new JOSMTestRules().projection();54 55 46 private GpxData data; 56 47 … … 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(); … … 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); … … 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); … … 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 … … 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 -
trunk/test/unit/org/openstreetmap/josm/data/imagery/WMSEndpointTileSourceTest.java
r18766 r18870 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 -
trunk/test/unit/org/openstreetmap/josm/data/imagery/vectortile/mapbox/style/MapboxVectorStyleTest.java
r18723 r18870 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; … … 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 … … 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 66 // Needed for osm primitives (we really just need to initialize the config)67 // OSM primitives are called when we load style sources68 @RegisterExtension69 JOSMTestRules rules = new JOSMTestRules();70 67 71 68 /** The base information */ … … 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())); -
trunk/test/unit/org/openstreetmap/josm/data/osm/MultipolygonBuilderTest.java
r17275 r18870 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 @RegisterExtension25 @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. -
trunk/test/unit/org/openstreetmap/josm/data/osm/NodeTest.java
r17275 r18870 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.assertThrows; 8 9 import static org.junit.jupiter.api.Assertions.assertTrue; 9 import static org.junit.jupiter.api.Assertions.assertThrows;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 @RegisterExtension30 @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. -
trunk/test/unit/org/openstreetmap/josm/data/osm/NoteDataTest.java
r18009 r18870 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 @RegisterExtension32 @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} … … 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 } … … 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 -
trunk/test/unit/org/openstreetmap/josm/data/preferences/JosmUrlsTest.java
r17275 r18870 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 @RegisterExtension22 @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}. -
trunk/test/unit/org/openstreetmap/josm/data/projection/ProjectionRefTest.java
r18690 r18870 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; … … 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"). … … 63 63 * of the algorithm, given a certain definition. 64 64 */ 65 @ProjectionNadGrids 66 @Timeout(90) 65 67 class ProjectionRefTest { 66 68 … … 86 88 static boolean debug; 87 89 static List<String> forcedCodes; 88 89 /**90 * Setup test.91 */92 @RegisterExtension93 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")94 public JOSMTestRules test = new JOSMTestRules().projectionNadGrids().timeout(90_000);95 90 96 91 /** -
trunk/test/unit/org/openstreetmap/josm/data/projection/ProjectionRegressionTest.java
r18853 r18870 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; … … 138 139 * @throws IOException if any I/O error occurs 139 140 */ 141 @ProjectionNadGrids 140 142 @Test 141 143 void testNonRegression() throws IOException { -
trunk/test/unit/org/openstreetmap/josm/data/projection/ProjectionTest.java
r18690 r18870 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 /** … … 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() { -
trunk/test/unit/org/openstreetmap/josm/data/projection/SwissGridTest.java
r17275 r18870 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 23 /**24 * Setup test.25 */26 @RegisterExtension27 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")28 public JOSMTestRules test = new JOSMTestRules().projectionNadGrids();29 20 30 21 /** -
trunk/test/unit/org/openstreetmap/josm/data/validation/OsmValidatorTest.java
r17275 r18870 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 … … 18 16 * Unit tests for class {@link OsmValidator}. 19 17 */ 18 @Projection 20 19 class OsmValidatorTest { 21 22 /**23 * Setup test.24 */25 @RegisterExtension26 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")27 public JOSMTestRules test = new JOSMTestRules().projection();28 29 20 /** 30 21 * Setup test. -
trunk/test/unit/org/openstreetmap/josm/data/validation/ValidatorCLITest.java
r18799 r18870 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; … … 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; 50 51 import jakarta.json.Json; 52 import jakarta.json.JsonObject; 53 import jakarta.json.JsonReader; 54 import mockit.Mock; 55 import mockit.MockUp; 55 56 56 57 /** … … 59 60 */ 60 61 @BasicPreferences 62 @Territories 61 63 class ValidatorCLITest { 62 64 @RegisterExtension -
trunk/test/unit/org/openstreetmap/josm/data/validation/tests/ConditionalKeysTest.java
r17434 r18870 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 21 /**22 * Setup test23 */24 @RegisterExtension25 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")26 public JOSMTestRules rule = new JOSMTestRules().presets();27 18 28 19 /** -
trunk/test/unit/org/openstreetmap/josm/data/validation/tests/CrossingWaysTest.java
r17430 r18870 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; … … 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 test38 */39 @RegisterExtension40 @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)); -
trunk/test/unit/org/openstreetmap/josm/data/validation/tests/MultipolygonTestTest.java
r17275 r18870 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 @RegisterExtension29 @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. -
trunk/test/unit/org/openstreetmap/josm/data/validation/tests/RelationCheckerTest.java
r18376 r18870 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; … … 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 @RegisterExtension31 @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(); -
trunk/test/unit/org/openstreetmap/josm/data/validation/tests/TagCheckerTest.java
r18690 r18870 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; … … 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 @RegisterExtension36 @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() { -
trunk/test/unit/org/openstreetmap/josm/data/validation/tests/TurnRestrictionTestTest.java
r18690 r18870 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 19 /**20 * Setup test.21 */22 @RegisterExtension23 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")24 public JOSMTestRules test = new JOSMTestRules().projection().mapStyles().presets().main();25 22 26 23 /** -
trunk/test/unit/org/openstreetmap/josm/data/validation/tests/UnclosedWaysTest.java
r17275 r18870 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; … … 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 @RegisterExtension34 @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<>(); -
trunk/test/unit/org/openstreetmap/josm/data/vector/VectorDataSetTest.java
r18478 r18870 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; … … 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 /** … … 63 63 } 64 64 } 65 66 @RegisterExtension67 JOSMTestRules rule = new JOSMTestRules().projection();68 65 69 66 /** -
trunk/test/unit/org/openstreetmap/josm/data/vector/VectorNodeTest.java
r18477 r18870 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; … … 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 /** … … 32 31 * @since 17862 33 32 */ 33 @Projection 34 34 class VectorNodeTest { 35 @RegisterExtension36 JOSMTestRules rule = new JOSMTestRules().projection();37 38 35 @Test 39 36 void testLatLon() { -
trunk/test/unit/org/openstreetmap/josm/gui/MapScalerTest.java
r17275 r18870 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; … … 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 tests27 */28 @RegisterExtension29 @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}. -
trunk/test/unit/org/openstreetmap/josm/gui/MapViewStateTest.java
r18690 r18870 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; … … 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 /** … … 23 22 * @author Michael Zangl 24 23 */ 24 @Projection 25 25 class MapViewStateTest { 26 26 … … 28 28 private static final int HEIGHT = 200; 29 29 private MapViewState state; 30 31 /**32 * Setup test.33 */34 @BeforeAll35 public static void setUpBeforeClass() {36 JOSMFixture.createUnitTestFixture().init();37 }38 30 39 31 /** -
trunk/test/unit/org/openstreetmap/josm/gui/NavigatableComponentTest.java
r18690 r18870 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; … … 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 /** … … 41 39 * 42 40 */ 41 @BasicPreferences 42 @Projection // We need the projection for coordinate conversions. 43 43 class NavigatableComponentTest { 44 44 … … 63 63 private static final int WIDTH = 300; 64 64 private NavigatableComponentMock component; 65 66 /**67 * We need the projection for coordinate conversions.68 */69 @RegisterExtension70 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")71 public JOSMTestRules test = new JOSMTestRules().preferences().projection();72 65 73 66 /** … … 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)} -
trunk/test/unit/org/openstreetmap/josm/gui/TableCellRendererTest.java
r18690 r18870 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 24 import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;25 22 26 23 /** … … 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 … … 40 37 * @see <a href="https://josm.openstreetmap.de/ticket/6301">#6301</a> 41 38 */ 39 @Main 42 40 class TableCellRendererTest { 43 41 … … 49 47 50 48 /** 51 * Setup test.52 */53 @RegisterExtension54 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")55 public JOSMTestRules test = new JOSMTestRules().main();56 57 /**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 class60 * or add the class to the SKIP_TEST list above61 * @throws ReflectiveOperationException if an error occurs62 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 -
trunk/test/unit/org/openstreetmap/josm/gui/datatransfer/OsmTransferHandlerTest.java
r18610 r18870 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; … … 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 primitives38 */39 @RegisterExtension40 @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 -
trunk/test/unit/org/openstreetmap/josm/gui/dialogs/CommandStackDialogTest.java
r17347 r18870 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; … … 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 tests27 */28 @RegisterExtension29 @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. -
trunk/test/unit/org/openstreetmap/josm/gui/dialogs/FilterDialogTest.java
r18571 r18870 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 … … 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 30 @RegisterExtension31 static JOSMTestRules josmTestRules = new JOSMTestRules().main();32 29 33 30 @ParameterizedTest -
trunk/test/unit/org/openstreetmap/josm/gui/dialogs/InspectPrimitiveDialogTest.java
r18555 r18870 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; … … 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 tests34 */35 @RegisterExtension36 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")37 static JOSMTestRules test = new JOSMTestRules().main().projection().mapStyles();38 39 33 /** 40 34 * Setup test … … 43 37 public void setUp() { 44 38 SystemOfMeasurement.PROP_SYSTEM_OF_MEASUREMENT.put("METRIC"); 45 46 39 } 47 40 -
trunk/test/unit/org/openstreetmap/josm/gui/dialogs/MapPaintDialogTest.java
r17275 r18870 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 tests20 */21 @RegisterExtension22 @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. -
trunk/test/unit/org/openstreetmap/josm/gui/dialogs/NotesDialogTest.java
r18839 r18870 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; … … 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 … … 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 @RegisterExtension49 JOSMTestRules rules = new JOSMTestRules().main().projection();50 50 private Note createMultiLineNote() { 51 51 Note note = new Note(LatLon.ZERO); -
trunk/test/unit/org/openstreetmap/josm/gui/dialogs/changeset/ChangesetContentPanelTest.java
r18037 r18870 2 2 package org.openstreetmap.josm.gui.dialogs.changeset; 3 3 4 import static org.junit.jupiter.api.Assertions.assert NotNull;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 tests19 */20 @RegisterExtension21 @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}. … … 27 19 @Test 28 20 void testChangesetContentPanel() { 29 assert NotNull(new ChangesetContentPanel());21 assertDoesNotThrow(ChangesetContentPanel::new); 30 22 } 31 23 } -
trunk/test/unit/org/openstreetmap/josm/gui/dialogs/layer/LayerVisibilityActionTest.java
r18018 r18870 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; … … 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 @RegisterExtension28 @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. -
trunk/test/unit/org/openstreetmap/josm/gui/dialogs/properties/PropertiesCellRendererTest.java
r17275 r18870 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 @RegisterExtension27 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")28 public JOSMTestRules test = new JOSMTestRules().preferences();29 30 20 /** 31 21 * Test of color rendering. -
trunk/test/unit/org/openstreetmap/josm/gui/dialogs/properties/PropertiesDialogTest.java
r18586 r18870 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; … … 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 … … 33 33 * Unit tests of {@link PropertiesDialog} class. 34 34 */ 35 @BasicPreferences 35 @BasicPreferences(true) 36 @Main 37 @Projection 36 38 class PropertiesDialogTest { 37 @RegisterExtension38 static JOSMTestRules rules = new JOSMTestRules().main().projection();39 39 40 40 private static String createSearchSetting(List<OsmPrimitive> sel, boolean sameType) { -
trunk/test/unit/org/openstreetmap/josm/gui/dialogs/relation/actions/AbstractRelationEditorActionTest.java
r17275 r18870 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; … … 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 /** … … 32 30 */ 33 31 @Disabled 32 @BasicPreferences 33 @Main 34 34 public abstract class AbstractRelationEditorActionTest { 35 /**36 * Platform for tooltips.37 */38 @RegisterExtension39 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")40 public JOSMTestRules test = new JOSMTestRules().preferences().main();41 42 35 protected OsmDataLayer layer; 43 36 -
trunk/test/unit/org/openstreetmap/josm/gui/dialogs/relation/sort/RelationSorterTest.java
r18690 r18870 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; … … 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 34 /**35 * Use Mercator projection36 */37 @RegisterExtension38 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")39 public JOSMTestRules test = new JOSMTestRules().preferences().projection();40 33 41 34 /** -
trunk/test/unit/org/openstreetmap/josm/gui/dialogs/relation/sort/WayConnectionTypeCalculatorTest.java
r18690 r18870 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; … … 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 … … 39 39 private final WayConnectionTypeCalculator wayConnectionTypeCalculator = new WayConnectionTypeCalculator(); 40 40 private DataSet testDataset; 41 42 /**43 * Use Mercator projection44 */45 @RegisterExtension46 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")47 public JOSMTestRules test = new JOSMTestRules().preferences().projection();48 41 49 42 /** -
trunk/test/unit/org/openstreetmap/josm/gui/help/HelpContentReaderTest.java
r17275 r18870 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 tests20 */21 @RegisterExtension22 @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. -
trunk/test/unit/org/openstreetmap/josm/gui/history/HistoryBrowserModelTest.java
r17890 r18870 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; … … 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 @RegisterExtension34 @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}. -
trunk/test/unit/org/openstreetmap/josm/gui/history/HistoryLoadTaskTest.java
r18690 r18870 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; … … 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 import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;28 27 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 @RegisterExtension38 @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} -
trunk/test/unit/org/openstreetmap/josm/gui/io/AsynchronousUploadPrimitivesTaskTest.java
r18690 r18870 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; … … 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 28 import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;29 26 30 27 /** 31 28 * Unit tests of {@link AsynchronousUploadPrimitivesTask}. 32 29 */ 30 @AssertionsInEDT 33 31 class AsynchronousUploadPrimitivesTaskTest { 34 32 … … 38 36 private Changeset changeset; 39 37 private AsynchronousUploadPrimitivesTask uploadPrimitivesTask; 40 41 /**42 * Setup tests43 */44 @RegisterExtension45 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")46 public JOSMTestRules test = new JOSMTestRules().assertionsInEDT();47 38 48 39 /** -
trunk/test/unit/org/openstreetmap/josm/gui/io/DownloadOpenChangesetsTaskTest.java
r18650 r18870 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; … … 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; … … 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 tests40 */41 @RegisterExtension42 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")43 public JOSMTestRules test = new JOSMTestRules().preferences().devAPI();44 45 38 /** 46 39 * OAuth wizard mocker. -
trunk/test/unit/org/openstreetmap/josm/gui/io/DownloadPrimitivesTaskTest.java
r17275 r18870 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 tests27 */28 @RegisterExtension29 @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. … … 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)); -
trunk/test/unit/org/openstreetmap/josm/gui/io/UploadStrategySelectionPanelTest.java
r17275 r18870 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 tests21 */22 @RegisterExtension23 @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}. -
trunk/test/unit/org/openstreetmap/josm/gui/layer/AbstractTileSourceLayerTest.java
r17275 r18870 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; … … 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; … … 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 test45 */46 @RegisterExtension47 @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() { … … 203 196 @Test 204 197 void testTileSourceLayerPopup() { 205 assert NotNull(testLayer.new TileSourceLayerPopup(100, 100));198 assertDoesNotThrow(() -> testLayer.new TileSourceLayerPopup(100, 100)); 206 199 } 207 200 } -
trunk/test/unit/org/openstreetmap/josm/gui/layer/AutosaveTaskTest.java
r17841 r18870 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; … … 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 @RegisterExtension43 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")44 public JOSMTestRules test = new JOSMTestRules().preferences().projection();45 46 40 private AutosaveTask task; 47 41 -
trunk/test/unit/org/openstreetmap/josm/gui/layer/LayerTest.java
r17275 r18870 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 /** … … 22 20 * @author Michael Zangl 23 21 */ 22 @BasicPreferences 23 /* We need projection */ 24 @Projection 24 25 class LayerTest { 25 /**26 * We need projection27 */28 @RegisterExtension29 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")30 public JOSMTestRules test = new JOSMTestRules().preferences().projection();31 32 26 private Layer testLayer; 33 27 -
trunk/test/unit/org/openstreetmap/josm/gui/layer/OsmDataLayerTest.java
r18753 r18870 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; … … 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 41 import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;42 40 43 41 /** 44 42 * Unit tests of {@link OsmDataLayer} class. 45 43 */ 44 @Main 45 @Projection 46 46 class OsmDataLayerTest { 47 48 /**49 * Setup tests50 */51 @RegisterExtension52 @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; -
trunk/test/unit/org/openstreetmap/josm/gui/layer/TMSLayerTest.java
r17275 r18870 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 tests22 */23 @RegisterExtension24 @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. -
trunk/test/unit/org/openstreetmap/josm/gui/layer/ValidatorLayerTest.java
r17275 r18870 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 tests24 */25 @RegisterExtension26 @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}. -
trunk/test/unit/org/openstreetmap/josm/gui/layer/WMSLayerTest.java
r17275 r18870 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 tests23 */24 @RegisterExtension25 @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}. … … 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 } -
trunk/test/unit/org/openstreetmap/josm/gui/layer/WMTSLayerTest.java
r17275 r18870 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 tests21 */22 @RegisterExtension23 @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}. -
trunk/test/unit/org/openstreetmap/josm/gui/layer/geoimage/GeoImageLayerTest.java
r18614 r18870 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 /** … … 19 17 // Basic preferences are needed for OSM primitives 20 18 @BasicPreferences 19 @Main 21 20 class GeoImageLayerTest { 22 @RegisterExtension23 static JOSMTestRules josmTestRules = new JOSMTestRules().main();24 25 21 /** 26 22 * Test that {@link GeoImageLayer#mergeFrom} throws IAE for invalid arguments -
trunk/test/unit/org/openstreetmap/josm/gui/layer/geoimage/ImagesLoaderTest.java
r18689 r18870 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 @RegisterExtension31 @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. -
trunk/test/unit/org/openstreetmap/josm/gui/layer/imagery/MVTLayerTest.java
r18191 r18870 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; … … 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 /** … … 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/mapview45 @RegisterExtension46 JOSMTestRules josmTestRules = new JOSMTestRules().main().projection();47 48 47 MVTLayer testLayer; 49 48 … … 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 } … … 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 { … … 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 } … … 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 … … 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(); -
trunk/test/unit/org/openstreetmap/josm/gui/layer/markerlayer/ImageMarkerTest.java
r18634 r18870 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 /** … … 21 20 */ 22 21 @BasicPreferences 22 @Main 23 23 class ImageMarkerTest { 24 @RegisterExtension25 static JOSMTestRules josmTestRules = new JOSMTestRules().main();26 27 24 /** 28 25 * Unit test of {@link ImageMarker#ImageMarker}. -
trunk/test/unit/org/openstreetmap/josm/gui/layer/markerlayer/MarkerLayerTest.java
r17275 r18870 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; … … 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 layers35 */36 @RegisterExtension37 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")38 public JOSMTestRules test = new JOSMTestRules().main().preferences().projection();39 40 34 /** 41 35 * Setup tests … … 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); -
trunk/test/unit/org/openstreetmap/josm/gui/mappaint/mapcss/ChildOrParentSelectorTest.java
r17275 r18870 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; … … 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 38 /**39 * Setup rule40 */41 @RegisterExtension42 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")43 public JOSMTestRules test = new JOSMTestRules().projection();44 35 45 36 /** -
trunk/test/unit/org/openstreetmap/josm/gui/mappaint/mapcss/FunctionsTest.java
r18829 r18870 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 … … 172 173 * Unit test of {@link Functions#JOSM_pref}, color handling 173 174 */ 175 @MapPaintStyles 174 176 @Test 175 177 void testPrefColor() { -
trunk/test/unit/org/openstreetmap/josm/gui/mappaint/mapcss/KeyConditionTest.java
r18451 r18870 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; … … 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 37 import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;38 35 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 46 /**47 * Setup rule48 */49 @RegisterExtension50 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")51 public JOSMTestRules test = new JOSMTestRules().projection();52 43 53 44 /** … … 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 */ -
trunk/test/unit/org/openstreetmap/josm/gui/mappaint/mapcss/KeyValueConditionTest.java
r17275 r18870 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; … … 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 27 import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;28 25 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 36 /**37 * Setup rule38 */39 @RegisterExtension40 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")41 public JOSMTestRules test = new JOSMTestRules().projection();42 33 43 34 /** -
trunk/test/unit/org/openstreetmap/josm/gui/mappaint/mapcss/MapCSSParserTest.java
r18690 r18870 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; … … 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 48 import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;49 46 50 47 /** 51 48 * Unit tests of {@link MapCSSParser}. 52 49 */ 50 @Projection 53 51 class MapCSSParserTest { 54 52 … … 60 58 return new MapCSSParser(new StringReader(stringToParse)); 61 59 } 62 63 /**64 * Setup rule65 */66 @RegisterExtension67 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")68 public JOSMTestRules test = new JOSMTestRules().projection();69 60 70 61 @Test -
trunk/test/unit/org/openstreetmap/josm/gui/mappaint/mapcss/ParsingLinkSelectorTest.java
r17275 r18870 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 rule19 */20 @RegisterExtension21 @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); … … 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); … … 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); … … 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); -
trunk/test/unit/org/openstreetmap/josm/gui/preferences/advanced/ExportProfileActionTest.java
r17275 r18870 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 15 import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;16 14 17 15 /** 18 16 * Unit tests of {@link ExportProfileAction} class. 19 17 */ 18 @AssertionsInEDT 19 @BasicPreferences 20 20 class ExportProfileActionTest { 21 /**22 * Setup tests23 */24 @RegisterExtension25 @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}. -
trunk/test/unit/org/openstreetmap/josm/gui/preferences/advanced/PreferencesTableTest.java
r17275 r18870 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; … … 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 23 import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;24 22 25 23 /** 26 24 * Unit tests of {@link PreferencesTable} class. 27 25 */ 26 @AssertionsInEDT 27 @BasicPreferences 28 28 class PreferencesTableTest { 29 /**30 * Setup tests31 */32 @RegisterExtension33 @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); … … 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 -
trunk/test/unit/org/openstreetmap/josm/gui/preferences/imagery/ImageryPreferenceTest.java
r17275 r18870 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 tests25 */26 @RegisterExtension27 @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}. … … 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 } -
trunk/test/unit/org/openstreetmap/josm/gui/preferences/imagery/ImageryPreferenceTestIT.java
r18690 r18870 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; … … 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); -
trunk/test/unit/org/openstreetmap/josm/gui/preferences/plugin/PluginPreferenceTest.java
r17275 r18870 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; … … 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 23 import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;24 21 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 @RegisterExtension33 @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}. … … 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() { -
trunk/test/unit/org/openstreetmap/josm/gui/tagging/presets/TaggingPresetReaderTest.java
r18853 r18870 78 78 */ 79 79 @Test 80 void testReadDefaul Presets() 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); -
trunk/test/unit/org/openstreetmap/josm/gui/tagging/presets/TaggingPresetValidationTest.java
r18051 r18870 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; … … 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; … … 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 @RegisterExtension33 @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 } … … 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")); -
trunk/test/unit/org/openstreetmap/josm/gui/tagging/presets/TaggingPresetsTest.java
r18690 r18870 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; … … 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; 25 26 import net.trajano.commons.testing.UtilityClassTestUtil; 28 27 29 28 /** 30 29 * Unit tests of {@link TaggingPresets} class. 31 30 */ 31 @Main 32 32 public class TaggingPresetsTest { 33 34 /**35 * Setup rule36 */37 @RegisterExtension38 @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. -
trunk/test/unit/org/openstreetmap/josm/gui/tagging/presets/items/CheckTest.java
r17609 r18870 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 @RegisterExtension25 @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}. -
trunk/test/unit/org/openstreetmap/josm/gui/tagging/presets/items/ComboTest.java
r18260 r18870 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 @RegisterExtension29 @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}. -
trunk/test/unit/org/openstreetmap/josm/gui/tagging/presets/items/MultiSelectTest.java
r18853 r18870 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 /** -
trunk/test/unit/org/openstreetmap/josm/gui/tagging/presets/items/PresetLinkTest.java
r17609 r18870 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 @RegisterExtension26 @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}. -
trunk/test/unit/org/openstreetmap/josm/gui/tagging/presets/items/TextTest.java
r17609 r18870 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 @RegisterExtension25 @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}. -
trunk/test/unit/org/openstreetmap/josm/io/GeoJSONWriterTest.java
r17275 r18870 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; … … 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 @BeforeAll30 public static void setUp() {31 JOSMFixture.createUnitTestFixture().init();32 }33 34 25 /** 35 26 * Unit test for Point -
trunk/test/unit/org/openstreetmap/josm/io/ValidatorErrorWriterTest.java
r18000 r18870 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; … … 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; … … 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 rule32 */33 @RegisterExtension34 @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 { … … 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'>" -
trunk/test/unit/org/openstreetmap/josm/io/imagery/WMSImageryTest.java
r18106 r18870 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 test33 */34 @RegisterExtension35 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")36 JOSMTestRules test = new JOSMTestRules().projection();37 38 30 @BasicWiremock 39 31 WireMockServer tileServer; -
trunk/test/unit/org/openstreetmap/josm/io/remotecontrol/handler/AddNodeHandlerTest.java
r17275 r18870 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; … … 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 @RegisterExtension26 @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(); … … 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 } … … 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 } … … 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 } … … 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 } -
trunk/test/unit/org/openstreetmap/josm/io/remotecontrol/handler/ImportHandlerTest.java
r17275 r18870 2 2 package org.openstreetmap.josm.io.remotecontrol.handler; 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.assertDoesNotThrow;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; … … 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 19 import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;20 17 21 18 /** 22 19 * Unit tests of {@link ImportHandler} class. 23 20 */ 21 @Main 24 22 class ImportHandlerTest { 25 /**26 * Setup test.27 */28 @RegisterExtension29 @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(); … … 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 … … 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 } … … 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 } -
trunk/test/unit/org/openstreetmap/josm/io/session/SessionWriterTest.java
r18690 r18870 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; … … 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 48 import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;49 47 50 48 /** 51 49 * Unit tests for Session writing. 52 50 */ 51 @Main 52 @Projection 53 53 public class SessionWriterTest { 54 54 … … 96 96 } 97 97 } 98 99 /**100 * Setup tests.101 */102 @RegisterExtension103 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")104 public JOSMTestRules test = new JOSMTestRules().projection().main();105 98 106 99 /** -
trunk/test/unit/org/openstreetmap/josm/plugins/PluginHandlerJOSMTooOldTest.java
r18694 r18870 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; … … 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; 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 37 38 38 /** … … 41 41 @AssumeRevision("Revision: 6000\n") 42 42 @FullPreferences 43 @Main 43 44 class PluginHandlerJOSMTooOldTest { 44 /**45 * Setup test.46 */47 @RegisterExtension48 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")49 static JOSMTestRules test = new JOSMTestRules().main();50 51 45 /** 52 46 * Plugin server mock. -
trunk/test/unit/org/openstreetmap/josm/plugins/PluginHandlerMultiVersionTest.java
r18694 r18870 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; … … 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; 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 35 36 36 /** … … 38 38 */ 39 39 @FullPreferences 40 @Main 40 41 class PluginHandlerMultiVersionTest { 41 /**42 * Setup test.43 */44 @RegisterExtension45 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")46 static JOSMTestRules test = new JOSMTestRules().main();47 48 42 /** 49 43 * Plugin server mock. -
trunk/test/unit/org/openstreetmap/josm/testutils/JOSMTestRules.java
r18690 r18870 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; … … 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; … … 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; … … 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; … … 82 84 83 85 import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; 86 import mockit.internal.state.SavePoint; 84 87 85 88 /** … … 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 … … 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()) { … … 652 656 cleanLayerEnvironment(); 653 657 Preferences.main().resetToInitialState(); 654 System.gc();658 JosmDefaults.DefaultsExtension.memoryCleanup(); 655 659 } 656 660 … … 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(); … … 718 723 719 724 // Parts of JOSM uses weak references - destroy them. 720 System.gc();725 JosmDefaults.DefaultsExtension.memoryCleanup(); 721 726 } 722 727 -
trunk/test/unit/org/openstreetmap/josm/testutils/annotations/BasicPreferences.java
r18694 r18870 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 … … 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 /** … … 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 } -
trunk/test/unit/org/openstreetmap/josm/testutils/annotations/I18n.java
r18694 r18870 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; … … 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 … … 23 23 */ 24 24 @Documented 25 @Inherited 25 26 @Retention(RetentionPolicy.RUNTIME) 26 27 @Target({ElementType.TYPE, ElementType.METHOD}) … … 42 43 @Override 43 44 public void beforeEach(ExtensionContext context) { 44 String language = Annotation Support.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); -
trunk/test/unit/org/openstreetmap/josm/testutils/annotations/JosmDefaults.java
r18853 r18870 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; … … 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 /** … … 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()) { … … 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 … … 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 } -
trunk/test/unit/org/openstreetmap/josm/testutils/annotations/Territories.java
r18798 r18870 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; … … 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 { … … 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 } -
trunk/test/unit/org/openstreetmap/josm/tools/ExceptionUtilTest.java
r17840 r18870 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; … … 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 28 import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;29 26 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 @RegisterExtension39 @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; -
trunk/test/unit/org/openstreetmap/josm/tools/LanguageInfoTest.java
r18690 r18870 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 @RegisterExtension27 @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; -
trunk/test/unit/org/openstreetmap/josm/tools/OsmPrimitiveImageProviderTest.java
r17275 r18870 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 24 import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;25 20 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 @RegisterExtension35 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")36 public JOSMTestRules test = new JOSMTestRules().mapStyles().presets();37 38 /**39 * Setup test.40 */41 @BeforeAll42 public static void setUp() {43 JOSMFixture.createUnitTestFixture().init();44 }45 46 27 /** 47 28 * Unit test of {@link OsmPrimitiveImageProvider#getResource}. -
trunk/test/unit/org/openstreetmap/josm/tools/TerritoriesTestIT.java
r17275 r18870 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 @RegisterExtension24 @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. -
trunk/test/unit/org/openstreetmap/josm/tools/date/DateUtilsTest.java
r18735 r18870 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; 26 27 import net.trajano.commons.testing.UtilityClassTestUtil; 28 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 @RegisterExtension40 @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. -
trunk/test/unit/org/openstreetmap/josm/tools/date/IntervalTest.java
r17845 r18870 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 @RegisterExtension21 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")22 public JOSMTestRules test = new JOSMTestRules().preferences();23 24 15 /** 25 16 * Setup test.
Note:
See TracChangeset
for help on using the changeset viewer.