Changeset 12620 in josm for trunk/test/unit/org
- Timestamp:
- 2017-08-22T22:26:32+02:00 (7 years ago)
- Location:
- trunk/test/unit/org/openstreetmap/josm
- Files:
-
- 18 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/test/unit/org/openstreetmap/josm/MainTest.java
r12564 r12620 32 32 import org.openstreetmap.josm.io.OnlineResource; 33 33 import org.openstreetmap.josm.testutils.JOSMTestRules; 34 import org.openstreetmap.josm.tools.Logging; 34 35 import org.openstreetmap.josm.tools.Shortcut; 35 36 … … 63 64 /** 64 65 * Unit tests on log messages. 66 * @deprecated to remove end of 2017 65 67 */ 66 68 @Test 67 69 @SuppressFBWarnings(value = "ST_WRITE_TO_STATIC_FROM_INSTANCE_METHOD") 70 @Deprecated 68 71 public void testLogs() { 69 72 … … 122 125 f.get(); 123 126 } catch (InterruptedException | ExecutionException e) { 124 Main.error(e);127 Logging.error(e); 125 128 } 126 129 } -
trunk/test/unit/org/openstreetmap/josm/actions/downloadtasks/PostDownloadHandlerTest.java
r10945 r12620 15 15 import org.junit.Rule; 16 16 import org.junit.Test; 17 import org.openstreetmap.josm.Main;18 17 import org.openstreetmap.josm.data.Bounds; 19 18 import org.openstreetmap.josm.gui.progress.ProgressMonitor; 20 19 import org.openstreetmap.josm.testutils.JOSMTestRules; 20 import org.openstreetmap.josm.tools.Logging; 21 21 22 22 import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; … … 120 120 @Test 121 121 public void testRunExceptionFuture() { 122 Main.clearLastErrorAndWarnings();122 Logging.clearLastErrorAndWarnings(); 123 123 new PostDownloadHandler(null, newFuture("testRunExceptionFuture")).run(); 124 assertTrue( Main.getLastErrorAndWarnings().toString(),125 Main.getLastErrorAndWarnings().contains("E: java.util.concurrent.ExecutionException: testRunExceptionFuture"));124 assertTrue(Logging.getLastErrorAndWarnings().toString(), 125 Logging.getLastErrorAndWarnings().contains("E: java.util.concurrent.ExecutionException: testRunExceptionFuture")); 126 126 } 127 127 … … 131 131 @Test 132 132 public void testRunNoError() { 133 Main.clearLastErrorAndWarnings();133 Logging.clearLastErrorAndWarnings(); 134 134 new PostDownloadHandler(newTask(Collections.emptyList()), newFuture(null)).run(); 135 assertTrue( Main.getLastErrorAndWarnings().toString(), Main.getLastErrorAndWarnings().isEmpty());135 assertTrue(Logging.getLastErrorAndWarnings().toString(), Logging.getLastErrorAndWarnings().isEmpty()); 136 136 } 137 137 … … 141 141 @Test 142 142 public void testRunOneError() { 143 Main.clearLastErrorAndWarnings();143 Logging.clearLastErrorAndWarnings(); 144 144 new PostDownloadHandler(newTask(Collections.singletonList(new Object())), newFuture(null)).run(); 145 assertTrue( Main.getLastErrorAndWarnings().toString(), Main.getLastErrorAndWarnings().isEmpty());145 assertTrue(Logging.getLastErrorAndWarnings().toString(), Logging.getLastErrorAndWarnings().isEmpty()); 146 146 } 147 147 … … 151 151 @Test 152 152 public void testRunMultipleErrors() { 153 Main.clearLastErrorAndWarnings();153 Logging.clearLastErrorAndWarnings(); 154 154 new PostDownloadHandler(newTask(Arrays.asList("foo", new Exception("bar"), new Object())), newFuture(null)).run(); 155 assertTrue( Main.getLastErrorAndWarnings().toString(),156 Main.getLastErrorAndWarnings().contains("E: java.lang.Exception: bar"));155 assertTrue(Logging.getLastErrorAndWarnings().toString(), 156 Logging.getLastErrorAndWarnings().contains("E: java.lang.Exception: bar")); 157 157 } 158 158 } -
trunk/test/unit/org/openstreetmap/josm/data/cache/HostLimitQueueTest.java
r11458 r12620 14 14 import org.junit.Rule; 15 15 import org.junit.Test; 16 import org.openstreetmap.josm.Main;17 16 import org.openstreetmap.josm.testutils.JOSMTestRules; 17 import org.openstreetmap.josm.tools.Logging; 18 18 import org.openstreetmap.josm.tools.Utils; 19 19 … … 64 64 Thread.sleep(1000); 65 65 } catch (InterruptedException e) { 66 Main.trace(e);66 Logging.trace(e); 67 67 } finally { 68 68 this.counter.incrementAndGet(); -
trunk/test/unit/org/openstreetmap/josm/data/cache/JCSCachedTileLoaderJobTest.java
r11479 r12620 14 14 import org.junit.Rule; 15 15 import org.junit.Test; 16 import org.openstreetmap.josm.Main;17 16 import org.openstreetmap.josm.data.cache.ICachedLoaderListener.LoadResult; 18 17 import org.openstreetmap.josm.testutils.JOSMTestRules; 18 import org.openstreetmap.josm.tools.Logging; 19 19 20 20 import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; … … 121 121 } catch (InterruptedException e1) { 122 122 // do nothing, still wait 123 Main.trace(e1);123 Logging.trace(e1); 124 124 } 125 125 } … … 143 143 } catch (InterruptedException e1) { 144 144 // do nothing, wait 145 Main.trace(e1);145 Logging.trace(e1); 146 146 } 147 147 } -
trunk/test/unit/org/openstreetmap/josm/data/osm/ChangesetDataSetTest.java
r12035 r12620 13 13 import org.junit.Rule; 14 14 import org.junit.Test; 15 import org.openstreetmap.josm.Main;16 15 import org.openstreetmap.josm.TestUtils; 17 16 import org.openstreetmap.josm.data.coor.LatLon; … … 48 47 fail("Should have thrown an IllegalArgumentException as we gave a null argument."); 49 48 } catch (IllegalArgumentException e) { 50 Main.trace(e);49 Logging.trace(e); 51 50 // Was expected 52 51 } -
trunk/test/unit/org/openstreetmap/josm/data/osm/ChangesetTest.java
r12033 r12620 17 17 import org.junit.Rule; 18 18 import org.junit.Test; 19 import org.openstreetmap.josm.Main;20 19 import org.openstreetmap.josm.data.Bounds; 21 20 import org.openstreetmap.josm.data.coor.LatLon; … … 23 22 import org.openstreetmap.josm.gui.DefaultNameFormatter; 24 23 import org.openstreetmap.josm.testutils.JOSMTestRules; 24 import org.openstreetmap.josm.tools.Logging; 25 25 26 26 import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; … … 50 50 Assert.fail("Should have thrown an IllegalArgumentException as we gave a null argument."); 51 51 } catch (IllegalArgumentException e) { 52 Main.trace(e);52 Logging.trace(e); 53 53 // Was expected 54 54 } … … 76 76 Assert.fail("Should have thrown an IllegalArgumentException as we gave a too long value."); 77 77 } catch (IllegalArgumentException e) { 78 Main.trace(e);78 Logging.trace(e); 79 79 // Was expected 80 80 } -
trunk/test/unit/org/openstreetmap/josm/data/osm/history/HistoryWayTest.java
r10945 r12620 13 13 import org.junit.Rule; 14 14 import org.junit.Test; 15 import org.openstreetmap.josm.Main;16 15 import org.openstreetmap.josm.data.osm.OsmPrimitiveType; 17 16 import org.openstreetmap.josm.data.osm.User; 18 17 import org.openstreetmap.josm.gui.DefaultNameFormatter; 19 18 import org.openstreetmap.josm.testutils.JOSMTestRules; 19 import org.openstreetmap.josm.tools.Logging; 20 20 21 21 import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; … … 83 83 } catch (IndexOutOfBoundsException e) { 84 84 // OK 85 Main.trace(e);85 Logging.trace(e); 86 86 } 87 87 -
trunk/test/unit/org/openstreetmap/josm/data/validation/routines/DomainValidatorTest.java
r11621 r12620 30 30 import org.junit.Before; 31 31 import org.junit.Test; 32 import org.openstreetmap.josm.Main;33 32 import org.openstreetmap.josm.data.validation.routines.DomainValidator.ArrayType; 33 import org.openstreetmap.josm.tools.Logging; 34 34 35 35 /** … … 342 342 } catch (IllegalArgumentException iae) { 343 343 // expected 344 Main.debug(iae.getMessage());344 Logging.debug(iae.getMessage()); 345 345 } 346 346 try { … … 349 349 } catch (IllegalArgumentException iae) { 350 350 // expected 351 Main.debug(iae.getMessage());351 Logging.debug(iae.getMessage()); 352 352 } 353 353 try { … … 356 356 } catch (IllegalArgumentException iae) { 357 357 // expected 358 Main.debug(iae.getMessage());358 Logging.debug(iae.getMessage()); 359 359 } 360 360 try { … … 363 363 } catch (IllegalArgumentException iae) { 364 364 // expected 365 Main.debug(iae.getMessage());365 Logging.debug(iae.getMessage()); 366 366 } 367 367 } … … 431 431 } catch (IllegalStateException ise) { 432 432 // expected 433 Main.debug(ise.getMessage());433 Logging.debug(ise.getMessage()); 434 434 } 435 435 } -
trunk/test/unit/org/openstreetmap/josm/data/validation/routines/DomainValidatorTestIT.java
r11621 r12620 48 48 49 49 import org.junit.Test; 50 import org.openstreetmap.josm. Main;50 import org.openstreetmap.josm.tools.Logging; 51 51 52 52 import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; … … 84 84 timestamp = download(txtFile, "http://data.iana.org/TLD/tlds-alpha-by-domain.txt", 0L); 85 85 } catch (ConnectException e) { 86 Main.error(e);86 Logging.error(e); 87 87 // Try again one more time in case of random network issue 88 88 timestamp = download(txtFile, "http://data.iana.org/TLD/tlds-alpha-by-domain.txt", 0L); -
trunk/test/unit/org/openstreetmap/josm/data/validation/routines/RegexValidatorTest.java
r10378 r12620 27 27 28 28 import org.junit.Test; 29 import org.openstreetmap.josm. Main;29 import org.openstreetmap.josm.tools.Logging; 30 30 31 31 /** … … 244 244 } catch (PatternSyntaxException e) { 245 245 // expected 246 Main.debug(e.getMessage());246 Logging.debug(e.getMessage()); 247 247 } 248 248 } -
trunk/test/unit/org/openstreetmap/josm/data/validation/tests/MapCSSTagCheckerTest.java
r11493 r12620 19 19 import org.junit.Rule; 20 20 import org.junit.Test; 21 import org.openstreetmap.josm.Main;22 21 import org.openstreetmap.josm.TestUtils; 23 22 import org.openstreetmap.josm.command.ChangePropertyCommand; … … 38 37 import org.openstreetmap.josm.io.OsmReader; 39 38 import org.openstreetmap.josm.testutils.JOSMTestRules; 39 import org.openstreetmap.josm.tools.Logging; 40 40 41 41 import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; … … 185 185 } 186 186 for (String msg : assertionErrors) { 187 Main.error(msg);187 Logging.error(msg); 188 188 } 189 189 assertTrue("not all assertions included in the tests are met", assertionErrors.isEmpty()); -
trunk/test/unit/org/openstreetmap/josm/gui/conflict/pair/nodes/NodeListMergeModelTest.java
r10962 r12620 20 20 import org.junit.Rule; 21 21 import org.junit.Test; 22 import org.openstreetmap.josm.Main;23 22 import org.openstreetmap.josm.data.osm.Node; 24 23 import org.openstreetmap.josm.data.osm.Way; 25 24 import org.openstreetmap.josm.testutils.DatasetFactory; 26 25 import org.openstreetmap.josm.testutils.JOSMTestRules; 26 import org.openstreetmap.josm.tools.Logging; 27 27 28 28 import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; … … 360 360 } catch (IllegalArgumentException e) { 361 361 // OK 362 Main.trace(e);362 Logging.trace(e); 363 363 } 364 364 … … 368 368 } catch (IllegalArgumentException e) { 369 369 // OK 370 Main.trace(e);370 Logging.trace(e); 371 371 } 372 372 } -
trunk/test/unit/org/openstreetmap/josm/gui/conflict/pair/tags/TagMergeItemTest.java
r10962 r12620 8 8 import org.junit.Rule; 9 9 import org.junit.Test; 10 import org.openstreetmap.josm.Main;11 10 import org.openstreetmap.josm.data.osm.Node; 12 11 import org.openstreetmap.josm.gui.conflict.pair.MergeDecisionType; 13 12 import org.openstreetmap.josm.testutils.JOSMTestRules; 13 import org.openstreetmap.josm.tools.Logging; 14 14 15 15 import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; … … 94 94 } catch (IllegalArgumentException e) { 95 95 // OK 96 Main.trace(e);96 Logging.trace(e); 97 97 } 98 98 } … … 141 141 } catch (IllegalStateException e) { 142 142 // OK 143 Main.trace(e);143 Logging.trace(e); 144 144 } 145 145 } … … 154 154 } catch (IllegalArgumentException e) { 155 155 // OK 156 Main.trace(e);156 Logging.trace(e); 157 157 } 158 158 } -
trunk/test/unit/org/openstreetmap/josm/gui/preferences/map/TaggingPresetPreferenceTestIT.java
r12214 r12620 22 22 import org.openstreetmap.josm.gui.tagging.presets.TaggingPresetReader; 23 23 import org.openstreetmap.josm.tools.ImageProvider; 24 import org.openstreetmap.josm.tools.Logging; 24 25 import org.xml.sax.SAXException; 25 26 … … 67 68 } catch (IOException e) { 68 69 try { 69 Main.warn(e);70 Logging.warn(e); 70 71 // try again in case of temporary network error 71 72 testPresets(allMessages, source); … … 95 96 Collection<TaggingPreset> presets = TaggingPresetReader.readAll(source.url, true); 96 97 assertFalse(presets.isEmpty()); 97 Collection<String> errorsAndWarnings = Main.getLastErrorAndWarnings();98 Collection<String> errorsAndWarnings = Logging.getLastErrorAndWarnings(); 98 99 boolean error = false; 99 100 for (String message : errorsAndWarnings) { … … 108 109 System.out.println(error ? " => KO" : " => OK"); 109 110 if (error) { 110 Main.clearLastErrorAndWarnings();111 Logging.clearLastErrorAndWarnings(); 111 112 } 112 113 } -
trunk/test/unit/org/openstreetmap/josm/io/remotecontrol/RemoteControlTest.java
r11324 r12620 28 28 import org.openstreetmap.josm.JOSMFixture; 29 29 import org.openstreetmap.josm.Main; 30 import org.openstreetmap.josm.tools.Logging; 30 31 31 32 import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; … … 63 64 RemoteControl.getRemoteControlDir()).resolve(RemoteControlHttpsServer.KEYSTORE_FILENAME)); 64 65 } catch (IOException e) { 65 Main.error(e);66 Logging.error(e); 66 67 } 67 68 } -
trunk/test/unit/org/openstreetmap/josm/tools/OsmUrlToBoundsTest.java
r12090 r12620 5 5 import org.junit.Rule; 6 6 import org.junit.Test; 7 import org.openstreetmap.josm.Main;8 7 import org.openstreetmap.josm.data.Bounds; 9 8 import org.openstreetmap.josm.testutils.JOSMTestRules; … … 99 98 } catch (IllegalArgumentException e) { 100 99 // Ignore. check if bounds is null after 101 Main.trace(e);100 Logging.trace(e); 102 101 } 103 102 Assert.assertEquals(item.url, item.bounds, bounds); -
trunk/test/unit/org/openstreetmap/josm/tools/PlatformHookOsxTest.java
r11160 r12620 70 70 fail("Expected IOException"); 71 71 } catch (IOException e) { 72 Main.info(e.getMessage());72 Logging.info(e.getMessage()); 73 73 } 74 74 } -
trunk/test/unit/org/openstreetmap/josm/tools/PlatformHookWindowsTest.java
r10378 r12620 60 60 fail("Expected KeyStoreException"); 61 61 } catch (KeyStoreException e) { 62 Main.info(e.getMessage());62 Logging.info(e.getMessage()); 63 63 } 64 64 } … … 78 78 fail("Expected KeyStoreException"); 79 79 } catch (KeyStoreException e) { 80 Main.info(e.getMessage());80 Logging.info(e.getMessage()); 81 81 } 82 82 } … … 99 99 fail("Expected KeyStoreException"); 100 100 } catch (KeyStoreException e) { 101 Main.info(e.getMessage());101 Logging.info(e.getMessage()); 102 102 } 103 103 } … … 125 125 fail("Expected IOException"); 126 126 } catch (IOException e) { 127 Main.info(e.getMessage());127 Logging.info(e.getMessage()); 128 128 } 129 129 }
Note:
See TracChangeset
for help on using the changeset viewer.