Changeset 18893 in josm for trunk/test
- Timestamp:
- 2023-11-02T13:14:51+01:00 (14 months ago)
- Location:
- trunk/test
- Files:
-
- 4 added
- 31 edited
- 1 moved
Legend:
- Unmodified
- Added
- Removed
-
trunk/test/functional/org/openstreetmap/josm/io/OsmServerBackreferenceReaderTest.java
r17275 r18893 12 12 import java.io.FileInputStream; 13 13 import java.io.FileNotFoundException; 14 import java.io.FileOutputStream;15 14 import java.io.IOException; 16 15 import java.io.OutputStreamWriter; 17 16 import java.io.PrintWriter; 18 17 import java.nio.charset.StandardCharsets; 18 import java.nio.file.Files; 19 19 import java.text.MessageFormat; 20 20 import java.util.HashSet; … … 26 26 import org.junit.jupiter.api.BeforeEach; 27 27 import org.junit.jupiter.api.Test; 28 import org.openstreetmap.josm.JOSMFixture;29 28 import org.openstreetmap.josm.TestUtils; 30 29 import org.openstreetmap.josm.data.APIDataSet; … … 43 42 import org.openstreetmap.josm.gui.progress.NullProgressMonitor; 44 43 import org.openstreetmap.josm.spi.preferences.Config; 44 import org.openstreetmap.josm.testutils.annotations.TestUser; 45 import org.openstreetmap.josm.tools.JosmRuntimeException; 45 46 import org.openstreetmap.josm.tools.Logging; 46 47 … … 52 53 */ 53 54 @SuppressFBWarnings(value = "CRLF_INJECTION_LOGS") 55 @org.openstreetmap.josm.testutils.annotations.OsmApi(org.openstreetmap.josm.testutils.annotations.OsmApi.APIType.DEV) 56 @TestUser 54 57 class OsmServerBackreferenceReaderTest { 55 58 private static final Logger logger = Logger.getLogger(OsmServerBackreferenceReader.class.getName()); … … 76 79 } 77 80 fail("Cannot find relation "+i); 78 return null;81 throw new JosmRuntimeException("Cannot reach this point due to fail() above"); 79 82 } 80 83 … … 166 169 logger.info("initializing ..."); 167 170 168 JOSMFixture.createFunctionalTestFixture().init();169 170 171 Config.getPref().put("osm-server.auth-method", "basic"); 171 172 … … 197 198 try ( 198 199 PrintWriter pw = new PrintWriter( 199 new OutputStreamWriter( new FileOutputStream(dataSetCacheOutputFile), StandardCharsets.UTF_8)200 new OutputStreamWriter(Files.newOutputStream(dataSetCacheOutputFile.toPath()), StandardCharsets.UTF_8) 200 201 )) { 201 202 logger.info(MessageFormat.format("caching test data set in ''{0}'' ...", dataSetCacheOutputFile.toString())); -
trunk/test/performance/org/openstreetmap/josm/gui/mappaint/mapcss/MapCSSStyleSourceFilterPerformanceTest.java
r18892 r18893 19 19 @Projection 20 20 @Timeout(value = 15, unit = TimeUnit.MINUTES) 21 class MapCSSStyleSourceFilter Test {21 class MapCSSStyleSourceFilterPerformanceTest { 22 22 23 23 private static final int TEST_RULE_COUNT = 10000; -
trunk/test/unit/org/openstreetmap/josm/actions/downloadtasks/AbstractDownloadTaskTestParent.java
r18106 r18893 6 6 import static com.github.tomakehurst.wiremock.client.WireMock.urlEqualTo; 7 7 8 import org.junit.jupiter.api.extension.RegisterExtension;9 import org.openstreetmap.josm.testutils.JOSMTestRules;10 8 import org.openstreetmap.josm.testutils.annotations.BasicWiremock; 9 import org.openstreetmap.josm.testutils.annotations.HTTPS; 11 10 12 11 import com.github.tomakehurst.wiremock.WireMockServer; 13 14 import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;15 12 16 13 /** 17 14 * Superclass of {@link DownloadGpsTaskTest}, {@link DownloadOsmTaskTest} and {@link DownloadNotesTaskTest}. 18 15 */ 16 @BasicWiremock 17 @HTTPS 19 18 public abstract class AbstractDownloadTaskTestParent { 20 21 /**22 * Setup test.23 */24 @RegisterExtension25 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")26 JOSMTestRules test = new JOSMTestRules().https();27 28 19 /** 29 20 * HTTP mock. -
trunk/test/unit/org/openstreetmap/josm/actions/downloadtasks/DownloadGpsTaskTest.java
r18106 r18893 10 10 import org.junit.jupiter.api.Test; 11 11 import org.openstreetmap.josm.data.gpx.GpxData; 12 import org.openstreetmap.josm.testutils.annotations.BasicWiremock;13 12 14 13 /** 15 14 * Unit tests for class {@link DownloadGpsTask}. 16 15 */ 17 @BasicWiremock18 16 class DownloadGpsTaskTest extends AbstractDownloadTaskTestParent { 19 17 -
trunk/test/unit/org/openstreetmap/josm/actions/downloadtasks/DownloadNotesTaskTest.java
r18106 r18893 10 10 import org.junit.jupiter.api.Test; 11 11 import org.openstreetmap.josm.data.osm.NoteData; 12 import org.openstreetmap.josm.testutils.annotations.BasicWiremock;13 12 14 13 /** 15 14 * Unit tests for class {@link DownloadNotesTask}. 16 15 */ 17 @BasicWiremock18 16 class DownloadNotesTaskTest extends AbstractDownloadTaskTestParent { 19 17 -
trunk/test/unit/org/openstreetmap/josm/actions/downloadtasks/DownloadOsmTaskTest.java
r18106 r18893 10 10 import org.junit.jupiter.api.Test; 11 11 import org.openstreetmap.josm.data.osm.DataSet; 12 import org.openstreetmap.josm.testutils.annotations.BasicWiremock;13 12 14 13 /** 15 14 * Unit tests for class {@link DownloadOsmTask}. 16 15 */ 17 @BasicWiremock18 16 class DownloadOsmTaskTest extends AbstractDownloadTaskTestParent { 19 17 -
trunk/test/unit/org/openstreetmap/josm/actions/downloadtasks/PluginDownloadTaskTest.java
r18106 r18893 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.Preferences; … … 19 18 import org.openstreetmap.josm.plugins.PluginDownloadTask; 20 19 import org.openstreetmap.josm.plugins.PluginInformation; 21 import org.openstreetmap.josm.testutils.JOSMTestRules; 22 import org.openstreetmap.josm.testutils.annotations.BasicPreferences; 23 import org.openstreetmap.josm.testutils.annotations.BasicWiremock; 20 import org.openstreetmap.josm.testutils.annotations.AssumeRevision; 24 21 import org.openstreetmap.josm.tools.Utils; 25 26 import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;27 22 28 23 /** 29 24 * Unit tests for class {@link PluginDownloadTask}. 30 25 */ 31 @BasicWiremock 32 @BasicPreferences 26 @AssumeRevision("Revision: 8000\n") 33 27 class PluginDownloadTaskTest extends AbstractDownloadTaskTestParent { 34 28 protected String pluginPath; 35 36 /**37 * Setup test.38 */39 @RegisterExtension40 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")41 public JOSMTestRules testRule = new JOSMTestRules().https().assumeRevision(42 "Revision: 8000\n"43 );44 29 45 30 @Override -
trunk/test/unit/org/openstreetmap/josm/data/oauth/SignpostAdaptersTest.java
r17275 r18893 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.oauth.SignpostAdapters.HttpRequest; 16 15 import org.openstreetmap.josm.data.oauth.SignpostAdapters.HttpResponse; 17 16 import org.openstreetmap.josm.data.oauth.SignpostAdapters.OAuthConsumer; 18 import org.openstreetmap.josm.testutils. JOSMTestRules;17 import org.openstreetmap.josm.testutils.annotations.HTTPS; 19 18 import org.openstreetmap.josm.tools.HttpClient; 20 19 21 import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;22 20 import net.trajano.commons.testing.UtilityClassTestUtil; 23 21 … … 25 23 * Unit tests for class {@link SignpostAdapters}. 26 24 */ 25 @HTTPS 27 26 class SignpostAdaptersTest { 28 29 /**30 * Setup test.31 */32 @RegisterExtension33 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")34 public JOSMTestRules test = new JOSMTestRules().https();35 27 36 28 private static HttpClient newClient() throws MalformedURLException { -
trunk/test/unit/org/openstreetmap/josm/data/validation/routines/DomainValidatorTestIT.java
r18691 r18893 46 46 import java.util.regex.Pattern; 47 47 48 import org.junit.jupiter.api.extension.RegisterExtension;49 48 import org.junit.jupiter.api.Test; 50 import org.openstreetmap.josm.testutils. JOSMTestRules;49 import org.openstreetmap.josm.testutils.annotations.HTTPS; 51 50 import org.openstreetmap.josm.tools.Logging; 52 51 … … 58 57 * @version $Revision: 1723861 $ 59 58 */ 59 @HTTPS 60 60 class DomainValidatorTestIT { 61 62 /**63 * Setup rule64 */65 @RegisterExtension66 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")67 public JOSMTestRules test = new JOSMTestRules().https();68 69 61 /** 70 62 * Download and process local copy of http://data.iana.org/TLD/tlds-alpha-by-domain.txt -
trunk/test/unit/org/openstreetmap/josm/gui/MainApplicationTest.java
r18690 r18893 35 35 import javax.swing.plaf.metal.MetalLookAndFeel; 36 36 37 import mockit.Mock;38 import mockit.MockUp;39 37 import org.awaitility.Awaitility; 40 38 import org.awaitility.Durations; 41 39 import org.junit.jupiter.api.Test; 42 import org.junit.jupiter.api. extension.RegisterExtension;40 import org.junit.jupiter.api.Timeout; 43 41 import org.openstreetmap.josm.TestUtils; 44 42 import org.openstreetmap.josm.actions.JosmAction; … … 57 55 import org.openstreetmap.josm.plugins.PluginListParser; 58 56 import org.openstreetmap.josm.spi.preferences.Config; 59 import org.openstreetmap.josm.testutils.JOSMTestRules; 57 import org.openstreetmap.josm.testutils.annotations.HTTPS; 58 import org.openstreetmap.josm.testutils.annotations.Main; 59 import org.openstreetmap.josm.testutils.annotations.OsmApi; 60 import org.openstreetmap.josm.testutils.annotations.Projection; 60 61 import org.openstreetmap.josm.tools.Logging; 61 62 import org.openstreetmap.josm.tools.PlatformManager; 62 63 import org.openstreetmap.josm.tools.Shortcut; 64 import org.openstreetmap.josm.tools.bugreport.BugReportQueue; 63 65 64 66 import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; 65 import org.openstreetmap.josm.tools.bugreport.BugReportQueue; 67 import mockit.Mock; 68 import mockit.MockUp; 66 69 67 70 /** 68 71 * Unit tests of {@link MainApplication} class. 69 72 */ 73 @HTTPS 74 @Main 75 @OsmApi(OsmApi.APIType.DEV) 76 @Projection 77 @Timeout(20) 70 78 public class MainApplicationTest { 71 72 /**73 * Setup test.74 */75 @RegisterExtension76 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")77 public JOSMTestRules test = new JOSMTestRules().main().projection().https().devAPI().timeout(20000);78 79 79 /** 80 80 * Make sure {@link MainApplication#contentPanePrivate} is initialized. … … 249 249 void testPostConstructorProcessCmdLineEmpty() { 250 250 // Check the method accepts no arguments 251 MainApplication.postConstructorProcessCmdLine(new ProgramArguments());251 assertDoesNotThrow(() -> MainApplication.postConstructorProcessCmdLine(new ProgramArguments())); 252 252 } 253 253 -
trunk/test/unit/org/openstreetmap/josm/gui/dialogs/MinimapDialogTest.java
r18694 r18893 28 28 import javax.swing.JPopupMenu; 29 29 30 import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;31 30 import org.awaitility.Awaitility; 32 import org.junit.Before; 33 import org.junit.Rule; 34 import org.junit.Test; 31 import org.junit.jupiter.api.Test; 35 32 import org.openstreetmap.josm.TestUtils; 36 33 import org.openstreetmap.josm.data.Bounds; 37 34 import org.openstreetmap.josm.data.DataSource; 38 import org.openstreetmap.josm.data.SystemOfMeasurement;39 35 import org.openstreetmap.josm.data.imagery.ImageryInfo; 40 36 import org.openstreetmap.josm.data.imagery.ImageryLayerInfo; … … 52 48 import org.openstreetmap.josm.spi.preferences.Config; 53 49 import org.openstreetmap.josm.testutils.ImagePatternMatching; 54 import org.openstreetmap.josm.testutils.JOSMTestRules; 50 import org.openstreetmap.josm.testutils.annotations.FakeImagery; 51 import org.openstreetmap.josm.testutils.annotations.Main; 52 import org.openstreetmap.josm.testutils.annotations.MeasurementSystem; 53 import org.openstreetmap.josm.testutils.annotations.Projection; 55 54 56 55 /** 57 56 * Unit tests of {@link MinimapDialog} class. 58 57 */ 59 public class MinimapDialogTest { 60 61 /** 62 * Setup tests 63 */ 64 @Rule 65 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") 66 public JOSMTestRules josmTestRules = new JOSMTestRules().main().projection().fakeImagery(); 67 68 @Before 69 public void beforeAll() { 70 // Needed since testShowDownloadedAreaLayerSwitching expects the measurement to be imperial 71 SystemOfMeasurement.setSystemOfMeasurement(SystemOfMeasurement.IMPERIAL); 72 } 73 58 @FakeImagery 59 @Main 60 @Projection 61 // Needed since testShowDownloadedAreaLayerSwitching expects the measurement to be imperial 62 @MeasurementSystem("Imperial") 63 class MinimapDialogTest { 74 64 /** 75 65 * Unit test of {@link MinimapDialog} class. 76 66 */ 77 67 @Test 78 publicvoid testMinimapDialog() {68 void testMinimapDialog() { 79 69 MinimapDialog dlg = new MinimapDialog(); 80 70 dlg.showDialog(); … … 206 196 */ 207 197 @Test 208 publicvoid testSourceSwitching() {198 void testSourceSwitching() { 209 199 // relevant prefs starting out empty, should choose the first source and have shown download area enabled 210 200 // (not that there's a data layer for it to use) … … 252 242 */ 253 243 @Test 254 publicvoid testRefreshSourcesRetainsSelection() {244 void testRefreshSourcesRetainsSelection() { 255 245 // relevant prefs starting out empty, should choose the first source and have shown download area enabled 256 246 // (not that there's a data layer for it to use) … … 289 279 */ 290 280 @Test 291 publicvoid testRemovedSourceStillSelected() {281 void testRemovedSourceStillSelected() { 292 282 // relevant prefs starting out empty, should choose the first source and have shown download area enabled 293 283 // (not that there's a data layer for it to use) … … 321 311 */ 322 312 @Test 323 publicvoid testTileSourcesFromCurrentLayers() {313 void testTileSourcesFromCurrentLayers() { 324 314 // relevant prefs starting out empty, should choose the first (ImageryLayerInfo) source and have shown download area enabled 325 315 // (not that there's a data layer for it to use) … … 454 444 */ 455 445 @Test 456 publicvoid testSourcePrefObeyed() {446 void testSourcePrefObeyed() { 457 447 Config.getPref().put("slippy_map_chooser.mapstyle", "Green Tiles"); 458 448 … … 480 470 */ 481 471 @Test 482 publicvoid testSourcePrefInvalid() {472 void testSourcePrefInvalid() { 483 473 Config.getPref().put("slippy_map_chooser.mapstyle", "Hooloovoo Tiles"); 484 474 … … 501 491 */ 502 492 @Test 503 publicvoid testViewportAspectRatio() {493 void testViewportAspectRatio() { 504 494 // Add a test layer to the layer manager to get the MapFrame & MapView 505 495 MainApplication.getLayerManager().addLayer(new TestLayer()); … … 640 630 */ 641 631 @Test 642 publicvoid testShowDownloadedArea() {632 void testShowDownloadedArea() { 643 633 Config.getPref().put("slippy_map_chooser.mapstyle", "Green Tiles"); 644 634 Config.getPref().putBoolean("slippy_map_chooser.show_downloaded_area", false); … … 798 788 */ 799 789 @Test 800 publicvoid testShowDownloadedAreaLayerSwitching() {790 void testShowDownloadedAreaLayerSwitching() { 801 791 Config.getPref().put("slippy_map_chooser.mapstyle", "Green Tiles"); 802 792 Config.getPref().putBoolean("slippy_map_chooser.show_downloaded_area", true); -
trunk/test/unit/org/openstreetmap/josm/gui/dialogs/layer/CycleLayerActionTest.java
r18690 r18893 5 5 import static org.openstreetmap.josm.tools.I18n.tr; 6 6 7 import org.junit.Before; 8 import org.junit.Rule; 9 import org.junit.Test; 7 import org.junit.jupiter.api.BeforeEach; 8 import org.junit.jupiter.api.Test; 10 9 import org.openstreetmap.josm.data.imagery.ImageryInfo; 11 10 import org.openstreetmap.josm.data.imagery.ImageryLayerInfo; … … 15 14 import org.openstreetmap.josm.gui.layer.MainLayerManager; 16 15 import org.openstreetmap.josm.gui.layer.OsmDataLayer; 17 import org.openstreetmap.josm.testutils. JOSMTestRules;18 19 import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;16 import org.openstreetmap.josm.testutils.annotations.FakeImagery; 17 import org.openstreetmap.josm.testutils.annotations.Main; 18 import org.openstreetmap.josm.testutils.annotations.Projection; 20 19 21 20 /** … … 24 23 * @author Taylor Smock 25 24 */ 26 public class CycleLayerActionTest { 27 /** Layers need a projection */ 28 @Rule 29 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") 30 public JOSMTestRules test = new JOSMTestRules().main().preferences().projection().fakeImagery(); 31 25 @FakeImagery 26 @Main 27 @Projection 28 class CycleLayerActionTest { 32 29 private CycleLayerDownAction cycleDown; 33 30 private CycleLayerUpAction cycleUp; … … 37 34 * Set up common items (make layers, etc.) 38 35 */ 39 @Before 40 publicvoid setUp() {36 @BeforeEach 37 void setUp() { 41 38 cycleDown = new CycleLayerDownAction(); 42 39 cycleUp = new CycleLayerUpAction(); … … 51 48 */ 52 49 @Test 53 publicvoid testDownBottom() {50 void testDownBottom() { 54 51 manager.setActiveLayer(manager.getLayers().get(0)); 55 52 cycleDown.actionPerformed(null); … … 61 58 */ 62 59 @Test 63 publicvoid testUpTop() {60 void testUpTop() { 64 61 manager.setActiveLayer(manager.getLayers().get(manager.getLayers().size() - 1)); 65 62 cycleUp.actionPerformed(null); … … 71 68 */ 72 69 @Test 73 publicvoid testDown() {70 void testDown() { 74 71 manager.setActiveLayer(manager.getLayers().get(3)); 75 72 cycleDown.actionPerformed(null); … … 81 78 */ 82 79 @Test 83 publicvoid testUp() {80 void testUp() { 84 81 manager.setActiveLayer(manager.getLayers().get(3)); 85 82 cycleUp.actionPerformed(null); … … 91 88 */ 92 89 @Test 93 publicvoid testNoLayers() {90 void testNoLayers() { 94 91 manager.getLayers().forEach(manager::removeLayer); 95 92 cycleUp.actionPerformed(null); … … 102 99 */ 103 100 @Test 104 publicvoid testWithAerialImagery() {101 void testWithAerialImagery() { 105 102 final ImageryInfo magentaTilesInfo = ImageryLayerInfo.instance.getLayers().stream() 106 103 .filter(i -> i.getName().equals("Magenta Tiles")).findAny().get(); -
trunk/test/unit/org/openstreetmap/josm/gui/help/HelpBrowserTest.java
r17121 r18893 10 10 11 11 import org.junit.jupiter.api.Test; 12 import org.junit.jupiter.api.extension.RegisterExtension;13 12 import org.openstreetmap.josm.TestUtils; 14 import org.openstreetmap.josm.testutils.JOSMTestRules; 13 import org.openstreetmap.josm.testutils.annotations.FullPreferences; 14 import org.openstreetmap.josm.testutils.annotations.HTTPS; 15 15 import org.openstreetmap.josm.testutils.mockers.JOptionPaneSimpleMocker; 16 16 import org.openstreetmap.josm.tools.LanguageInfo.LocaleType; … … 18 18 import org.openstreetmap.josm.tools.PlatformManager; 19 19 20 import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;21 20 import mockit.Expectations; 22 21 import mockit.Injectable; … … 26 25 * Unit tests of {@link HelpBrowser} class. 27 26 */ 27 @FullPreferences 28 @HTTPS 28 29 class HelpBrowserTest { 29 30 … … 31 32 static final String URL_2 = "https://josm.openstreetmap.de/wiki/Introduction"; 32 33 static final String URL_3 = "https://josm.openstreetmap.de/javadoc"; 33 34 /**35 * Setup tests36 */37 @RegisterExtension38 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")39 static JOSMTestRules test = new JOSMTestRules().preferences().https();40 34 41 35 static IHelpBrowser newHelpBrowser() { -
trunk/test/unit/org/openstreetmap/josm/gui/layer/GpxLayerTest.java
r18690 r18893 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.TestUtils; 27 26 import org.openstreetmap.josm.data.gpx.GpxData; … … 36 35 import org.openstreetmap.josm.gui.widgets.HtmlPanel; 37 36 import org.openstreetmap.josm.io.GpxReaderTest; 38 import org.openstreetmap.josm.testutils.JOSMTestRules; 37 import org.openstreetmap.josm.testutils.annotations.I18n; 38 import org.openstreetmap.josm.testutils.annotations.Main; 39 import org.openstreetmap.josm.testutils.annotations.MeasurementSystem; 40 import org.openstreetmap.josm.testutils.annotations.Projection; 39 41 import org.openstreetmap.josm.tools.date.DateUtils; 40 42 import org.xml.sax.SAXException; 41 42 import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;43 43 44 44 /** 45 45 * Unit tests of {@link GpxLayer} class. 46 46 */ 47 @I18n 48 @Main 49 @MeasurementSystem 50 @Projection 47 51 public class GpxLayerTest { 48 49 /**50 * Setup tests51 */52 @RegisterExtension53 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")54 public JOSMTestRules test = new JOSMTestRules().main().projection().i18n().metricSystem();55 56 52 /** 57 53 * Setup test. -
trunk/test/unit/org/openstreetmap/josm/gui/layer/MainLayerManagerTest.java
r18394 r18893 13 13 import java.util.logging.LogRecord; 14 14 15 import org.junit.jupiter.api.BeforeAll;16 15 import org.junit.jupiter.api.BeforeEach; 17 16 import org.junit.jupiter.api.Test; 18 import org.openstreetmap.josm.JOSMFixture;19 17 import org.openstreetmap.josm.data.osm.DataSet; 20 18 import org.openstreetmap.josm.gui.layer.MainLayerManager.ActiveLayerChangeEvent; … … 62 60 protected static class LoggingHandler extends Handler { 63 61 64 private List<LogRecord> records = new ArrayList<>();62 private final List<LogRecord> records = new ArrayList<>(); 65 63 66 64 @Override … … 79 77 } 80 78 81 }82 83 @BeforeAll84 public static void setUpClass() {85 JOSMFixture.createUnitTestFixture().init();86 79 } 87 80 … … 153 146 CapturingActiveLayerChangeListener listener2 = new CapturingActiveLayerChangeListener(); 154 147 layerManagerWithActive.addAndFireActiveLayerChangeListener(listener2); 155 assert Same(listener2.lastEvent.getPreviousActiveLayer(), null);156 assert Same(listener2.lastEvent.getPreviousDataLayer(), null);148 assertNull(listener2.lastEvent.getPreviousActiveLayer()); 149 assertNull(listener2.lastEvent.getPreviousDataLayer()); 157 150 158 151 layerManagerWithActive.setActiveLayer(layer1); -
trunk/test/unit/org/openstreetmap/josm/gui/layer/gpx/DownloadWmsAlongTrackActionTest.java
r18690 r18893 11 11 12 12 import org.awaitility.Awaitility; 13 import org.junit.Rule; 14 import org.junit.Test; 13 import org.junit.jupiter.api.Test; 14 import org.junit.jupiter.api.Timeout; 15 import org.openstreetmap.josm.TestUtils; 15 16 import org.openstreetmap.josm.actions.MergeLayerActionTest.MergeLayerExtendedDialogMocker; 16 17 import org.openstreetmap.josm.data.gpx.GpxData; … … 19 20 import org.openstreetmap.josm.gui.layer.TMSLayer; 20 21 import org.openstreetmap.josm.gui.layer.gpx.DownloadWmsAlongTrackAction.PrecacheWmsTask; 21 import org.openstreetmap.josm. TestUtils;22 import org.openstreetmap.josm.testutils. JOSMTestRules;23 import org.openstreetmap.josm.testutils. TileSourceRule;22 import org.openstreetmap.josm.testutils.annotations.FakeImagery; 23 import org.openstreetmap.josm.testutils.annotations.Main; 24 import org.openstreetmap.josm.testutils.annotations.Projection; 24 25 import org.openstreetmap.josm.testutils.mockers.JOptionPaneSimpleMocker; 25 26 import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;27 26 28 27 /** 29 28 * Unit tests of {@link DownloadWmsAlongTrackAction} class. 30 29 */ 31 public class DownloadWmsAlongTrackActionTest { 32 33 /** 34 * Setup test. 35 */ 36 @Rule 37 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") 38 public JOSMTestRules test = new JOSMTestRules().main().projection().fakeImagery().timeout(20000); 30 @FakeImagery 31 @Main 32 @Projection 33 @Timeout(20) 34 class DownloadWmsAlongTrackActionTest { 39 35 40 36 /** … … 42 38 */ 43 39 @Test 44 publicvoid testNoLayer() {40 void testNoLayer() { 45 41 TestUtils.assumeWorkingJMockit(); 46 42 final JOptionPaneSimpleMocker jopsMocker = new JOptionPaneSimpleMocker( … … 61 57 */ 62 58 @Test 63 public void testTMSLayer() throws Exception {59 void testTMSLayer(FakeImagery.FakeImageryWireMockExtension fakeImageryWireMockExtension) throws Exception { 64 60 TestUtils.assumeWorkingJMockit(); 65 61 final MergeLayerExtendedDialogMocker edMocker = new MergeLayerExtendedDialogMocker(); 66 62 edMocker.getMockResultMap().put("Please select the imagery layer.", "Download"); 67 63 68 final TileSourceRule tileSourceRule = this.test.getTileSourceRule();69 70 64 final TMSLayer layer = new TMSLayer( 71 tileSourceRule.getSourcesList().get(0).getImageryInfo(tileSourceRule.port())65 fakeImageryWireMockExtension.getSourcesList().get(0).getImageryInfo(fakeImageryWireMockExtension.getRuntimeInfo().getHttpPort()) 72 66 ); 73 67 try { -
trunk/test/unit/org/openstreetmap/josm/gui/layer/markerlayer/WebMarkerTest.java
r17275 r18893 7 7 8 8 import org.junit.jupiter.api.Test; 9 import org.junit.jupiter.api.extension.RegisterExtension;10 9 import org.openstreetmap.josm.TestUtils; 11 10 import org.openstreetmap.josm.data.coor.LatLon; 12 11 import org.openstreetmap.josm.data.gpx.GpxData; 13 12 import org.openstreetmap.josm.data.gpx.WayPoint; 14 import org.openstreetmap.josm.testutils.JOSMTestRules; 13 import org.openstreetmap.josm.testutils.annotations.FullPreferences; 14 import org.openstreetmap.josm.testutils.annotations.HTTPS; 15 import org.openstreetmap.josm.tools.PlatformHook; 15 16 import org.openstreetmap.josm.tools.PlatformManager; 16 import org.openstreetmap.josm.tools.PlatformHook;17 18 import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;19 17 20 18 import mockit.Expectations; … … 25 23 * Unit tests of {@link WebMarker} class. 26 24 */ 25 @FullPreferences 26 @HTTPS 27 27 class WebMarkerTest { 28 29 /**30 * Setup tests31 */32 @RegisterExtension33 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")34 public JOSMTestRules test = new JOSMTestRules().preferences().https();35 36 28 /** 37 29 * Unit test of {@link WebMarker#WebMarker}. -
trunk/test/unit/org/openstreetmap/josm/gui/mappaint/mapcss/MapCSSParserTestIT.java
r17275 r18893 4 4 import org.junit.jupiter.api.Disabled; 5 5 import org.junit.jupiter.api.Test; 6 import org.junit.jupiter.api.extension.RegisterExtension;7 6 import org.openstreetmap.josm.gui.mappaint.mapcss.parsergen.MapCSSParser; 8 import org.openstreetmap.josm.testutils.JOSMTestRules; 9 10 import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; 7 import org.openstreetmap.josm.testutils.annotations.HTTPS; 8 import org.openstreetmap.josm.testutils.annotations.Projection; 11 9 12 10 /** 13 11 * Integration tests of {@link MapCSSParser}. 14 12 */ 13 @HTTPS 14 @Projection 15 15 class MapCSSParserTestIT { 16 17 /**18 * Setup rule19 */20 @RegisterExtension21 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")22 public JOSMTestRules test = new JOSMTestRules().https().projection();23 24 16 /** 25 17 * Checks Kothic stylesheets -
trunk/test/unit/org/openstreetmap/josm/gui/preferences/imagery/ImageryPreferenceTestIT.java
r18870 r18893 30 30 import org.junit.jupiter.api.BeforeAll; 31 31 import org.junit.jupiter.api.Disabled; 32 import org.junit.jupiter.api. extension.RegisterExtension;32 import org.junit.jupiter.api.Timeout; 33 33 import org.junit.jupiter.api.parallel.Execution; 34 34 import org.junit.jupiter.api.parallel.ExecutionMode; … … 66 66 import org.openstreetmap.josm.io.imagery.ApiKeyProvider; 67 67 import org.openstreetmap.josm.io.imagery.WMSImagery.WMSGetCapabilitiesException; 68 import org.openstreetmap.josm.testutils.JOSMTestRules; 68 import org.openstreetmap.josm.testutils.annotations.HTTPS; 69 import org.openstreetmap.josm.testutils.annotations.I18n; 70 import org.openstreetmap.josm.testutils.annotations.ProjectionNadGrids; 69 71 import org.openstreetmap.josm.tools.HttpClient; 70 72 import org.openstreetmap.josm.tools.HttpClient.Response; … … 72 74 import org.openstreetmap.josm.tools.Utils; 73 75 74 import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;75 76 76 /** 77 77 * Integration tests of {@link ImageryPreference} class. 78 78 */ 79 @HTTPS 80 @I18n 81 @org.openstreetmap.josm.testutils.annotations.Projection 82 @ProjectionNadGrids 83 @Timeout(value = 40, unit = TimeUnit.MINUTES) 79 84 public class ImageryPreferenceTestIT { 80 85 … … 82 87 private static final LatLon GREENWICH = new LatLon(51.47810, -0.00170); 83 88 private static final int DEFAULT_ZOOM = 12; 84 85 /**86 * Setup rule87 */88 @RegisterExtension89 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")90 static JOSMTestRules test = new JOSMTestRules().https().i18n().preferences().projection().projectionNadGrids()91 .timeout((int) TimeUnit.MINUTES.toMillis(40));92 89 93 90 /** Entry to test */ -
trunk/test/unit/org/openstreetmap/josm/gui/preferences/map/MapPaintPreferenceTestIT.java
r17677 r18893 9 9 import java.util.ArrayList; 10 10 import java.util.List; 11 import java.util.concurrent.TimeUnit; 11 12 12 13 import org.junit.jupiter.api.BeforeAll; 13 import org.junit.jupiter.api. extension.RegisterExtension;14 import org.junit.jupiter.api.Timeout; 14 15 import org.junit.jupiter.params.ParameterizedTest; 15 16 import org.junit.jupiter.params.provider.MethodSource; … … 22 23 import org.openstreetmap.josm.gui.mappaint.mapcss.Instruction; 23 24 import org.openstreetmap.josm.gui.mappaint.mapcss.Instruction.AssignmentInstruction; 24 import org.openstreetmap.josm.gui.preferences.AbstractExtendedSourceEntryTestCase;25 25 import org.openstreetmap.josm.gui.mappaint.mapcss.MapCSSRule; 26 26 import org.openstreetmap.josm.gui.mappaint.mapcss.MapCSSStyleSource; 27 import org.openstreetmap.josm.testutils.JOSMTestRules; 27 import org.openstreetmap.josm.gui.preferences.AbstractExtendedSourceEntryTestCase; 28 import org.openstreetmap.josm.testutils.annotations.HTTPS; 28 29 import org.openstreetmap.josm.tools.ImageProvider; 29 30 import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;31 30 32 31 /** 33 32 * Integration tests of {@link MapPaintPreference} class. 34 33 */ 34 @HTTPS 35 @Timeout(value = 15, unit = TimeUnit.MINUTES) 35 36 class MapPaintPreferenceTestIT extends AbstractExtendedSourceEntryTestCase { 36 37 /**38 * Setup rule39 */40 @RegisterExtension41 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")42 public static JOSMTestRules test = new JOSMTestRules().https().timeout(15000*60).parameters();43 44 37 /** 45 38 * Setup test … … 66 59 * @param url URL 67 60 * @param source source entry to test 68 * @throws Exception in case of error69 61 */ 70 62 @ParameterizedTest(name = "{0} - {1}") 71 63 @MethodSource("data") 72 void testStyleValidity(String displayName, String url, ExtendedSourceEntry source) throws Exception{64 void testStyleValidity(String displayName, String url, ExtendedSourceEntry source) { 73 65 assumeFalse(isIgnoredSubstring(source, source.url)); 74 66 StyleSource style = MapPaintStyles.addStyle(source); -
trunk/test/unit/org/openstreetmap/josm/gui/preferences/map/TaggingPresetPreferenceTestIT.java
r17695 r18893 15 15 import java.util.Locale; 16 16 import java.util.Set; 17 import java.util.concurrent.TimeUnit; 17 18 18 19 import org.junit.jupiter.api.BeforeAll; 19 import org.junit.jupiter.api. extension.RegisterExtension;20 import org.junit.jupiter.api.Timeout; 20 21 import org.junit.jupiter.params.ParameterizedTest; 21 22 import org.junit.jupiter.params.provider.MethodSource; … … 28 29 import org.openstreetmap.josm.gui.tagging.presets.items.Link; 29 30 import org.openstreetmap.josm.spi.preferences.Config; 30 import org.openstreetmap.josm.testutils. JOSMTestRules;31 import org.openstreetmap.josm.testutils.annotations.HTTPS; 31 32 import org.openstreetmap.josm.tools.HttpClient; 32 33 import org.openstreetmap.josm.tools.HttpClient.Response; … … 35 36 import org.xml.sax.SAXException; 36 37 37 import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;38 39 38 /** 40 39 * Integration tests of {@link TaggingPresetPreference} class. 41 40 */ 41 @HTTPS 42 @Timeout(value = 20, unit = TimeUnit.MINUTES) 42 43 class TaggingPresetPreferenceTestIT extends AbstractExtendedSourceEntryTestCase { 43 44 /**45 * Setup rule46 */47 @RegisterExtension48 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")49 public static JOSMTestRules test = new JOSMTestRules().https().timeout(10000*120).parameters();50 51 44 /** 52 45 * Setup test … … 78 71 * @param url URL 79 72 * @param source source entry to test 80 * @throws Exception in case of error81 73 */ 82 74 @ParameterizedTest(name = "{0} - {1}") 83 75 @MethodSource("data") 84 void testPresetsValidity(String displayName, String url, ExtendedSourceEntry source) throws Exception{76 void testPresetsValidity(String displayName, String url, ExtendedSourceEntry source) { 85 77 assumeFalse(isIgnoredSubstring(source, source.url)); 86 78 List<String> ignoredErrors = new ArrayList<>(); -
trunk/test/unit/org/openstreetmap/josm/gui/preferences/validator/ValidatorTagCheckerRulesPreferenceTestIT.java
r17677 r18893 14 14 15 15 import org.junit.jupiter.api.BeforeAll; 16 import org.junit.jupiter.api. extension.RegisterExtension;16 import org.junit.jupiter.api.Timeout; 17 17 import org.junit.jupiter.api.parallel.Execution; 18 18 import org.junit.jupiter.api.parallel.ExecutionMode; … … 24 24 import org.openstreetmap.josm.data.validation.tests.MapCSSTagChecker.ParseResult; 25 25 import org.openstreetmap.josm.gui.preferences.AbstractExtendedSourceEntryTestCase; 26 import org.openstreetmap.josm.testutils.JOSMTestRules; 27 28 import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; 26 import org.openstreetmap.josm.testutils.annotations.HTTPS; 29 27 30 28 /** 31 29 * Integration tests of {@link ValidatorTagCheckerRulesPreference} class. 32 30 */ 31 @HTTPS 32 @Timeout(20) 33 33 class ValidatorTagCheckerRulesPreferenceTestIT extends AbstractExtendedSourceEntryTestCase { 34 35 /**36 * Setup rule37 */38 @RegisterExtension39 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")40 static JOSMTestRules test = new JOSMTestRules().https().timeout(20_000);41 42 34 /** 43 35 * Setup test -
trunk/test/unit/org/openstreetmap/josm/io/CertificateAmendmentTestIT.java
r18690 r18893 13 13 import javax.net.ssl.SSLHandshakeException; 14 14 15 import org.junit.ClassRule;16 15 import org.junit.jupiter.api.BeforeAll; 17 16 import org.junit.jupiter.api.Test; 17 import org.junit.jupiter.api.Timeout; 18 18 import org.openstreetmap.josm.TestUtils; 19 import org.openstreetmap.josm.testutils.JOSMTestRules; 20 21 import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; 19 import org.openstreetmap.josm.testutils.annotations.HTTPS; 22 20 23 21 /** 24 22 * Integration tests of {@link CertificateAmendment} class. 25 23 */ 24 @HTTPS 25 @Timeout(20) 26 26 class CertificateAmendmentTestIT { 27 28 /**29 * Setup rule30 */31 @ClassRule32 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")33 public static JOSMTestRules test = new JOSMTestRules().https().preferences().timeout(20000);34 35 27 private static final List<String> errorsToIgnore = new ArrayList<>(); 36 28 -
trunk/test/unit/org/openstreetmap/josm/io/NetworkManagerTest.java
r17275 r18893 10 10 import java.util.Map; 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.HTTPS; 14 import org.openstreetmap.josm.testutils.annotations.Main; 15 import org.openstreetmap.josm.testutils.annotations.OsmApi; 16 import org.openstreetmap.josm.testutils.annotations.Projection; 17 17 18 18 /** 19 19 * Unit tests of {@link NetworkManager} class. 20 20 */ 21 @HTTPS 22 @Main 23 @OsmApi(OsmApi.APIType.DEV) 24 @Projection 21 25 class NetworkManagerTest { 22 23 /**24 * Setup test.25 */26 @RegisterExtension27 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")28 public JOSMTestRules test = new JOSMTestRules().https().devAPI().main().projection();29 30 26 /** 31 27 * Unit test of {@link NetworkManager#addNetworkError}, -
trunk/test/unit/org/openstreetmap/josm/io/remotecontrol/RemoteControlTest.java
r17698 r18893 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.spi.preferences.Config; 18 import org.openstreetmap.josm.testutils.JOSMTestRules; 17 import org.openstreetmap.josm.testutils.annotations.AssertionsInEDT; 18 import org.openstreetmap.josm.testutils.annotations.HTTPS; 19 19 import org.openstreetmap.josm.tools.Utils; 20 21 import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;22 20 23 21 /** 24 22 * Unit tests for Remote Control 25 23 */ 24 @AssertionsInEDT 25 @HTTPS 26 26 class RemoteControlTest { 27 27 28 28 private String httpBase; 29 30 /**31 * Setup test.32 */33 @RegisterExtension34 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")35 public JOSMTestRules test = new JOSMTestRules().preferences().https().assertionsInEDT();36 29 37 30 /** … … 65 58 HttpURLConnection connection = (HttpURLConnection) new URL(url).openConnection(); 66 59 connection.connect(); 67 assertEquals( connection.getResponseCode(), HttpURLConnection.HTTP_BAD_REQUEST);60 assertEquals(HttpURLConnection.HTTP_BAD_REQUEST, connection.getResponseCode()); 68 61 try (InputStream is = connection.getErrorStream()) { 69 62 String responseBody = new String(Utils.readBytesFromStream(is), StandardCharsets.UTF_8); -
trunk/test/unit/org/openstreetmap/josm/plugins/PluginHandlerTestIT.java
r18799 r18893 29 29 import org.junit.jupiter.api.Test; 30 30 import org.junit.jupiter.api.Timeout; 31 import org.junit.jupiter.api.extension.RegisterExtension;32 31 import org.junit.platform.commons.util.ReflectionUtils; 33 32 import org.openstreetmap.josm.TestUtils; … … 41 40 import org.openstreetmap.josm.gui.progress.NullProgressMonitor; 42 41 import org.openstreetmap.josm.spi.preferences.Config; 43 import org.openstreetmap.josm.testutils.JOSMTestRules;44 42 import org.openstreetmap.josm.testutils.annotations.BasicPreferences; 43 import org.openstreetmap.josm.testutils.annotations.HTTPS; 45 44 import org.openstreetmap.josm.testutils.annotations.Main; 46 45 import org.openstreetmap.josm.testutils.annotations.Projection; … … 50 49 import org.openstreetmap.josm.tools.Utils; 51 50 52 import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;53 54 51 /** 55 52 * Integration tests of {@link PluginHandler} class. 56 53 */ 57 54 @BasicPreferences 55 @HTTPS 58 56 @Main 59 57 @Projection … … 63 61 64 62 private static final List<String> errorsToIgnore = new ArrayList<>(); 65 /**66 * Setup test.67 */68 @RegisterExtension69 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")70 public static JOSMTestRules test = new JOSMTestRules().https();71 63 72 64 /** -
trunk/test/unit/org/openstreetmap/josm/spi/lifecycle/LifecycleTest.java
r17275 r18893 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 import org.openstreetmap.josm.testutils.JOSMTestRules; 10 11 import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; 8 import org.openstreetmap.josm.testutils.annotations.HTTPS; 9 import org.openstreetmap.josm.testutils.annotations.Main; 10 import org.openstreetmap.josm.testutils.annotations.OsmApi; 11 import org.openstreetmap.josm.testutils.annotations.Projection; 12 12 13 13 /** 14 14 * Unit tests of {@link Lifecycle} class. 15 15 */ 16 @HTTPS 17 @Main 18 @OsmApi(OsmApi.APIType.DEV) 19 @Projection 16 20 class LifecycleTest { 17 18 /**19 * Setup test.20 */21 @RegisterExtension22 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")23 public JOSMTestRules test = new JOSMTestRules().https().devAPI().main().projection();24 25 21 private static class InitStatusListenerStub implements InitStatusListener { 26 22 -
trunk/test/unit/org/openstreetmap/josm/testutils/JOSMTestRules.java
r18870 r18893 58 58 import org.openstreetmap.josm.gui.preferences.imagery.ImageryPreferenceTestIT; 59 59 import org.openstreetmap.josm.gui.util.GuiHelper; 60 import org.openstreetmap.josm.io.CertificateAmendment;61 60 import org.openstreetmap.josm.io.OsmApi; 62 61 import org.openstreetmap.josm.io.OsmApiInitializationException; … … 65 64 import org.openstreetmap.josm.spi.preferences.Config; 66 65 import org.openstreetmap.josm.spi.preferences.Setting; 66 import org.openstreetmap.josm.testutils.annotations.HTTPS; 67 67 import org.openstreetmap.josm.testutils.annotations.JosmDefaults; 68 68 import org.openstreetmap.josm.testutils.annotations.MapPaintStyles; … … 136 136 * @param millis The timeout duration in milliseconds. 137 137 * @return this instance, for easy chaining 138 * @see org.junit.jupiter.api.Timeout 138 139 */ 139 140 public JOSMTestRules timeout(int millis) { … … 145 146 * Enable the use of default preferences. 146 147 * @return this instance, for easy chaining 148 * @see org.openstreetmap.josm.testutils.annotations.BasicPreferences 149 * @see org.openstreetmap.josm.testutils.annotations.FullPreferences 147 150 */ 148 151 public JOSMTestRules preferences() { … … 164 167 * Enables the i18n module for this test in english. 165 168 * @return this instance, for easy chaining 169 * @see org.openstreetmap.josm.testutils.annotations.I18n 166 170 */ 167 171 public JOSMTestRules i18n() { … … 173 177 * @param language The language to use. 174 178 * @return this instance, for easy chaining 179 * @see org.openstreetmap.josm.testutils.annotations.I18n 175 180 */ 176 181 public JOSMTestRules i18n(String language) { … … 183 188 * @param revisionProperties mock contents of JOSM's {@code REVISION} properties file 184 189 * @return this instance, for easy chaining 190 * @see org.openstreetmap.josm.testutils.annotations.AssumeRevision 185 191 */ 186 192 public JOSMTestRules assumeRevision(final String revisionProperties) { … … 192 198 * Enable the dev.openstreetmap.org API for this test. 193 199 * @return this instance, for easy chaining 200 * @see org.openstreetmap.josm.testutils.annotations.OsmApi.APIType#DEV 194 201 */ 195 202 public JOSMTestRules devAPI() { … … 202 209 * Use the {@link FakeOsmApi} for testing. 203 210 * @return this instance, for easy chaining 211 * @see org.openstreetmap.josm.testutils.annotations.OsmApi.APIType#FAKE 204 212 */ 205 213 public JOSMTestRules fakeAPI() { … … 211 219 * Set up default projection (Mercator) 212 220 * @return this instance, for easy chaining 221 * @see org.openstreetmap.josm.testutils.annotations.Projection 213 222 */ 214 223 public JOSMTestRules projection() { … … 220 229 * Set up loading of NTV2 grit shift files to support projections that need them. 221 230 * @return this instance, for easy chaining 231 * @see org.openstreetmap.josm.testutils.annotations.ProjectionNadGrids 222 232 */ 223 233 public JOSMTestRules projectionNadGrids() { … … 229 239 * Set up HTTPS certificates 230 240 * @return this instance, for easy chaining 241 * @see HTTPS 231 242 */ 232 243 public JOSMTestRules https() { … … 247 258 * Allow the memory manager to contain items after execution of the test cases. 248 259 * @return this instance, for easy chaining 260 * @see org.openstreetmap.josm.testutils.annotations.MemoryManagerLeaks 249 261 */ 250 262 public JOSMTestRules memoryManagerLeaks() { … … 256 268 * Use map styles in this test. 257 269 * @return this instance, for easy chaining 270 * @see MapPaintStyles 258 271 * @since 11777 259 272 */ … … 267 280 * Use presets in this test. 268 281 * @return this instance, for easy chaining 282 * @see TaggingPresets 269 283 * @since 12568 270 284 */ … … 278 292 * Use boundaries dataset in this test. 279 293 * @return this instance, for easy chaining 294 * @see Territories 280 295 * @since 12545 281 296 */ … … 300 315 * Force metric measurement system. 301 316 * @return this instance, for easy chaining 317 * @see org.openstreetmap.josm.testutils.annotations.MeasurementSystem 302 318 * @since 15400 303 319 */ … … 310 326 * Re-raise AssertionErrors thrown in the EDT where they would have normally been swallowed. 311 327 * @return this instance, for easy chaining 328 * @see org.openstreetmap.josm.testutils.annotations.AssertionsInEDT 312 329 */ 313 330 public JOSMTestRules assertionsInEDT() { … … 320 337 * 321 338 * @return this instance, for easy chaining 339 * @see org.openstreetmap.josm.testutils.annotations.AssertionsInEDT 322 340 */ 323 341 public JOSMTestRules assertionsInEDT(final Runnable edtAssertionMockingRunnable) { … … 330 348 * 331 349 * @return this instance, for easy chaining 350 * @see org.openstreetmap.josm.testutils.annotations.FakeImagery 332 351 */ 333 352 public JOSMTestRules fakeImagery() { … … 350 369 * 351 370 * @return this instance, for easy chaining 371 * @see org.openstreetmap.josm.testutils.annotations.FakeImagery 352 372 */ 353 373 public JOSMTestRules fakeImagery(TileSourceRule tileSourceRule) { … … 361 381 * global variables in this test. 362 382 * @return this instance, for easy chaining 383 * @see org.openstreetmap.josm.testutils.annotations.Main 363 384 * @since 12557 364 385 */ … … 379 400 * 380 401 * @return this instance, for easy chaining 402 * @see org.openstreetmap.josm.testutils.annotations.AssertionsInEDT 381 403 */ 382 404 public JOSMTestRules main( … … 561 583 if (useHttps) { 562 584 try { 563 CertificateAmendment.addMissingCertificates();585 new HTTPS.HTTPSExtension().beforeEach(null); 564 586 } catch (IOException | GeneralSecurityException ex) { 565 587 throw new JosmRuntimeException(ex); -
trunk/test/unit/org/openstreetmap/josm/testutils/annotations/BasicWiremock.java
r18106 r18893 8 8 import java.lang.annotation.Documented; 9 9 import java.lang.annotation.ElementType; 10 import java.lang.annotation.Inherited; 10 11 import java.lang.annotation.Retention; 11 12 import java.lang.annotation.RetentionPolicy; … … 51 52 * @since 18106 52 53 */ 54 @Inherited 53 55 @Documented 54 56 @Retention(RetentionPolicy.RUNTIME) -
trunk/test/unit/org/openstreetmap/josm/testutils/annotations/JosmDefaults.java
r18870 r18893 65 65 @Override 66 66 public void afterEach(ExtensionContext context) throws Exception { 67 MemoryManagerTest.resetState( false);67 MemoryManagerTest.resetState(AnnotationUtils.findFirstParentAnnotation(context, MemoryManagerLeaks.class).isPresent()); 68 68 69 69 Window[] windows = Window.getWindows(); -
trunk/test/unit/org/openstreetmap/josm/tools/MemoryManagerTest.java
r18690 r18893 2 2 package org.openstreetmap.josm.tools; 3 3 4 import static org.junit.jupiter.api.Assertions.fail;5 4 import static org.junit.jupiter.api.Assertions.assertEquals; 6 5 import static org.junit.jupiter.api.Assertions.assertFalse; … … 8 7 import static org.junit.jupiter.api.Assertions.assertThrows; 9 8 import static org.junit.jupiter.api.Assertions.assertTrue; 9 import static org.junit.jupiter.api.Assertions.fail; 10 10 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 import org.openstreetmap.josm.testutils.JOSMTestRules; 14 import org.openstreetmap.josm.testutils.annotations.MemoryManagerLeaks; 16 15 import org.openstreetmap.josm.tools.MemoryManager.MemoryHandle; 17 16 import org.openstreetmap.josm.tools.MemoryManager.NotEnoughMemoryException; 18 19 import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;20 17 21 18 /** … … 23 20 * @author Michael Zangl 24 21 */ 22 @MemoryManagerLeaks 25 23 public class MemoryManagerTest { 26 /**27 * Base test environment28 */29 @RegisterExtension30 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")31 public JOSMTestRules test = new JOSMTestRules().memoryManagerLeaks();32 33 24 /** 34 25 * Test {@link MemoryManager#allocateMemory(String, long, java.util.function.Supplier)} -
trunk/test/unit/org/openstreetmap/josm/tools/PlatformHookWindowsTest.java
r17688 r18893 2 2 package org.openstreetmap.josm.tools; 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; … … 17 18 import org.junit.jupiter.api.BeforeAll; 18 19 import org.junit.jupiter.api.Test; 19 import org.junit.jupiter.api.extension.RegisterExtension;20 20 import org.openstreetmap.josm.TestUtils; 21 21 import org.openstreetmap.josm.spi.preferences.Config; 22 import org.openstreetmap.josm.testutils. JOSMTestRules;22 import org.openstreetmap.josm.testutils.annotations.HTTPS; 23 23 24 import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;25 24 import mockit.Expectations; 26 25 import mockit.Mocked; … … 29 28 * Unit tests of {@link PlatformHookWindows} class. 30 29 */ 30 @HTTPS 31 31 class PlatformHookWindowsTest { 32 33 /**34 * Setup tests35 */36 @RegisterExtension37 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")38 public JOSMTestRules test = new JOSMTestRules().preferences().https();39 40 32 static PlatformHookWindows hook; 41 33 … … 53 45 @Test 54 46 void testStartupHook() { 55 hook.startupHook((a, b, c, d) -> System.out.println("java callback"), u -> System.out.println("webstart callback")); 47 final PlatformHook.JavaExpirationCallback javaCallback = (a, b, c, d) -> System.out.println("java callback"); 48 final PlatformHook.WebStartMigrationCallback webstartCallback = u -> System.out.println("webstart callback"); 49 assertDoesNotThrow(() -> hook.startupHook(javaCallback, webstartCallback)); 56 50 } 57 51 … … 79 73 @Test 80 74 void testAfterPrefStartupHook() { 81 hook.afterPrefStartupHook();75 assertDoesNotThrow(hook::afterPrefStartupHook); 82 76 } 83 77 … … 96 90 }}; 97 91 98 hook.openUrl(Config.getUrls().getJOSMWebsite());92 assertDoesNotThrow(() -> hook.openUrl(Config.getUrls().getJOSMWebsite())); 99 93 } 100 94 … … 122 116 }}; 123 117 124 hook.openUrl(Config.getUrls().getJOSMWebsite());118 assertDoesNotThrow(() -> hook.openUrl(Config.getUrls().getJOSMWebsite())); 125 119 } 126 120 … … 196 190 @Test 197 191 void testInitSystemShortcuts() { 198 hook.initSystemShortcuts();192 assertDoesNotThrow(hook::initSystemShortcuts); 199 193 } 200 194 }
Note:
See TracChangeset
for help on using the changeset viewer.