Changeset 6562 in josm for trunk/test/unit/org/openstreetmap
- Timestamp:
- 2013-12-29T14:14:58+01:00 (11 years ago)
- Location:
- trunk/test/unit/org/openstreetmap
- Files:
-
- 1 added
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/test/unit/org/openstreetmap/josm/gui/tagging/TaggingPresetReaderTest.java
r6471 r6562 1 1 // License: GPL. For details, see LICENSE file. 2 2 package org.openstreetmap.josm.gui.tagging; 3 4 import java.io.IOException;5 import java.util.Collection;6 3 7 4 import org.junit.Assert; 8 5 import org.junit.BeforeClass; 9 6 import org.junit.Test; 7 import org.openstreetmap.TestUtils; 10 8 import org.openstreetmap.josm.Main; 11 import org.openstreetmap.josm. data.Preferences;9 import org.openstreetmap.josm.tools.Utils; 12 10 import org.xml.sax.SAXException; 11 12 import java.io.IOException; 13 import java.util.Collection; 14 import java.util.List; 15 16 import static org.CustomMatchers.hasSize; 17 import static org.hamcrest.CoreMatchers.is; 18 import static org.junit.Assert.assertThat; 13 19 14 20 /** … … 16 22 */ 17 23 public class TaggingPresetReaderTest { 18 /** 19 * path to test data root directory 20 */ 21 private static String testdataroot; 22 24 23 25 @BeforeClass 24 26 public static void setUpClass() { 25 27 Main.initApplicationPreferences(); 26 testdataroot = System.getProperty("josm.test.data");27 if (testdataroot == null || testdataroot.isEmpty()) {28 testdataroot = "test/data";29 System.out.println("System property josm.test.data is not set, using '" + testdataroot + "'");30 }31 28 } 32 29 … … 37 34 */ 38 35 protected static String getRegressionDataDir(int ticketid) { 39 return testdataroot+ "/regress/" + ticketid;36 return TestUtils.getTestDataRoot() + "/regress/" + ticketid; 40 37 } 41 38 … … 64 61 } 65 62 63 @Test 64 public void testNestedChunks() throws Exception { 65 final Collection<TaggingPreset> presets = TaggingPresetReader.readAll(TestUtils.getTestDataRoot() + "preset_chunk.xml", true); 66 assertThat(presets, hasSize(1)); 67 final TaggingPreset abc = presets.iterator().next(); 68 final List<String> keys = Utils.transform(abc.data, new Utils.Function<TaggingPresetItem, String>() { 69 @Override 70 public String apply(TaggingPresetItem x) { 71 return ((TaggingPresetItems.Key) x).key; 72 } 73 }); 74 assertThat(keys.toString(), is("[A1, A2, A3, B1, B2, B3, C1, C2, C3]")); 75 } 76 66 77 /** 67 78 * Validate internal presets
Note:
See TracChangeset
for help on using the changeset viewer.