Changeset 7081 in josm for trunk/test
- Timestamp:
- 2014-05-09T04:49:54+02:00 (11 years ago)
- Location:
- trunk/test
- Files:
-
- 45 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/test/config/performance-josm.home
- Property svn:ignore
-
old new 1 1 preferences.xml 2 preferences.xml_backup 3 preferences.xml_tmp
-
- Property svn:ignore
-
trunk/test/config/unit-josm.home
- Property svn:ignore
-
old new 3 3 preferences.xml_tmp 4 4 preferences.xml 5 validator
-
- Property svn:ignore
-
trunk/test/functional/org/openstreetmap/josm/gui/history/HistoryBrowserTest.java
r7030 r7081 2 2 package org.openstreetmap.josm.gui.history; 3 3 4 import static org.junit.Assert.fail;5 6 4 import java.awt.BorderLayout; 7 import java.io.File;8 import java.io.IOException;9 import java.io.InputStream;10 import java.text.MessageFormat;11 import java.util.Properties;12 import java.util.logging.Level;13 5 import java.util.logging.Logger; 14 6 … … 16 8 17 9 import org.junit.BeforeClass; 10 import org.openstreetmap.josm.JOSMFixture; 18 11 import org.openstreetmap.josm.Main; 19 12 import org.openstreetmap.josm.data.osm.OsmPrimitiveType; … … 21 14 import org.openstreetmap.josm.data.osm.history.History; 22 15 import org.openstreetmap.josm.data.osm.history.HistoryDataSet; 23 import org.openstreetmap.josm.data.projection.Projections;24 16 import org.openstreetmap.josm.gui.progress.NullProgressMonitor; 25 17 import org.openstreetmap.josm.io.OsmServerHistoryReader; … … 30 22 static private Logger logger = Logger.getLogger(HistoryBrowserTest.class.getName()); 31 23 32 static Properties testProperties;33 34 24 @BeforeClass 35 25 static public void init() { 36 testProperties = new Properties(); 37 38 // load properties 39 // 40 try (InputStream is = HistoryBrowserTest.class.getResourceAsStream("/test-functional-env.properties");) { 41 testProperties.load(is); 42 } catch(IOException e){ 43 logger.log(Level.SEVERE, MessageFormat.format("failed to load property file ''{0}''", "test-functional-env.properties")); 44 fail(MessageFormat.format("failed to load property file ''{0}''", "test-functional-env.properties")); 45 } 46 47 // check josm.home 48 // 49 String josmHome = testProperties.getProperty("josm.home"); 50 if (josmHome == null) { 51 fail(MessageFormat.format("property ''{0}'' not set in test environment", "josm.home")); 52 } else { 53 File f = new File(josmHome); 54 if (! f.exists() || ! f.canRead()) { 55 fail(MessageFormat.format("property ''{0}'' points to ''{1}'' which is either not existing or not readable", "josm.home", josmHome)); 56 } 57 } 58 System.setProperty("josm.home", josmHome); 59 Main.pref.init(false); 60 61 // init projection 62 Main.setProjection(Projections.getProjectionByCode("EPSG:3857")); // Mercator 26 JOSMFixture.createFunctionalTestFixture().init(); 63 27 } 64 28 -
trunk/test/functional/org/openstreetmap/josm/io/MultiFetchServerObjectReaderTest.java
r7040 r7081 12 12 import java.io.FileOutputStream; 13 13 import java.io.IOException; 14 import java.io.InputStream;15 14 import java.io.OutputStreamWriter; 16 15 import java.io.PrintWriter; … … 18 17 import java.util.ArrayList; 19 18 import java.util.Properties; 20 import java.util.logging.Level;21 19 import java.util.logging.Logger; 22 20 … … 24 22 import org.junit.BeforeClass; 25 23 import org.junit.Test; 24 import org.openstreetmap.josm.JOSMFixture; 26 25 import org.openstreetmap.josm.Main; 27 26 import org.openstreetmap.josm.data.coor.LatLon; … … 33 32 import org.openstreetmap.josm.data.osm.RelationMember; 34 33 import org.openstreetmap.josm.data.osm.Way; 35 import org.openstreetmap.josm.data.projection.Projections;36 34 import org.openstreetmap.josm.gui.io.UploadStrategy; 37 35 import org.openstreetmap.josm.gui.io.UploadStrategySpecification; … … 136 134 public static void init() throws OsmTransferException { 137 135 logger.info("initializing ..."); 138 testProperties = new Properties(); 139 140 // load properties 141 // 142 try (InputStream is = MultiFetchServerObjectReaderTest.class.getResourceAsStream("/test-functional-env.properties")) { 143 if (is == null) { 144 throw new IOException(); 145 } 146 testProperties.load(is); 147 } catch(IOException e){ 148 logger.log(Level.SEVERE, MessageFormat.format("failed to load property file ''{0}''", "test-functional-env.properties")); 149 fail(MessageFormat.format("failed to load property file ''{0}''", "test-functional-env.properties")); 150 } 151 152 // check josm.home 153 // 154 String josmHome = testProperties.getProperty("josm.home"); 155 if (josmHome == null) { 156 fail(MessageFormat.format("property ''{0}'' not set in test environment", "josm.home")); 157 } else { 158 File f = new File(josmHome); 159 if (! f.exists() || ! f.canRead()) { 160 fail(MessageFormat.format("property ''{0}'' points to ''{1}'' which is either not existing or not readable", "josm.home", josmHome)); 161 } 162 } 163 164 // check temp output dir 165 // 166 String tempOutputDir = testProperties.getProperty("test.functional.tempdir"); 167 if (tempOutputDir == null) { 168 fail(MessageFormat.format("property ''{0}'' not set in test environment", "test.functional.tempdir")); 169 } else { 170 File f = new File(tempOutputDir); 171 if (! f.exists() || ! f.isDirectory() || ! f.canWrite()) { 172 fail(MessageFormat.format("property ''{0}'' points to ''{1}'' which is either not existing, not a directory, or not writeable", "test.functional.tempdir", tempOutputDir)); 173 } 174 } 175 176 177 // init preferences 178 // 179 System.setProperty("josm.home", josmHome); 180 Main.pref.init(false); 136 JOSMFixture.createFunctionalTestFixture().init(); 137 181 138 // don't use atomic upload, the test API server can't cope with large diff uploads 182 139 // 183 140 Main.pref.put("osm-server.atomic-upload", false); 184 Main.setProjection(Projections.getProjectionByCode("EPSG:3857")); // Mercator 185 186 File dataSetCacheOutputFile = new File(tempOutputDir, MultiFetchServerObjectReaderTest.class.getName() + ".dataset"); 141 142 File dataSetCacheOutputFile = new File(System.getProperty("java.io.tmpdir"), MultiFetchServerObjectReaderTest.class.getName() + ".dataset"); 187 143 188 144 // make sure we don't upload to production -
trunk/test/unit/org/openstreetmap/josm/JOSMFixture.java
r7068 r7081 54 54 55 55 Main.pref.init(false); 56 I18n.set(Main.pref.get("language", "en")); 56 57 57 58 // init projection -
trunk/test/unit/org/openstreetmap/josm/actions/CreateMultipolygonActionTest.groovy
r7068 r7081 1 1 package org.openstreetmap.josm.actions 2 2 3 import org.openstreetmap.josm.Main 4 import org.openstreetmap.josm.TestUtils; 3 import org.junit.BeforeClass 4 import org.junit.Test 5 import org.openstreetmap.josm.JOSMFixture 6 import org.openstreetmap.josm.TestUtils 5 7 import org.openstreetmap.josm.actions.search.SearchCompiler 6 8 import org.openstreetmap.josm.data.osm.Relation 7 9 import org.openstreetmap.josm.data.osm.Way 8 import org.openstreetmap.josm.data.projection.Projections9 10 import org.openstreetmap.josm.io.OsmReader 10 11 import org.openstreetmap.josm.tools.Utils 11 12 12 class CreateMultipolygonActionTest extends GroovyTestCase{13 class CreateMultipolygonActionTest { 13 14 14 @Override 15 void setUp() { 16 Main.initApplicationPreferences() 17 Main.setProjection(Projections.getProjectionByCode("EPSG:3857")); 15 @BeforeClass 16 public static void setUp() { 17 JOSMFixture.createUnitTestFixture().init(); 18 18 } 19 19 … … 26 26 } 27 27 28 void testCreate1() { 28 @Test 29 public void testCreate1() { 29 30 def ds = OsmReader.parseDataSet(new FileInputStream(TestUtils.getTestDataRoot() + "create_multipolygon.osm"), null); 30 31 def mp = CreateMultipolygonAction.createMultipolygonCommand(ds.getWays(), null) … … 33 34 } 34 35 35 void testCreate2() { 36 @Test 37 public void testCreate2() { 36 38 def ds = OsmReader.parseDataSet(new FileInputStream(TestUtils.getTestDataRoot() + "create_multipolygon.osm"), null); 37 39 def ways = Utils.filter(ds.getWays(), SearchCompiler.compile("ref=1 OR ref:1.1.", false, false)) … … 40 42 } 41 43 42 void testUpdate1() { 44 @Test 45 public void testUpdate1() { 43 46 def ds = OsmReader.parseDataSet(new FileInputStream(TestUtils.getTestDataRoot() + "create_multipolygon.osm"), null); 44 47 def ways = Utils.filter(ds.getWays(), SearchCompiler.compile("ref=\".*1\$\"", false, true)) … … 52 55 } 53 56 54 void testUpdate2() { 57 @Test 58 public void testUpdate2() { 55 59 def ds = OsmReader.parseDataSet(new FileInputStream(TestUtils.getTestDataRoot() + "create_multipolygon.osm"), null); 56 60 def ways = Utils.filter(ds.getWays(), SearchCompiler.compile("ref=1 OR ref:1.1.1", false, false)) -
trunk/test/unit/org/openstreetmap/josm/actions/search/SearchCompilerTest.java
r6881 r7081 4 4 import org.junit.Before; 5 5 import org.junit.Test; 6 import org.openstreetmap.josm. Main;6 import org.openstreetmap.josm.JOSMFixture; 7 7 import org.openstreetmap.josm.data.osm.Node; 8 8 import org.openstreetmap.josm.data.osm.OsmPrimitive; … … 15 15 @Before 16 16 public void setUp() { 17 Main.initApplicationPreferences();17 JOSMFixture.createUnitTestFixture().init(); 18 18 } 19 19 -
trunk/test/unit/org/openstreetmap/josm/corrector/ReverseWayTagCorrectorTest.java
r6881 r7081 5 5 import org.junit.BeforeClass; 6 6 import org.junit.Test; 7 import org.openstreetmap.josm. Main;7 import org.openstreetmap.josm.JOSMFixture; 8 8 import org.openstreetmap.josm.data.osm.Tag; 9 9 … … 18 18 @BeforeClass 19 19 public static void setUp() { 20 Main.initApplicationPreferences();20 JOSMFixture.createUnitTestFixture().init(); 21 21 } 22 22 -
trunk/test/unit/org/openstreetmap/josm/data/PreferencesTest.groovy
r6774 r7081 1 1 package org.openstreetmap.josm.data 2 2 3 import java.awt.Color 4 5 import org.openstreetmap.josm.JOSMFixture 3 6 import org.openstreetmap.josm.Main 4 5 import java.awt.Color6 7 7 8 class PreferencesTest extends GroovyTestCase { 8 9 @Override 9 10 void setUp() { 10 Main.initApplicationPreferences()11 JOSMFixture.createUnitTestFixture().init(); 11 12 } 12 13 -
trunk/test/unit/org/openstreetmap/josm/data/osm/APIDataSetTest.java
r6881 r7081 9 9 import org.junit.BeforeClass; 10 10 import org.junit.Test; 11 import org.openstreetmap.josm. Main;11 import org.openstreetmap.josm.JOSMFixture; 12 12 import org.openstreetmap.josm.actions.upload.CyclicUploadDependencyException; 13 13 import org.openstreetmap.josm.data.APIDataSet; … … 17 17 @BeforeClass 18 18 public static void init() { 19 Main.initApplicationPreferences();19 JOSMFixture.createUnitTestFixture().init(); 20 20 } 21 21 -
trunk/test/unit/org/openstreetmap/josm/data/osm/DataSetMergerTest.java
r6881 r7081 17 17 import org.junit.BeforeClass; 18 18 import org.junit.Test; 19 import org.openstreetmap.josm.JOSMFixture; 19 20 import org.openstreetmap.josm.Main; 20 21 import org.openstreetmap.josm.data.coor.LatLon; … … 25 26 @BeforeClass 26 27 public static void init() { 27 Main.initApplicationPreferences();28 JOSMFixture.createUnitTestFixture().init(); 28 29 } 29 30 -
trunk/test/unit/org/openstreetmap/josm/data/osm/FilterTest.java
r7033 r7081 15 15 import org.junit.BeforeClass; 16 16 import org.junit.Test; 17 import org.openstreetmap.josm. Main;17 import org.openstreetmap.josm.JOSMFixture; 18 18 import org.openstreetmap.josm.actions.search.SearchAction.SearchMode; 19 19 import org.openstreetmap.josm.actions.search.SearchCompiler.ParseError; 20 20 import org.openstreetmap.josm.data.coor.LatLon; 21 import org.openstreetmap.josm.data.projection.Projections;22 21 import org.openstreetmap.josm.gui.progress.NullProgressMonitor; 23 22 import org.openstreetmap.josm.io.IllegalDataException; … … 31 30 @BeforeClass 32 31 public static void setUp() { 33 Main.setProjection(Projections.getProjectionByCode("EPSG:3857")); // Mercator 34 Main.initApplicationPreferences(); 32 JOSMFixture.createUnitTestFixture().init(); 35 33 } 36 34 -
trunk/test/unit/org/openstreetmap/josm/data/osm/OsmPrimitiveKeyHandlingTest.java
r7063 r7081 6 6 import org.junit.BeforeClass; 7 7 import org.junit.Test; 8 import org.openstreetmap.josm. Main;8 import org.openstreetmap.josm.JOSMFixture; 9 9 import org.openstreetmap.josm.data.coor.LatLon; 10 10 … … 18 18 @BeforeClass 19 19 public static void init() { 20 Main.initApplicationPreferences();20 JOSMFixture.createUnitTestFixture().init(); 21 21 } 22 22 -
trunk/test/unit/org/openstreetmap/josm/data/osm/OsmPrimitiveTest.java
r7005 r7081 8 8 import org.junit.BeforeClass; 9 9 import org.junit.Test; 10 import org.openstreetmap.josm.JOSMFixture; 10 11 import org.openstreetmap.josm.Main; 11 12 import org.openstreetmap.josm.data.coor.LatLon; … … 16 17 @BeforeClass 17 18 public static void init() { 18 Main.initApplicationPreferences();19 JOSMFixture.createUnitTestFixture().init(); 19 20 } 20 21 -
trunk/test/unit/org/openstreetmap/josm/data/osm/QuadBucketsTest.java
r7033 r7081 14 14 import org.junit.BeforeClass; 15 15 import org.junit.Test; 16 import org.openstreetmap.josm.JOSMFixture; 16 17 import org.openstreetmap.josm.Main; 17 18 import org.openstreetmap.josm.data.coor.LatLon; … … 24 25 @BeforeClass 25 26 public static void init() { 26 Main.initApplicationPreferences();27 JOSMFixture.createUnitTestFixture().init(); 27 28 } 28 29 … … 78 79 try (InputStream fis = new FileInputStream("data_nodist/restriction.osm")) { 79 80 DataSet ds = OsmReader.parseDataSet(fis, NullProgressMonitor.INSTANCE); 80 81 81 82 for (Node n: ds.getNodes()) { 82 83 n.setCoor(new LatLon(10, 10)); 83 84 } 84 85 85 86 removeAllTest(ds); 86 87 } -
trunk/test/unit/org/openstreetmap/josm/data/osm/RelationTest.java
r6881 r7081 7 7 import org.junit.BeforeClass; 8 8 import org.junit.Test; 9 import org.openstreetmap.josm. Main;9 import org.openstreetmap.josm.JOSMFixture; 10 10 import org.openstreetmap.josm.data.coor.LatLon; 11 import org.openstreetmap.josm.data.projection.Projections;12 11 13 12 public class RelationTest { … … 18 17 @BeforeClass 19 18 public static void setUp() { 20 Main.setProjection(Projections.getProjectionByCode("EPSG:3857")); // Mercator 21 Main.initApplicationPreferences(); 19 JOSMFixture.createUnitTestFixture().init(); 22 20 } 23 21 -
trunk/test/unit/org/openstreetmap/josm/data/osm/visitor/MergeSourceBuildingVisitorTest.java
r6881 r7081 11 11 import org.junit.BeforeClass; 12 12 import org.junit.Test; 13 import org.openstreetmap.josm. Main;13 import org.openstreetmap.josm.JOSMFixture; 14 14 import org.openstreetmap.josm.data.coor.LatLon; 15 15 import org.openstreetmap.josm.data.osm.DataSet; … … 20 20 import org.openstreetmap.josm.data.osm.RelationMember; 21 21 import org.openstreetmap.josm.data.osm.Way; 22 import org.openstreetmap.josm.data.projection.Projections;23 22 24 23 public class MergeSourceBuildingVisitorTest { … … 39 38 @BeforeClass 40 39 public static void setUp() { 41 Main.setProjection(Projections.getProjectionByCode("EPSG:3857")); // Mercator 42 Main.initApplicationPreferences(); 43 } 44 45 @Test 46 public void test_Nodes() { 40 JOSMFixture.createUnitTestFixture().init(); 41 } 42 43 @Test 44 public void testNodes() { 47 45 DataSet source = new DataSet(); 48 46 Node n1 = new Node(1); … … 79 77 80 78 @Test 81 public void test _OneWay() {79 public void testOneWay() { 82 80 DataSet source = new DataSet(); 83 81 Node n1 = new Node(1); … … 111 109 112 110 @Test 113 public void test _OneWay_NodesSelectedToo() {111 public void testOneWayNodesSelectedToo() { 114 112 DataSet source = new DataSet(); 115 113 Node n1 = new Node(1); … … 143 141 144 142 @Test 145 public void test _OneWay_Incomplete() {143 public void testOneWayIncomplete() { 146 144 DataSet source = new DataSet(); 147 145 Way w1 = new Way(3); … … 161 159 162 160 @Test 163 public void test _OneRelation_ExistingMembersSelected() {161 public void testOneRelationExistingMembersSelected() { 164 162 DataSet source = new DataSet(); 165 163 Relation r1 = new Relation(1, 1); … … 220 218 221 219 @Test 222 public void test _OneRelation_ExistingMembersNotSelected() {220 public void testOneRelationExistingMembersNotSelected() { 223 221 DataSet source = new DataSet(); 224 222 Relation r1 = new Relation(1, 1); … … 279 277 280 278 @Test 281 public void test _OneRelation_NewMembersNotSelected() {279 public void testOneRelationNewMembersNotSelected() { 282 280 DataSet source = new DataSet(); 283 281 Relation r1 = new Relation(); … … 346 344 347 345 @Test 348 public void test _OneRelation_Existing_Recursive() {346 public void testOneRelationExistingRecursive() { 349 347 DataSet source = new DataSet(); 350 348 Relation r1 = new Relation(1, 1); … … 365 363 366 364 @Test 367 public void test _OneRelation_New_Recursive() {365 public void testOneRelationNewRecursive() { 368 366 DataSet source = new DataSet(); 369 367 Relation r1 = new Relation(); … … 385 383 386 384 @Test 387 public void test _TwoRelation_Existing_Circular() {385 public void testTwoRelationExistingCircular() { 388 386 DataSet source = new DataSet(); 389 387 Relation r1 = new Relation(1, 1); -
trunk/test/unit/org/openstreetmap/josm/data/projection/ProjectionRegressionTest.java
r7030 r7081 23 23 import org.junit.BeforeClass; 24 24 import org.junit.Test; 25 import org.openstreetmap.josm. Main;25 import org.openstreetmap.josm.JOSMFixture; 26 26 import org.openstreetmap.josm.data.Bounds; 27 27 import org.openstreetmap.josm.data.coor.EastNorth; … … 120 120 } 121 121 TestData next = new TestData(); 122 122 123 123 Pair<Double,Double> ll = readLine("ll", in.readLine()); 124 124 Pair<Double,Double> en = readLine("en", in.readLine()); 125 125 Pair<Double,Double> ll2 = readLine("ll2", in.readLine()); 126 126 127 127 next.code = line; 128 128 next.ll = new LatLon(ll.a, ll.b); 129 129 next.en = new EastNorth(en.a, en.b); 130 130 next.ll2 = new LatLon(ll2.a, ll2.b); 131 131 132 132 result.add(next); 133 133 } … … 150 150 @BeforeClass 151 151 public static void setUp() { 152 Main.initApplicationPreferences();152 JOSMFixture.createUnitTestFixture().init(); 153 153 } 154 154 -
trunk/test/unit/org/openstreetmap/josm/data/validation/tests/ConditionalKeysTest.groovy
r6605 r7081 2 2 package org.openstreetmap.josm.data.validation.tests 3 3 4 import org.openstreetmap.josm. Main4 import org.openstreetmap.josm.JOSMFixture 5 5 import org.openstreetmap.josm.gui.preferences.map.TaggingPresetPreference 6 6 7 7 class ConditionalKeysTest extends GroovyTestCase { 8 8 9 deftest = new ConditionalKeys()9 ConditionalKeys test = new ConditionalKeys() 10 10 11 11 @Override 12 12 void setUp() { 13 Main.initApplicationPreferences();13 JOSMFixture.createUnitTestFixture().init(); 14 14 TaggingPresetPreference.readFromPreferences() 15 15 test.initialize() … … 40 40 assert !test.isValueValid("motor_vehicle:conditional", "no @ (10:00until18:00 AND length>5)") 41 41 assert test.isValueValid("maxspeed:hgv:conditional", "60 @ (weight>7.5)") 42 43 42 } 44 43 } -
trunk/test/unit/org/openstreetmap/josm/data/validation/tests/DuplicateNodeTest.java
r6881 r7081 6 6 import org.junit.BeforeClass; 7 7 import org.junit.Test; 8 import org.openstreetmap.josm. Main;8 import org.openstreetmap.josm.JOSMFixture; 9 9 import org.openstreetmap.josm.data.coor.LatLon; 10 10 import org.openstreetmap.josm.data.osm.DataSet; 11 11 import org.openstreetmap.josm.data.osm.Node; 12 import org.openstreetmap.josm.data.projection.Projections;13 12 import org.openstreetmap.josm.gui.progress.NullProgressMonitor; 14 13 … … 23 22 @BeforeClass 24 23 public static void setUp() { 25 Main.setProjection(Projections.getProjectionByCode("EPSG:3857")); // Mercator 26 Main.initApplicationPreferences(); 24 JOSMFixture.createUnitTestFixture().init(); 27 25 } 28 26 -
trunk/test/unit/org/openstreetmap/josm/data/validation/tests/HighwaysTest.groovy
r6573 r7081 2 2 package org.openstreetmap.josm.data.validation.tests 3 3 4 import org.openstreetmap.josm. Main4 import org.openstreetmap.josm.JOSMFixture 5 5 import org.openstreetmap.josm.data.coor.LatLon 6 6 import org.openstreetmap.josm.data.osm.DataSet 7 7 import org.openstreetmap.josm.data.osm.Way 8 import org.openstreetmap.josm.data.projection.Projections9 8 10 9 class HighwaysTest extends GroovyTestCase { … … 12 11 @Override 13 12 void setUp() { 14 Main.initApplicationPreferences() 15 Main.setProjection(Projections.getProjectionByCode("EPSG:3857")); 13 JOSMFixture.createUnitTestFixture().init(); 16 14 } 17 15 -
trunk/test/unit/org/openstreetmap/josm/data/validation/tests/LanesTest.groovy
r7068 r7081 1 1 package org.openstreetmap.josm.data.validation.tests 2 2 3 import org.openstreetmap.josm.TestUtils ;3 import org.openstreetmap.josm.TestUtils 4 4 5 5 class LanesTest extends GroovyTestCase { 6 6 7 deflanes = new Lanes()7 Lanes lanes = new Lanes() 8 8 9 9 @Override -
trunk/test/unit/org/openstreetmap/josm/data/validation/tests/MapCSSTagCheckerTest.java
r7073 r7081 15 15 import org.junit.BeforeClass; 16 16 import org.junit.Test; 17 import org.openstreetmap.josm. Main;17 import org.openstreetmap.josm.JOSMFixture; 18 18 import org.openstreetmap.josm.TestUtils; 19 19 import org.openstreetmap.josm.command.ChangePropertyCommand; … … 33 33 @BeforeClass 34 34 public static void setUp() { 35 Main.initApplicationPreferences();35 JOSMFixture.createUnitTestFixture().init(); 36 36 } 37 37 -
trunk/test/unit/org/openstreetmap/josm/data/validation/tests/OpeningHourTestTest.java
r7051 r7081 16 16 import org.junit.Before; 17 17 import org.junit.Test; 18 import org.openstreetmap.josm. Main;18 import org.openstreetmap.josm.JOSMFixture; 19 19 import org.openstreetmap.josm.data.osm.Tag; 20 20 import org.openstreetmap.josm.data.validation.Severity; … … 37 37 @Before 38 38 public void setUp() throws Exception { 39 Main.initApplicationPreferences();39 JOSMFixture.createUnitTestFixture().init(); 40 40 OPENING_HOUR_TEST.initialize(); 41 41 } … … 135 135 final String key = "opening_hours"; 136 136 assertThat(OPENING_HOUR_TEST.checkOpeningHourSyntax(key, "Mo,Tu 04-17").get(0).getSeverity(), is(Severity.WARNING)); 137 assertThat(OPENING_HOUR_TEST.checkOpeningHourSyntax(key, "Mo,Tu 04-17").get(0).getMessage(), 137 assertThat(OPENING_HOUR_TEST.checkOpeningHourSyntax(key, "Mo,Tu 04-17").get(0).getMessage(), 138 138 is(key + " - Mo,Tu 04-17 <--- (Time range without minutes specified. Not very explicit! Please use this syntax instead e.g. \"12:00-14:00\".)")); 139 139 assertThat(OPENING_HOUR_TEST.checkOpeningHourSyntax(key, "Mo,Tu 04-17").get(0).getPrettifiedValue(), is("Mo,Tu 04:00-17:00")); -
trunk/test/unit/org/openstreetmap/josm/data/validation/tests/UnconnectedWaysTest.java
r7033 r7081 10 10 import org.junit.Before; 11 11 import org.junit.Test; 12 import org.openstreetmap.josm. Main;12 import org.openstreetmap.josm.JOSMFixture; 13 13 import org.openstreetmap.josm.data.osm.DataSet; 14 import org.openstreetmap.josm.data.projection.Projections;15 14 import org.openstreetmap.josm.gui.progress.NullProgressMonitor; 16 15 import org.openstreetmap.josm.io.OsmReader; … … 26 25 public void setUp() throws Exception { 27 26 bib = new UnconnectedWays.UnconnectedHighways(); 28 Main.initApplicationPreferences(); 29 Main.setProjection(Projections.getProjectionByCode("EPSG:3857")); 27 JOSMFixture.createUnitTestFixture().init(); 30 28 bib.initialize(); 31 29 bib.startTest(null); -
trunk/test/unit/org/openstreetmap/josm/gui/JosmUserIdentityManagerTest.groovy
r7068 r7081 14 14 final shouldFail = new GroovyTestCase().&shouldFail 15 15 16 private static JOSMFixture josmFixture17 18 16 @BeforeClass 19 17 public static void initTestCase() { 20 josmFixture =JOSMFixture.createFunctionalTestFixture()18 JOSMFixture.createUnitTestFixture().init() 21 19 } 22 20 -
trunk/test/unit/org/openstreetmap/josm/gui/SystemOfMeasurementTest.java
r6992 r7081 9 9 import org.junit.BeforeClass; 10 10 import org.junit.Test; 11 import org.openstreetmap.josm. Main;11 import org.openstreetmap.josm.JOSMFixture; 12 12 import org.openstreetmap.josm.data.SystemOfMeasurement; 13 13 … … 22 22 @BeforeClass 23 23 public static void setUp() { 24 Main.initApplicationPreferences();24 JOSMFixture.createUnitTestFixture().init(); 25 25 } 26 26 -
trunk/test/unit/org/openstreetmap/josm/gui/conflict/nodes/NodeListMergeModelTest.java
r7005 r7081 18 18 import org.junit.BeforeClass; 19 19 import org.junit.Test; 20 import org.openstreetmap.josm. Main;20 import org.openstreetmap.josm.JOSMFixture; 21 21 import org.openstreetmap.josm.data.osm.DatasetFactory; 22 22 import org.openstreetmap.josm.data.osm.Node; … … 31 31 @BeforeClass 32 32 public static void init() { 33 Main.initApplicationPreferences();33 JOSMFixture.createUnitTestFixture().init(); 34 34 } 35 35 -
trunk/test/unit/org/openstreetmap/josm/gui/conflict/properties/PropertiesMergeModelTest.java
r7005 r7081 12 12 import org.junit.BeforeClass; 13 13 import org.junit.Test; 14 import org.openstreetmap.josm. Main;14 import org.openstreetmap.josm.JOSMFixture; 15 15 import org.openstreetmap.josm.data.conflict.Conflict; 16 16 import org.openstreetmap.josm.data.coor.LatLon; … … 20 20 import org.openstreetmap.josm.data.osm.Relation; 21 21 import org.openstreetmap.josm.data.osm.Way; 22 import org.openstreetmap.josm.data.projection.Projections;23 22 import org.openstreetmap.josm.gui.conflict.pair.MergeDecisionType; 24 23 import org.openstreetmap.josm.gui.conflict.pair.properties.PropertiesMergeModel; … … 46 45 @BeforeClass 47 46 public static void init() { 48 Main.setProjection(Projections.getProjectionByCode("EPSG:4326")); 49 Main.initApplicationPreferences(); 47 JOSMFixture.createUnitTestFixture().init(); 50 48 } 51 49 -
trunk/test/unit/org/openstreetmap/josm/gui/conflict/tags/TagMergeItemTest.java
r7005 r7081 8 8 import org.junit.BeforeClass; 9 9 import org.junit.Test; 10 import org.openstreetmap.josm. Main;10 import org.openstreetmap.josm.JOSMFixture; 11 11 import org.openstreetmap.josm.data.osm.Node; 12 12 import org.openstreetmap.josm.gui.conflict.pair.MergeDecisionType; … … 17 17 @BeforeClass 18 18 public static void init() { 19 Main.initApplicationPreferences();19 JOSMFixture.createUnitTestFixture().init(); 20 20 } 21 21 -
trunk/test/unit/org/openstreetmap/josm/gui/conflict/tags/TagMergeModelTest.java
r7005 r7081 12 12 import org.junit.BeforeClass; 13 13 import org.junit.Test; 14 import org.openstreetmap.josm. Main;14 import org.openstreetmap.josm.JOSMFixture; 15 15 import org.openstreetmap.josm.data.osm.Node; 16 16 import org.openstreetmap.josm.gui.conflict.pair.MergeDecisionType; … … 23 23 @BeforeClass 24 24 public static void init() { 25 Main.initApplicationPreferences();25 JOSMFixture.createUnitTestFixture().init(); 26 26 } 27 27 -
trunk/test/unit/org/openstreetmap/josm/gui/mappaint/MapCSSWithExtendedTextDirectivesTest.groovy
r7068 r7081 4 4 5 5 import org.junit.* 6 import org.openstreetmap.josm.JOSMFixture ;6 import org.openstreetmap.josm.JOSMFixture 7 7 import org.openstreetmap.josm.gui.mappaint.LabelCompositionStrategy.DeriveLabelFromNameTagsCompositionStrategy 8 8 import org.openstreetmap.josm.gui.mappaint.LabelCompositionStrategy.TagLookupCompositionStrategy 9 9 import org.openstreetmap.josm.gui.mappaint.MapPaintStyles.TagKeyReference 10 10 11 class MapCSSWithExtendedTextDirectivesTest { 11 12 12 13 13 @BeforeClass … … 20 20 Cascade c = new Cascade() 21 21 c.put("text", new Keyword("auto")) 22 22 23 23 TextElement te = TextElement.create(c, Color.WHITE, false /* no default annotate */) 24 24 assert te.labelCompositionStrategy != null 25 25 assert te.labelCompositionStrategy instanceof DeriveLabelFromNameTagsCompositionStrategy 26 26 } 27 27 28 28 @Test 29 29 public void createTextElementComposingTextFromTag() { 30 30 Cascade c = new Cascade() 31 31 c.put("text", new TagKeyReference("my_name")) 32 32 33 33 TextElement te = TextElement.create(c, Color.WHITE, false /* no default annotate */) 34 34 assert te.labelCompositionStrategy != null … … 36 36 assert te.labelCompositionStrategy.getDefaultLabelTag() == "my_name" 37 37 } 38 38 39 39 @Test 40 40 public void createNullStrategy() { 41 41 Cascade c = new Cascade() 42 42 43 43 TextElement te = TextElement.create(c, Color.WHITE, false /* no default annotate */) 44 assert te .labelCompositionStrategy== null44 assert te == null 45 45 } 46 46 } 47 -
trunk/test/unit/org/openstreetmap/josm/gui/mappaint/mapcss/ChildOrParentSelectorTest.groovy
r7068 r7081 7 7 8 8 import org.junit.* 9 import org.openstreetmap.josm.JOSMFixture ;9 import org.openstreetmap.josm.JOSMFixture 10 10 import org.openstreetmap.josm.data.coor.LatLon 11 11 import org.openstreetmap.josm.data.osm.DataSet … … 19 19 class ChildOrParentSelectorTest { 20 20 static private Logger logger = Logger.getLogger(ChildOrParentSelectorTest.class.getName()); 21 21 22 22 def shouldFail = new GroovyTestCase().&shouldFail 23 23 24 24 def DataSet ds; 25 25 26 26 @BeforeClass 27 27 public static void createJOSMFixture(){ 28 28 JOSMFixture.createUnitTestFixture().init() 29 29 } 30 30 31 31 @Before 32 32 public void setUp() { 33 33 ds = new DataSet() 34 34 } 35 35 36 36 def relation(id) { 37 37 def r = new Relation(id,1) … … 39 39 return r 40 40 } 41 41 42 42 def node(id) { 43 43 def n = new Node(id,1) … … 46 46 return n 47 47 } 48 48 49 49 def way(id){ 50 50 def w = new Way(id,1) … … 52 52 return w 53 53 } 54 54 55 55 def ChildOrParentSelector parse(css){ 56 56 MapCSSStyleSource source = new MapCSSStyleSource(css) 57 57 source.loadStyleSource() 58 58 assert source.rules.size() == 1 59 assert source.rules[0].selectors.size() == 1 60 return source.rules[0].selectors[0] 59 return source.rules[0].selector 61 60 } 62 61 63 62 @Test 64 63 @Ignore … … 68 67 """ 69 68 ChildOrParentSelector selector = parse(css) 70 69 71 70 Relation r = relation(1) 72 71 Node n = node(1) 73 72 r.addMember(new RelationMember("my_role", n)) 74 73 Environment e = new Environment().withChild(n) 75 76 assert selector.matches(e) 74 75 assert selector.matches(e) 77 76 } 78 77 79 78 @Test 80 79 @Ignore … … 84 83 """ 85 84 ChildOrParentSelector selector = parse(css) 86 85 87 86 Relation r = relation(1) 88 87 Node n = node(1) 89 88 r.addMember(new RelationMember("my_role", n)) 90 89 Environment e = new Environment().withChild(n) 91 90 92 91 assert selector.matches(e) 93 92 } 94 93 95 94 @Test 96 95 @Ignore … … 100 99 """ 101 100 ChildOrParentSelector selector = parse(css) 102 101 103 102 Relation r = relation(1) 104 103 Node n = node(1) 105 104 r.addMember(new RelationMember("my_role", n)) 106 105 Environment e = new Environment().withChild(n) 107 106 108 107 assert !selector.matches(e) 109 108 } 110 109 111 110 @Test 112 111 @Ignore … … 114 113 def css = """ 115 114 way < relation {} 116 """ 115 """ 117 116 ChildOrParentSelector selector = parse(css) 118 assert selector. parentSelector119 117 assert selector.type == Selector.ChildOrParentSelectorType.PARENT 118 120 119 } 121 120 @Test … … 124 123 way <[role != "my_role"] relation {} 125 124 """ 126 ChildOrParentSelector selector = parse(css) 127 assert selector. parentSelector128 125 ChildOrParentSelector selector = parse(css) 126 assert selector.type == Selector.ChildOrParentSelectorType.PARENT 127 129 128 Relation r = relation(1) 130 129 Way w1 = way(1) … … 133 132 Way w2 = way(2) 134 133 w2.setNodes([node(21), node(22)]) 135 134 136 135 Way w3 = way(3) 137 136 w3.setNodes([node(31), node(32)]) … … 140 139 r.addMember(new RelationMember("my_role", w2)) 141 140 r.addMember(new RelationMember("another role", w3)) 142 141 143 142 Environment e = new Environment().withPrimitive(r) 144 143 assert selector.matches(e) 145 144 } 146 145 147 146 @Test 148 147 public void matches_6() { … … 150 149 relation >[role != "my_role"] way {} 151 150 """ 152 ChildOrParentSelector selector = parse(css) 153 151 ChildOrParentSelector selector = parse(css) 152 154 153 Relation r = relation(1) 155 154 Way w1 = way(1) … … 158 157 Way w2 = way(2) 159 158 w2.setNodes([node(21), node(22)]) 160 159 161 160 Way w3 = way(3) 162 161 w3.setNodes([node(31), node(32)]) … … 165 164 r.addMember(new RelationMember("my_role", w2)) 166 165 r.addMember(new RelationMember("another role", w3)) 167 166 168 167 Environment e = new Environment().withPrimitive(w1) 169 168 assert !selector.matches(e) 170 169 171 170 e = new Environment().withPrimitive(w2) 172 171 assert !selector.matches(e) 173 172 174 173 e = new Environment().withPrimitive(w3) 175 174 assert selector.matches(e) -
trunk/test/unit/org/openstreetmap/josm/gui/mappaint/mapcss/KeyConditionTest.groovy
r7068 r7081 5 5 6 6 import org.junit.* 7 import org.openstreetmap.josm.JOSMFixture ;7 import org.openstreetmap.josm.JOSMFixture 8 8 import org.openstreetmap.josm.data.coor.LatLon 9 9 import org.openstreetmap.josm.data.osm.DataSet … … 17 17 18 18 def shouldFail = new GroovyTestCase().&shouldFail 19 19 20 20 def DataSet ds; 21 21 22 22 @BeforeClass 23 23 public static void createJOSMFixture(){ 24 24 JOSMFixture.createUnitTestFixture().init() 25 25 } 26 26 27 27 @Before 28 28 public void setUp() { 29 29 ds = new DataSet() 30 30 } 31 31 32 32 def relation(id) { 33 33 def r = new Relation(id,1) … … 35 35 return r 36 36 } 37 37 38 38 def node(id) { 39 39 def n = new Node(id,1) … … 42 42 return n 43 43 } 44 44 45 45 @Test 46 46 public void create() { 47 47 48 48 // ["a label"] 49 Condition c = Condition.create("a key", false, false, Context.PRIMITIVE)49 Condition c = Condition.createKeyCondition("a key", false, Condition.KeyMatchType.FALSE, Context.PRIMITIVE) 50 50 // ["a label"?] 51 c = Condition.create("a key", false, true, Context.PRIMITIVE)51 c = Condition.createKeyCondition("a key", false, Condition.KeyMatchType.TRUE, Context.PRIMITIVE) 52 52 // [!"a label"] 53 c = Condition.create("a key", true, false, Context.PRIMITIVE)53 c = Condition.createKeyCondition("a key", true, Condition.KeyMatchType.FALSE, Context.PRIMITIVE) 54 54 // [!"a label"?] 55 c = Condition.create("a key", true, true, Context.PRIMITIVE)56 55 c = Condition.createKeyCondition("a key", true, Condition.KeyMatchType.TRUE, Context.PRIMITIVE) 56 57 57 // ["a label"] 58 c = Condition.create("a key", false, false, Context.LINK)58 c = Condition.createKeyCondition("a key", false, null, Context.LINK) 59 59 // [!"a label"] 60 c = Condition.create("a key", true, false, Context.LINK)61 60 c = Condition.createKeyCondition("a key", true, null, Context.LINK) 61 62 62 shouldFail(MapCSSException) { 63 63 // ["a label"?] 64 c = Condition.create("a key", false, true, Context.LINK)64 c = Condition.createKeyCondition("a key", false, Condition.KeyMatchType.TRUE, Context.LINK) 65 65 } 66 66 67 67 shouldFail(MapCSSException) { 68 68 // [!"a label"?] 69 c = Condition.create("a key", true, true, Context.LINK)69 c = Condition.createKeyCondition("a key", true, Condition.KeyMatchType.TRUE, Context.LINK) 70 70 } 71 71 } 72 72 73 73 @Test 74 74 public void applies_1() { … … 76 76 Node n = node(1) 77 77 r.addMember(new RelationMember("my_role", n)) 78 78 79 79 Environment e = new Environment().withPrimitive(n).withParent(r).withIndex(0).withLinkContext() 80 81 Condition cond = Condition.create("my_role", false, false, Context.LINK)82 assert cond.applies(e) 83 84 cond = Condition.create("my_role", true, false, Context.LINK)80 81 Condition cond = Condition.createKeyCondition("my_role", false, null, Context.LINK) 82 assert cond.applies(e) 83 84 cond = Condition.createKeyCondition("my_role", true, null, Context.LINK) 85 85 assert !cond.applies(e) 86 86 } 87 87 88 88 @Test 89 89 public void applies_2() { … … 91 91 Node n = node(1) 92 92 r.addMember(new RelationMember("my_role", n)) 93 93 94 94 Environment e = new Environment().withPrimitive(n).withParent(r).withIndex(0).withLinkContext() 95 96 Condition cond = Condition.create("another_role", false, false, Context.LINK)95 96 Condition cond = Condition.createKeyCondition("another_role", false, null, Context.LINK) 97 97 assert !cond.applies(e) 98 99 cond = Condition.create("another_role", true, false, Context.LINK)98 99 cond = Condition.createKeyCondition("another_role", true, null, Context.LINK) 100 100 assert cond.applies(e) 101 } 101 } 102 102 } 103 -
trunk/test/unit/org/openstreetmap/josm/gui/mappaint/mapcss/KeyValueConditionTest.groovy
r7068 r7081 5 5 6 6 import org.junit.* 7 import org.openstreetmap.josm.JOSMFixture ;7 import org.openstreetmap.josm.JOSMFixture 8 8 import org.openstreetmap.josm.data.coor.LatLon 9 9 import org.openstreetmap.josm.data.osm.DataSet … … 19 19 20 20 def shouldFail = new GroovyTestCase().&shouldFail 21 21 22 22 def DataSet ds; 23 23 24 24 @BeforeClass 25 25 public static void createJOSMFixture(){ 26 26 JOSMFixture.createUnitTestFixture().init() 27 27 } 28 28 29 29 @Before 30 30 public void setUp() { 31 31 ds = new DataSet() 32 32 } 33 33 34 34 def relation(id) { 35 35 def r = new Relation(id,1) … … 37 37 return r 38 38 } 39 39 40 40 def node(id) { 41 41 def n = new Node(id,1) … … 44 44 return n 45 45 } 46 46 47 47 @Test 48 48 public void create() { 49 Condition c = Condition.create("a key", "a value", Op.EQ, Context.PRIMITIVE) 50 51 c = Condition.create("role", "a role", Op.EQ, Context.LINK) 52 c = Condition.create("RoLe", "a role", Op.EQ, Context.LINK) 53 49 Condition c = Condition.createKeyValueCondition("a key", "a value", Op.EQ, Context.PRIMITIVE, false) 50 51 c = Condition.createKeyValueCondition("role", "a role", Op.EQ, Context.LINK, false) 52 c = Condition.createKeyValueCondition("RoLe", "a role", Op.EQ, Context.LINK, false) 53 54 54 shouldFail(MapCSSException) { 55 c = Condition.create("an arbitry tag", "a role", Op.EQ, Context.LINK) 55 c = Condition.createKeyValueCondition("an arbitry tag", "a role", Op.EQ, Context.LINK, false) 56 56 } 57 57 } 58 58 59 59 @Test 60 60 public void applies_1() { … … 62 62 Node n = node(1) 63 63 r.addMember(new RelationMember("my_role", n)) 64 64 65 65 Environment e = new Environment().withPrimitive(n).withParent(r).withLinkContext().withIndex(0) 66 66 67 67 Condition cond = new Condition.RoleCondition("my_role", Op.EQ) 68 assert cond.applies(e) 69 68 assert cond.applies(e) 69 70 70 cond = new Condition.RoleCondition("another_role", Op.EQ) 71 71 assert !cond.applies(e) 72 72 } 73 73 74 74 @Test 75 75 public void applies_2() { … … 77 77 Node n = node(1) 78 78 r.addMember(new RelationMember("my_role", n)) 79 79 80 80 Environment e = new Environment().withPrimitive(n).withParent(r).withIndex(0).withLinkContext() 81 82 Condition cond = Condition.create("role", "my_role", Op.NEQ, Context.LINK) 81 82 Condition cond = Condition.createKeyValueCondition("role", "my_role", Op.NEQ, Context.LINK, false) 83 83 assert !cond.applies(e) 84 85 cond = Condition.create("role", "another_role", Op.NEQ, Context.LINK) 84 85 cond = Condition.createKeyValueCondition("role", "another_role", Op.NEQ, Context.LINK, false) 86 86 assert cond.applies(e) 87 87 } 88 89 90 91 88 } 92 -
trunk/test/unit/org/openstreetmap/josm/gui/mappaint/mapcss/MapCSSParserTest.groovy
r7068 r7081 5 5 import org.junit.Before 6 6 import org.junit.Test 7 import org.openstreetmap.josm.JOSMFixture 7 8 import org.openstreetmap.josm.Main 8 import org.openstreetmap.josm.TestUtils ;9 import org.openstreetmap.josm.TestUtils 9 10 import org.openstreetmap.josm.data.coor.LatLon 10 11 import org.openstreetmap.josm.data.osm.DataSet 11 12 import org.openstreetmap.josm.data.osm.OsmPrimitive 12 13 import org.openstreetmap.josm.data.osm.Way 13 import org.openstreetmap.josm.data.projection.Projections14 14 import org.openstreetmap.josm.gui.mappaint.Environment 15 15 import org.openstreetmap.josm.gui.mappaint.MultiCascade … … 35 35 @Before 36 36 public void setUp() throws Exception { 37 Main.initApplicationPreferences() 38 Main.setProjection(Projections.getProjectionByCode("EPSG:3857")); 37 JOSMFixture.createUnitTestFixture().init(); 39 38 } 40 39 … … 57 56 public void testClassCondition() throws Exception { 58 57 def conditions = ((Selector.GeneralSelector) getParser("way[name=X].highway:closed").selector()).conds 59 assert conditions.get(0) instanceof Condition.KeyValueCondition 58 assert conditions.get(0) instanceof Condition.SimpleKeyValueCondition 60 59 assert conditions.get(0).applies(getEnvironment("name", "X")) 61 60 assert conditions.get(1) instanceof Condition.ClassCondition … … 89 88 @Test 90 89 public void testEqualCondition() throws Exception { 91 def condition = (Condition.KeyValueCondition) getParser("[surface=paved]").condition(Condition.Context.PRIMITIVE) 92 assert condition instanceof Condition.KeyValueCondition 93 assert Condition.Op.EQ.equals(condition.op) 90 def condition = (Condition.SimpleKeyValueCondition) getParser("[surface=paved]").condition(Condition.Context.PRIMITIVE) 91 assert condition instanceof Condition.SimpleKeyValueCondition 94 92 assert "surface".equals(condition.k) 95 93 assert "paved".equals(condition.v) … … 215 213 216 214 @Test 217 public void testTicket8071 1() throws Exception {215 public void testTicket8071() throws Exception { 218 216 def sheet = new MapCSSStyleSource("") 219 217 getParser("*[rcn_ref], *[name] {text: concat(tag(rcn_ref), \" \", tag(name)); }").sheet(sheet) -
trunk/test/unit/org/openstreetmap/josm/gui/tagging/TaggingPresetReaderTest.java
r7068 r7081 13 13 import org.junit.BeforeClass; 14 14 import org.junit.Test; 15 import org.openstreetmap.josm. Main;15 import org.openstreetmap.josm.JOSMFixture; 16 16 import org.openstreetmap.josm.TestUtils; 17 17 import org.openstreetmap.josm.tools.Utils; … … 28 28 @BeforeClass 29 29 public static void setUp() { 30 Main.initApplicationPreferences();30 JOSMFixture.createUnitTestFixture().init(); 31 31 } 32 32 -
trunk/test/unit/org/openstreetmap/josm/io/DiffResultProcessorTest.groovy
r2605 r7081 2 2 package org.openstreetmap.josm.io; 3 3 4 import static org.junit.Assert.* 4 5 5 import org.junit.Test 6 import org.openstreetmap.josm.data.osm.Node; 7 import org.openstreetmap.josm.data.osm.Way; 8 import org.openstreetmap.josm.data.osm.Relation; 9 import org.openstreetmap.josm.data.osm.Changeset; 6 import org.junit.Test 10 7 import org.openstreetmap.josm.data.coor.LatLon 11 import org.openstreetmap.josm.data.osm.OsmPrimitiveType; 12 import org.openstreetmap.josm.data.osm.SimplePrimitiveId; 13 import org.openstreetmap.josm.gui.progress.NullProgressMonitor; 14 15 import static org.junit.Assert.*; 8 import org.openstreetmap.josm.data.osm.Changeset 9 import org.openstreetmap.josm.data.osm.Node 10 import org.openstreetmap.josm.data.osm.OsmPrimitiveType 11 import org.openstreetmap.josm.data.osm.Relation 12 import org.openstreetmap.josm.data.osm.SimplePrimitiveId 13 import org.openstreetmap.josm.data.osm.Way 14 import org.openstreetmap.josm.gui.progress.NullProgressMonitor 15 import org.openstreetmap.josm.tools.XmlParsingException 16 16 17 17 class DiffResultProcessorTest { 18 19 18 19 20 20 @Test 21 21 public void testConstructor() { 22 22 Node n = new Node(1) 23 // these calls should not fail 23 // these calls should not fail 24 24 // 25 25 def DiffResultProcessor processor = new DiffResultProcessor(null) … … 27 27 processor = new DiffResultProcessor([n]) 28 28 } 29 29 30 30 @Test 31 31 public void testParse_NOK_Cases() { 32 32 def DiffResultProcessor processor = new DiffResultProcessor([]) 33 33 34 34 final shouldFail = new GroovyTestCase().&shouldFail 35 35 36 36 shouldFail(IllegalArgumentException) { 37 37 processor.parse null, NullProgressMonitor.INSTANCE 38 38 } 39 40 shouldFail( OsmDataParsingException) {39 40 shouldFail(XmlParsingException) { 41 41 processor.parse "", NullProgressMonitor.INSTANCE 42 42 } 43 44 shouldFail( OsmDataParsingException) {43 44 shouldFail(XmlParsingException) { 45 45 processor.parse "<x></x>", NullProgressMonitor.INSTANCE 46 } 46 } 47 47 } 48 49 @Test 48 49 @Test 50 50 public void testParse_OK_Cases() { 51 51 def DiffResultProcessor processor = new DiffResultProcessor([]) … … 57 57 </diffResult> 58 58 """ 59 59 60 60 processor.parse doc, null 61 61 assert processor.@diffResults.size() == 3 … … 65 65 assert entry.new_id == 1 66 66 assert entry.new_version == 1 67 67 68 68 id = new SimplePrimitiveId(-2, OsmPrimitiveType.WAY) 69 69 entry = processor.@diffResults[id] … … 71 71 assert entry.new_id == 2 72 72 assert entry.new_version == 1 73 73 74 74 id = new SimplePrimitiveId(-3, OsmPrimitiveType.RELATION) 75 75 entry = processor.@diffResults[id] 76 76 assert entry != null 77 77 assert entry.new_id == 3 78 assert entry.new_version == 1 78 assert entry.new_version == 1 79 79 } 80 80 81 81 @Test 82 82 public void testPostProcess_Invocation_Variants() { … … 89 89 </diffResult> 90 90 """ 91 91 92 92 processor.parse doc, null 93 93 94 94 // should all be ok 95 95 // … … 99 99 processor.postProcess new Changeset(1), NullProgressMonitor.INSTANCE 100 100 } 101 101 102 102 @Test 103 103 public void testPostProcess_OK() { 104 104 105 105 Node n = new Node() 106 106 Way w = new Way() 107 107 Relation r = new Relation() 108 108 109 109 String doc = """\ 110 110 <diffResult version="0.6" generator="Test Data"> … … 114 114 </diffResult> 115 115 """ 116 116 117 117 def DiffResultProcessor processor = new DiffResultProcessor([n,w,r]) 118 118 processor.parse doc, null … … 122 122 assert n.changesetId == 5 123 123 assert n.version == 10 124 124 125 125 w = processed.find {it.uniqueId == 2} 126 126 assert w.changesetId == 5 127 127 assert w.version == 11 128 128 129 129 r = processed.find {it.uniqueId == 3} 130 130 assert r.changesetId == 5 131 assert r.version == 12 131 assert r.version == 12 132 132 } 133 133 134 134 @Test 135 135 public void testPostProcess_ForCreatedElement() { 136 137 Node n = new Node() 136 137 Node n = new Node() 138 138 String doc = """\ 139 139 <diffResult version="0.6" generator="Test Data"> … … 141 141 </diffResult> 142 142 """ 143 143 144 144 def DiffResultProcessor processor = new DiffResultProcessor([n]) 145 145 processor.parse doc, null … … 150 150 assert n.version == 1 151 151 } 152 152 153 153 @Test 154 154 public void testPostProcess_ForModifiedElement() { 155 155 156 156 Node n = new Node(1) 157 157 n.coor = new LatLon(1,1) … … 163 163 </diffResult> 164 164 """ 165 165 166 166 def DiffResultProcessor processor = new DiffResultProcessor([n]) 167 167 processor.parse doc, null … … 172 172 assert n.version == 3 173 173 } 174 174 175 175 @Test 176 176 public void testPostProcess_ForDeletedElement() { 177 177 178 178 Node n = new Node(1) 179 179 n.coor = new LatLon(1,1) … … 185 185 </diffResult> 186 186 """ 187 187 188 188 def DiffResultProcessor processor = new DiffResultProcessor([n]) 189 189 processor.parse doc, null -
trunk/test/unit/org/openstreetmap/josm/io/OsmChangeBuilderTest.groovy
r2690 r7081 1 1 package org.openstreetmap.josm.io; 2 2 3 import org.junit.Test 4 import org.openstreetmap.josm.data.coor.LatLon 5 import org.openstreetmap.josm.data.osm.Changeset 6 7 import static org.junit.Assert.*; 8 3 import static org.junit.Assert.* 4 5 import org.junit.Test 6 import org.openstreetmap.josm.data.coor.LatLon 7 import org.openstreetmap.josm.data.osm.Changeset 8 import org.openstreetmap.josm.data.osm.Node 9 9 10 class OsmChangeBuilderTest { 10 11 /** 12 * Test various constructor invocations 11 12 /** 13 * Test various constructor invocations 13 14 */ 14 15 @Test 15 16 public void testConstructor() { 16 17 def Changeset cs = new Changeset(1) 17 // should not fail 18 OsmChangeBuilder builder = new OsmChangeBuilder(cs) 19 18 // should not fail 19 OsmChangeBuilder builder = new OsmChangeBuilder(cs) 20 20 21 // should not fail either - null allowed 21 22 builder = new OsmChangeBuilder(null) 22 23 // should not fail 23 24 // should not fail 24 25 builder = new OsmChangeBuilder(cs, "0.5") 25 26 26 27 builder = new OsmChangeBuilder(cs, null) 27 28 builder = new OsmChangeBuilder(null, null) 29 } 30 28 29 builder = new OsmChangeBuilder(null, null) 30 } 31 31 32 /** 32 33 * Test the sequence of method calls. Should throw IllegalStateException if … … 35 36 @Test 36 37 public void testSequenceOfMethodCalls() { 37 def Changeset cs = new Changeset(1) 38 OsmChangeBuilder builder = new OsmChangeBuilder(cs) 39 38 def Changeset cs = new Changeset(1) 39 OsmChangeBuilder builder = new OsmChangeBuilder(cs) 40 40 41 final shouldFail = new GroovyTestCase().&shouldFail 41 42 // should be OK 42 43 // should be OK 43 44 builder.start() 44 45 Node n = new Node(new LatLon(0,0)) 45 46 builder.append n 46 47 builder.finish() 47 48 48 49 shouldFail(IllegalStateException) { 49 50 builder = new OsmChangeBuilder(cs) 50 51 builder.append n 51 52 } 52 53 53 54 shouldFail(IllegalStateException) { 54 55 builder = new OsmChangeBuilder(cs) 55 56 builder.append([n]) 56 57 } 57 58 58 59 shouldFail(IllegalStateException) { 59 60 builder = new OsmChangeBuilder(cs) 60 61 builder.finish() 61 62 } 62 63 63 64 shouldFail(IllegalStateException) { 64 65 builder = new OsmChangeBuilder(cs) 65 66 builder.start() 66 67 builder.start() 67 } 68 } 69 68 } 69 } 70 70 71 @Test 71 72 public void testDocumentWithNewNode() { 72 def Changeset cs = new Changeset(1) 73 def Changeset cs = new Changeset(1) 73 74 OsmChangeBuilder builder = new OsmChangeBuilder(cs) 74 75 Node n = new Node(new LatLon(0,0)) 75 76 builder.start() 77 builder.append n 78 builder.finish() 79 76 77 builder.start() 78 builder.append n 79 builder.finish() 80 80 81 def doc = new XmlParser().parseText(builder.document) 81 82 assert doc.@version == "0.6" … … 85 86 def create = doc.create 86 87 assert create != null 87 88 88 89 assert create.size() == 1 89 90 def nodes = create[0].node … … 93 94 assert node.@lat != null 94 95 assert node.@lon != null 95 assert node.@changeset == cs.id.toString() 96 } 97 98 /** 99 * Test building a document with a modified node 96 assert node.@changeset == cs.id.toString() 97 } 98 99 /** 100 * Test building a document with a modified node 100 101 */ 101 102 @Test 102 103 public void testDocumentWithModifiedNode() { 103 def Changeset cs = new Changeset(1) 104 def Changeset cs = new Changeset(1) 104 105 OsmChangeBuilder builder = new OsmChangeBuilder(cs) 105 106 Node n = new Node(1) … … 107 108 n.incomplete = false 108 109 n.modified = true 109 110 builder.start() 111 builder.append n 112 builder.finish() 113 110 111 builder.start() 112 builder.append n 113 builder.finish() 114 114 115 def doc = new XmlParser().parseText(builder.document) 115 116 assert doc.@version == "0.6" … … 119 120 def modify = doc.modify 120 121 assert modify != null 121 122 122 123 assert modify.size() == 1 123 124 def nodes = modify[0].node … … 127 128 assert node.@lat != null 128 129 assert node.@lon != null 129 assert node.@changeset == cs.id.toString() 130 } 131 132 /** 133 * Test building a document with a deleted node 130 assert node.@changeset == cs.id.toString() 131 } 132 133 /** 134 * Test building a document with a deleted node 134 135 */ 135 136 @Test 136 137 public void testDocumentWithDeletedNode() { 137 def Changeset cs = new Changeset(1) 138 def Changeset cs = new Changeset(1) 138 139 OsmChangeBuilder builder = new OsmChangeBuilder(cs) 139 140 Node n = new Node(1) … … 141 142 n.incomplete = false 142 143 n.deleted = true 143 144 builder.start() 145 builder.append n 146 builder.finish() 147 144 145 builder.start() 146 builder.append n 147 builder.finish() 148 148 149 def doc = new XmlParser().parseText(builder.document) 149 150 assert doc.@version == "0.6" … … 153 154 def delete = doc.delete 154 155 assert delete != null 155 156 156 157 assert delete.size() == 1 157 158 def nodes = delete[0].node … … 159 160 def node = nodes[0] 160 161 assert node.@id == n.uniqueId.toString() 161 assert node.@lat != null162 assert node.@lon != null163 assert node.@changeset == cs.id.toString() 164 } 165 166 /** 167 * Test building a mixed document. 168 * 162 assert node.@lat == null 163 assert node.@lon == null 164 assert node.@changeset == cs.id.toString() 165 } 166 167 /** 168 * Test building a mixed document. 169 * 169 170 */ 170 171 @Test 171 172 public void testMixed() { 172 def Changeset cs = new Changeset(1) 173 def Changeset cs = new Changeset(1) 173 174 OsmChangeBuilder builder = new OsmChangeBuilder(cs) 174 175 Node n1 = new Node(1) … … 176 177 n1.incomplete = false 177 178 n1.deleted = true 178 179 179 180 Node n2 = new Node(new LatLon(0,0)) 180 181 181 182 Node n3 = new Node(2) 182 183 n3.coor = new LatLon(0,0) 183 184 n3.incomplete = false 184 185 n3.modified = true 185 186 186 187 builder.start() 187 188 builder.append([n1,n2,n3]) 188 189 builder.finish() 189 190 def doc = new XmlParser().parseText(builder.document) 191 190 191 def doc = new XmlParser().parseText(builder.document) 192 192 193 assert doc.children().size() == 3 193 194 assert doc.children()[0].name() == "delete" 194 195 assert doc.children()[1].name() == "create" 195 196 assert doc.children()[2].name() == "modify" 196 197 197 198 def node = doc.children()[0].node[0] 198 199 assert node.@id == n1.uniqueId.toString() 199 200 200 201 node = doc.children()[1].node[0] 201 202 assert node.@id == n2.uniqueId.toString() 202 203 203 204 node = doc.children()[2].node[0] 204 assert node.@id == n3.uniqueId.toString() 205 assert node.@id == n3.uniqueId.toString() 205 206 } 206 207 } -
trunk/test/unit/org/openstreetmap/josm/io/ParseWithChangesetReaderTest.groovy
r2605 r7081 2 2 package org.openstreetmap.josm.io; 3 3 4 import org.junit.Test 5 4 import static org.junit.Assert.* 5 6 import java.nio.charset.StandardCharsets 7 8 import org.junit.Test 9 import org.openstreetmap.josm.data.osm.DataSet 6 10 import org.openstreetmap.josm.data.osm.Node 7 11 import org.openstreetmap.josm.data.osm.OsmPrimitiveType 8 import org.openstreetmap.josm.data.osm.DataSet9 10 import static org.junit.Assert.*;11 12 12 13 class ParseWithChangesetReaderTest { 13 14 15 private DataSet getDataSet(String doc) { 16 InputStream is = new ByteArrayInputStream(doc.getBytes(StandardCharsets.UTF_8)) 17 DataSet ds = new OsmReader().parseDataSet(is, null) 18 is.close() 19 return ds 20 } 21 14 22 /** 15 23 * A new node with a changeset id. Ignore it. … … 19 27 String doc = """\ 20 28 <osm version="0.6"> 21 <node id="-1" lat="0.0" lon="0.0" changeset="1" />22 </osm>23 """24 25 OsmReader reader = new OsmReader() 26 DataSet ds = reader.parseDataSet(new StringBufferInputStream(doc), null) 27 Node n = ds.getPrimitiveById(-1, OsmPrimitiveType.NODE)28 assert n != null 29 assert n .uniqueId == -130 assert n.changesetId == 0 31 } 32 29 <node id="-1" lat="0.0" lon="0.0" changeset="1"> 30 <tag k="external-id" v="-1"/> 31 </node> 32 </osm> 33 """ 34 35 DataSet ds = getDataSet(doc) 36 Node n = ds.nodes.find {it.get("external-id") == "-1"} 37 assert n != null 38 assert n.changesetId == 0 39 } 40 33 41 /** 34 42 * A new node with an invalid changeset id. Ignore it. … … 43 51 </osm> 44 52 """ 45 46 OsmReader reader = new OsmReader() 47 DataSet ds = reader.parseDataSet(new StringBufferInputStream(doc), null) 48 Node n = ds.nodes.find {it.get("external-id") == "-1"} 49 assert n != null 50 assert n.changesetId == 0 51 } 52 53 54 DataSet ds = getDataSet(doc) 55 Node n = ds.nodes.find {it.get("external-id") == "-1"} 56 assert n != null 57 assert n.changesetId == 0 58 } 59 53 60 /** 54 61 * A new node with an invalid changeset id. Ignore it. … … 63 70 </osm> 64 71 """ 65 66 OsmReader reader = new OsmReader() 67 DataSet ds = reader.parseDataSet(new StringBufferInputStream(doc), null) 68 Node n = ds.nodes.find {it.get("external-id") == "-1"} 69 assert n != null 70 assert n.changesetId == 0 71 } 72 72 73 DataSet ds = getDataSet(doc) 74 Node n = ds.nodes.find {it.get("external-id") == "-1"} 75 assert n != null 76 assert n.changesetId == 0 77 } 78 73 79 /** 74 80 * A new node with an invalid changeset id. Ignore it. … … 83 89 </osm> 84 90 """ 85 86 OsmReader reader = new OsmReader() 87 DataSet ds = reader.parseDataSet(new StringBufferInputStream(doc), null) 88 Node n = ds.nodes.find {it.get("external-id") == "-1"} 89 assert n != null 90 assert n.changesetId == 0 91 } 92 91 92 DataSet ds = getDataSet(doc) 93 Node n = ds.nodes.find {it.get("external-id") == "-1"} 94 assert n != null 95 assert n.changesetId == 0 96 } 97 93 98 /** 94 99 * A new node with a missing changeset id. That's fine. The changeset id … … 104 109 </osm> 105 110 """ 106 107 OsmReader reader = new OsmReader() 108 DataSet ds = reader.parseDataSet(new StringBufferInputStream(doc), null) 109 Node n = ds.nodes.find {it.get("external-id") == "-1"} 110 assert n != null 111 assert n.changesetId == 0 112 } 113 114 111 112 DataSet ds = getDataSet(doc) 113 Node n = ds.nodes.find {it.get("external-id") == "-1"} 114 assert n != null 115 assert n.changesetId == 0 116 } 117 118 115 119 /** 116 120 * An existing node with a missing changeset id. That's fine. The changeset id … … 124 128 </osm> 125 129 """ 126 127 OsmReader reader = new OsmReader() 128 DataSet ds = reader.parseDataSet(new StringBufferInputStream(doc), null) 130 131 DataSet ds = getDataSet(doc) 129 132 Node n = ds.getPrimitiveById(1, OsmPrimitiveType.NODE) 130 133 assert n != null … … 132 135 assert n.changesetId == 0 133 136 } 134 137 135 138 /** 136 139 * An existing node with a valid changeset id id. That's fine. The changeset id … … 144 147 </osm> 145 148 """ 146 147 OsmReader reader = new OsmReader() 148 DataSet ds = reader.parseDataSet(new StringBufferInputStream(doc), null) 149 150 DataSet ds = getDataSet(doc) 149 151 Node n = ds.getPrimitiveById(1, OsmPrimitiveType.NODE) 150 152 assert n != null … … 152 154 assert n.changesetId == 4 153 155 } 154 156 155 157 /** 156 158 * An existing node with an invalid changeset id. That's a problem. An exception … … 164 166 </osm> 165 167 """ 166 168 167 169 final shouldFail = new GroovyTestCase().&shouldFail 168 169 OsmReader reader = new OsmReader() 170 170 171 shouldFail(IllegalDataException) { 171 reader.parseDataSet(new StringBufferInputStream(doc), null)172 DataSet ds = getDataSet(doc) 172 173 } 173 } 174 } 174 175 /** 175 176 * An existing node with an invalid changeset id. That's a problem. An exception … … 183 184 </osm> 184 185 """ 185 186 186 187 final shouldFail = new GroovyTestCase().&shouldFail 187 188 OsmReader reader = new OsmReader() 188 189 189 shouldFail(IllegalDataException) { 190 reader.parseDataSet(new StringBufferInputStream(doc), null)190 DataSet ds = getDataSet(doc) 191 191 } 192 } 192 } 193 193 /** 194 194 * An existing node with an invalid changeset id. That's a problem. An exception … … 202 202 </osm> 203 203 """ 204 204 205 205 final shouldFail = new GroovyTestCase().&shouldFail 206 207 OsmReader reader = new OsmReader() 206 208 207 shouldFail(IllegalDataException) { 209 reader.parseDataSet(new StringBufferInputStream(doc), null)208 DataSet ds = getDataSet(doc) 210 209 } 211 } 210 } 212 211 } -
trunk/test/unit/org/openstreetmap/josm/io/remotecontrol/RemoteControlTest.java
r7040 r7081 26 26 import org.junit.Before; 27 27 import org.junit.Test; 28 import org.openstreetmap.josm.JOSMFixture; 28 29 import org.openstreetmap.josm.Main; 29 30 import org.openstreetmap.josm.tools.Utils; … … 36 37 private String httpBase; 37 38 private String httpsBase; 38 39 39 40 /** 40 41 * Starts Remote control before testing requests. … … 42 43 @Before 43 44 public void setUp() { 44 Main.initApplicationPreferences();45 JOSMFixture.createUnitTestFixture().init(); 45 46 RemoteControl.start(); 46 47 disableCertificateValidation(); … … 48 49 httpsBase = "https://127.0.0.1:"+Main.pref.getInteger("remote.control.https.port", 8112); 49 50 } 50 51 51 52 /** 52 * Disable all HTTPS validation mechanisms as described 53 * Disable all HTTPS validation mechanisms as described 53 54 * <a href="http://stackoverflow.com/a/2893932/2257172">here</a> and 54 55 * <a href="http://stackoverflow.com/a/19542614/2257172">here</a> … … 56 57 public void disableCertificateValidation() { 57 58 // Create a trust manager that does not validate certificate chains 58 TrustManager[] trustAllCerts = new TrustManager[] { 59 TrustManager[] trustAllCerts = new TrustManager[] { 59 60 new X509TrustManager() { 60 61 public X509Certificate[] getAcceptedIssuers() { … … 76 77 fail(e.getMessage()); 77 78 } 78 79 79 80 // Create all-trusting host name verifier 80 81 HostnameVerifier allHostsValid = new HostnameVerifier() { … … 100 101 * Tests that sending an HTTP request without command results in HTTP 400, with all available commands in error message. 101 102 * @throws IOException if an I/O error occurs 102 * @throws MalformedURLException if HTTP URL is invalid 103 * @throws MalformedURLException if HTTP URL is invalid 103 104 */ 104 105 @Test … … 110 111 * Tests that sending an HTTPS request without command results in HTTP 400, with all available commands in error message. 111 112 * @throws IOException if an I/O error occurs 112 * @throws MalformedURLException if HTTPS URL is invalid 113 * @throws MalformedURLException if HTTPS URL is invalid 113 114 */ 114 115 @Test … … 122 123 assertEquals(connection.getResponseCode(), HttpURLConnection.HTTP_BAD_REQUEST); 123 124 try (InputStream is = connection.getErrorStream()) { 124 // TODO this code should be refactored somewhere in Utils as it is used in several JOSM classes 125 // TODO this code should be refactored somewhere in Utils as it is used in several JOSM classes 125 126 StringBuilder responseBody = new StringBuilder(); 126 127 try (BufferedReader in = new BufferedReader(new InputStreamReader(is, Utils.UTF_8))) { -
trunk/test/unit/org/openstreetmap/josm/io/session/SessionWriterTest.java
r7075 r7081 11 11 import org.junit.BeforeClass; 12 12 import org.junit.Test; 13 import org.openstreetmap.josm.JOSMFixture; 13 14 import org.openstreetmap.josm.Main; 14 15 import org.openstreetmap.josm.data.gpx.GpxData; … … 74 75 @BeforeClass 75 76 public static void setUpBeforeClass() { 76 Main.initApplicationPreferences(); 77 Main.determinePlatformHook(); 77 JOSMFixture.createUnitTestFixture().init(); 78 78 ProjectionPreference.setProjection(); 79 79 Main.toolbar = new ToolbarPreferences(); -
trunk/test/unit/org/openstreetmap/josm/tools/BugReportExceptionHandlerTest.java
r7060 r7081 13 13 import org.junit.Before; 14 14 import org.junit.Test; 15 import org.openstreetmap.josm.JOSMFixture; 15 16 import org.openstreetmap.josm.Main; 16 17 import org.openstreetmap.josm.actions.ShowStatusReportAction; … … 27 28 public void setUp() { 28 29 Main.commandLineArgs = new String[0]; 29 Main.determinePlatformHook(); 30 Main.initApplicationPreferences(); 30 JOSMFixture.createUnitTestFixture().init(); 31 31 } 32 32 33 33 /** 34 34 * Test method for {@link org.openstreetmap.josm.tools.BugReportExceptionHandler#getBugReportUrl(java.lang.String)}. 35 * @throws IOException 35 * @throws IOException 36 36 */ 37 37 @Test … … 41 41 String prefix = Main.getJOSMWebsite()+"/josmticket?gdata="; 42 42 assertTrue(url.startsWith(prefix)); 43 43 44 44 String gdata = url.substring(prefix.length()); 45 45 // JAXB only provides support for "base64" decoding while we encode url in "base64url", so switch encoding, only for test purpose -
trunk/test/unit/org/openstreetmap/josm/tools/TextTagParserTest.java
r6881 r7081 9 9 import org.junit.BeforeClass; 10 10 import org.junit.Test; 11 import org.openstreetmap.josm. Main;11 import org.openstreetmap.josm.JOSMFixture; 12 12 13 13 public class TextTagParserTest { … … 18 18 @BeforeClass 19 19 public static void setUp() { 20 Main.initApplicationPreferences();20 JOSMFixture.createUnitTestFixture().init(); 21 21 } 22 22 -
trunk/test/unit/org/openstreetmap/josm/tools/template_engine/TemplateEngineTest.java
r6881 r7081 8 8 import org.junit.BeforeClass; 9 9 import org.junit.Test; 10 import org.openstreetmap.josm. Main;10 import org.openstreetmap.josm.JOSMFixture; 11 11 import org.openstreetmap.josm.actions.search.SearchCompiler; 12 12 import org.openstreetmap.josm.actions.search.SearchCompiler.Match; … … 24 24 @BeforeClass 25 25 public static void setUp() { 26 Main.initApplicationPreferences();26 JOSMFixture.createUnitTestFixture().init(); 27 27 } 28 28
Note:
See TracChangeset
for help on using the changeset viewer.