Changeset 14121 in josm for trunk/test/unit/org
- Timestamp:
- 2018-08-11T17:51:12+02:00 (6 years ago)
- Location:
- trunk/test/unit/org/openstreetmap/josm
- Files:
-
- 1 added
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/test/unit/org/openstreetmap/josm/MainTest.java
r14120 r14121 2 2 package org.openstreetmap.josm; 3 3 4 import static org.junit.Assert.assertEquals;5 4 import static org.junit.Assert.assertFalse; 6 5 import static org.junit.Assert.assertNotNull; 7 6 import static org.junit.Assert.assertTrue; 8 9 import java.net.MalformedURLException;10 import java.net.URL;11 import java.util.Map;12 7 13 8 import org.junit.Rule; … … 16 11 import org.openstreetmap.josm.Main.InitializationTask; 17 12 import org.openstreetmap.josm.data.coor.conversion.CoordinateFormatManager; 18 import org.openstreetmap.josm.io.OnlineResource;19 13 import org.openstreetmap.josm.testutils.JOSMTestRules; 20 14 … … 40 34 Main.preConstructorInit(); 41 35 assertNotNull(CoordinateFormatManager.getDefaultFormat()); 42 }43 44 /**45 * Unit test of {@link Main#addNetworkError}, {@link Main#getNetworkErrors} and {@link Main#clearNetworkErrors}.46 * @throws MalformedURLException if any error occurs47 */48 @Test49 public void testNetworkErrors() throws MalformedURLException {50 Main.clearNetworkErrors();51 assertTrue(Main.getNetworkErrors().isEmpty());52 Main.addNetworkError("http://url1", new Exception("exception_1"));53 Main.addNetworkError(new URL("http://url2"), new Exception("exception_2"));54 Map<String, Throwable> errors = Main.getNetworkErrors();55 assertEquals(2, errors.size());56 assertEquals("exception_1", errors.get("http://url1").getMessage());57 assertEquals("exception_2", errors.get("http://url2").getMessage());58 Main.clearNetworkErrors();59 assertTrue(Main.getNetworkErrors().isEmpty());60 }61 62 /**63 * Unit test of {@link Main#setOffline} and {@link Main#getOfflineResources}.64 */65 @Test66 public void testOfflineRessources() {67 Main.setOnline(OnlineResource.ALL);68 assertTrue(Main.getOfflineResources().isEmpty());69 assertFalse(Main.isOffline(OnlineResource.JOSM_WEBSITE));70 Main.setOffline(OnlineResource.JOSM_WEBSITE);71 assertTrue(Main.isOffline(OnlineResource.JOSM_WEBSITE));72 Main.setOnline(OnlineResource.JOSM_WEBSITE);73 assertFalse(Main.isOffline(OnlineResource.JOSM_WEBSITE));74 Main.setOffline(OnlineResource.ALL);75 assertTrue(Main.isOffline(OnlineResource.JOSM_WEBSITE));76 assertTrue(Main.isOffline(OnlineResource.OSM_API));77 Main.setOnline(OnlineResource.ALL);78 36 } 79 37
Note:
See TracChangeset
for help on using the changeset viewer.