Changeset 12557 in josm for trunk/test/unit/org/openstreetmap/josm/gui
- Timestamp:
- 2017-08-02T20:41:01+02:00 (7 years ago)
- Location:
- trunk/test/unit/org/openstreetmap/josm/gui
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/test/unit/org/openstreetmap/josm/gui/DefaultNameFormatterTest.java
r10378 r12557 2 2 package org.openstreetmap.josm.gui; 3 3 4 import static com.github.tomakehurst.wiremock.client.WireMock.aResponse; 5 import static com.github.tomakehurst.wiremock.client.WireMock.get; 6 import static com.github.tomakehurst.wiremock.client.WireMock.urlEqualTo; 7 import static com.github.tomakehurst.wiremock.core.WireMockConfiguration.options; 4 8 import static org.junit.Assert.assertEquals; 5 9 … … 10 14 import java.util.List; 11 15 12 import org.junit. BeforeClass;16 import org.junit.Rule; 13 17 import org.junit.Test; 14 import org.openstreetmap.josm.JOSMFixture;15 18 import org.openstreetmap.josm.TestUtils; 16 19 import org.openstreetmap.josm.data.osm.DataSet; … … 24 27 import org.openstreetmap.josm.io.IllegalDataException; 25 28 import org.openstreetmap.josm.io.OsmReader; 29 import org.openstreetmap.josm.testutils.JOSMTestRules; 26 30 import org.xml.sax.SAXException; 31 32 import com.github.tomakehurst.wiremock.junit.WireMockRule; 27 33 28 34 import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; … … 34 40 35 41 /** 36 * Setup test s42 * Setup test. 37 43 */ 38 @BeforeClass 39 public static void setUpBeforeClass() { 40 JOSMFixture.createUnitTestFixture().init(); 41 } 44 @Rule 45 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") 46 public JOSMTestRules test = new JOSMTestRules().platform(); 47 48 /** 49 * HTTP mock. 50 */ 51 @Rule 52 public WireMockRule wireMockRule = new WireMockRule(options().dynamicPort().usingFilesUnderDirectory(TestUtils.getTestDataRoot())); 42 53 43 54 /** … … 50 61 @SuppressFBWarnings(value = "ITA_INEFFICIENT_TO_ARRAY") 51 62 public void testTicket9632() throws IllegalDataException, IOException, SAXException { 52 String source = "http://josm.openstreetmap.de/josmfile?page=Presets/BicycleJunction&preset"; 53 TaggingPresets.addTaggingPresets(TaggingPresetReader.readAll(source, true)); 63 String source = "presets/Presets_BicycleJunction-preset.xml"; 64 wireMockRule.stubFor(get(urlEqualTo("/" + source)) 65 .willReturn(aResponse() 66 .withStatus(200) 67 .withHeader("Content-Type", "text/xml") 68 .withBodyFile(source))); 69 TaggingPresets.addTaggingPresets(TaggingPresetReader.readAll("http://localhost:" + wireMockRule.port() + "/" + source, true)); 54 70 55 71 Comparator<Relation> comparator = DefaultNameFormatter.getInstance().getRelationComparator(); -
trunk/test/unit/org/openstreetmap/josm/gui/preferences/imagery/ImageryPreferenceTest.java
r10977 r12557 4 4 import static org.junit.Assert.assertNotNull; 5 5 6 import java.io.File; 7 import java.util.Arrays; 8 6 9 import org.junit.Rule; 7 10 import org.junit.Test; 11 import org.openstreetmap.josm.Main; 12 import org.openstreetmap.josm.TestUtils; 8 13 import org.openstreetmap.josm.gui.preferences.PreferencesTestUtils; 9 14 import org.openstreetmap.josm.testutils.JOSMTestRules; … … 21 26 @Rule 22 27 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") 23 public JOSMTestRules test = new JOSMTestRules().platform(). commands();28 public JOSMTestRules test = new JOSMTestRules().platform().mainMenu(); 24 29 25 30 /** … … 36 41 @Test 37 42 public void testAddGui() { 43 String fileUrl = new File(TestUtils.getTestDataRoot()+"__files/imagery/maps.xml").toURI().toString(); 44 Main.pref.putCollection("imagery.layers.sites", Arrays.asList(fileUrl)); 38 45 PreferencesTestUtils.doTestPreferenceSettingAddGui(new ImageryPreference.Factory(), null); 39 46 }
Note:
See TracChangeset
for help on using the changeset viewer.