Changeset 6881 in josm for trunk/test/unit/org/openstreetmap/josm/data
- Timestamp:
- 2014-02-24T17:49:12+01:00 (12 years ago)
- Location:
- trunk/test/unit/org/openstreetmap/josm/data
- Files:
-
- 17 edited
-
osm/APIDataSetTest.java (modified) (1 diff)
-
osm/DataSetMergerTest.java (modified) (2 diffs)
-
osm/FilterTest.java (modified) (2 diffs)
-
osm/OsmPrimitiveKeyHandling.java (modified) (6 diffs)
-
osm/OsmPrimitiveTest.java (modified) (2 diffs)
-
osm/QuadBucketsTest.java (modified) (2 diffs)
-
osm/RelationTest.java (modified) (3 diffs)
-
osm/history/HistoryNodeTest.java (modified) (1 diff)
-
osm/visitor/MergeSourceBuildingVisitorTest.java (modified) (2 diffs)
-
projection/EllipsoidTest.java (modified) (1 diff)
-
projection/ProjectionRegressionTest.java (modified) (4 diffs)
-
projection/ProjectionTest.java (modified) (3 diffs)
-
projection/SwissGridTest.java (modified) (1 diff)
-
validation/tests/DuplicateNodeTest.java (modified) (3 diffs)
-
validation/tests/MapCSSTagCheckerTest.java (modified) (1 diff)
-
validation/tests/OpeningHourTestTest.java (modified) (3 diffs)
-
validation/tests/UnconnectedWaysTest.java (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/test/unit/org/openstreetmap/josm/data/osm/APIDataSetTest.java
r6801 r6881 12 12 import org.openstreetmap.josm.actions.upload.CyclicUploadDependencyException; 13 13 import org.openstreetmap.josm.data.APIDataSet; 14 import org.openstreetmap.josm.data.Preferences;15 16 14 17 15 public class APIDataSetTest { -
trunk/test/unit/org/openstreetmap/josm/data/osm/DataSetMergerTest.java
r6471 r6881 18 18 import org.junit.Test; 19 19 import org.openstreetmap.josm.Main; 20 import org.openstreetmap.josm.data.Preferences;21 20 import org.openstreetmap.josm.data.coor.LatLon; 22 21 import org.openstreetmap.josm.data.projection.Projections; 23 22 24 23 public class DataSetMergerTest { 25 /*private static Logger logger = Logger.getLogger(DataSetMergerTest.class.getName());26 27 static Properties testProperties;28 29 @BeforeClass30 static public void init() {31 32 if(System.getProperty("josm.home") == null){33 testProperties = new Properties();34 35 // load properties36 //37 try {38 testProperties.load(DataSetMergerTest.class.getResourceAsStream("/test-unit-env.properties"));39 } catch(Exception e){40 logger.log(Level.SEVERE, MessageFormat.format("failed to load property file ''{0}''", "/test-unit-env.properties"));41 fail(MessageFormat.format("failed to load property file ''{0}''", "/test-unit-env.properties"));42 }43 44 // check josm.home45 //46 String josmHome = testProperties.getProperty("josm.home");47 if (josmHome == null) {48 fail(MessageFormat.format("property ''{0}'' not set in test environment", "josm.home"));49 } else {50 File f = new File(josmHome);51 if (! f.exists() || ! f.canRead()) {52 fail(MessageFormat.format("property ''{0}'' points to ''{1}'' which is either not existing or not readable", "josm.home", josmHome));53 }54 }55 System.setProperty("josm.home", josmHome);56 }57 Main.pref.init(false);58 59 // init projection60 Main.proj = new Mercator();61 }*/62 24 63 25 @BeforeClass … … 69 31 private DataSet their; 70 32 33 /** 34 * Setup test. 35 */ 71 36 @Before 72 37 public void setUp() { -
trunk/test/unit/org/openstreetmap/josm/data/osm/FilterTest.java
r6471 r6881 17 17 import org.openstreetmap.josm.actions.search.SearchAction.SearchMode; 18 18 import org.openstreetmap.josm.actions.search.SearchCompiler.ParseError; 19 import org.openstreetmap.josm.data.Preferences;20 19 import org.openstreetmap.josm.data.coor.LatLon; 21 20 import org.openstreetmap.josm.data.projection.Projections; … … 24 23 import org.openstreetmap.josm.io.OsmReader; 25 24 26 27 25 public class FilterTest { 28 26 27 /** 28 * Setup test. 29 */ 29 30 @BeforeClass 30 31 public static void setUp() { -
trunk/test/unit/org/openstreetmap/josm/data/osm/OsmPrimitiveKeyHandling.java
r6830 r6881 36 36 37 37 /** 38 * Add a tag to an empty node and test the query and get methods. 39 * 38 * Adds a tag to an empty node and test the query and get methods. 40 39 */ 41 40 @Test … … 51 50 52 51 /** 53 * Add two tags to an empty node and test the query and get methods. 52 * Adds two tags to an empty node and test the query and get methods. 54 53 */ 55 54 @Test … … 68 67 69 68 /** 70 * Remove tags from a node with two tags and test the state of the node. 71 * 69 * Removes tags from a node with two tags and test the state of the node. 72 70 */ 73 71 @Test … … 96 94 97 95 /** 98 * Remove all tags from a node 99 * 96 * Removes all tags from a node. 100 97 */ 101 98 @Test … … 132 129 * Test hasEqualSemanticAttributes on two nodes with different tags. 133 130 */ 134 135 131 @Test 136 132 public void hasEqualSemanticAttributes_2() { … … 147 143 assertTrue(!n1.hasEqualSemanticAttributes(n2)); 148 144 } 149 150 145 } -
trunk/test/unit/org/openstreetmap/josm/data/osm/OsmPrimitiveTest.java
r6471 r6881 9 9 import org.junit.Test; 10 10 import org.openstreetmap.josm.Main; 11 import org.openstreetmap.josm.data.Preferences;12 11 import org.openstreetmap.josm.data.coor.LatLon; 13 12 import org.openstreetmap.josm.data.projection.Projections; … … 27 26 private DataSet dataSet = new DataSet(); 28 27 28 /** 29 * Setup test. 30 */ 29 31 @BeforeClass 30 32 public static void setUp() { -
trunk/test/unit/org/openstreetmap/josm/data/osm/QuadBucketsTest.java
r6471 r6881 14 14 import org.junit.Test; 15 15 import org.openstreetmap.josm.Main; 16 import org.openstreetmap.josm.data.Preferences;17 16 import org.openstreetmap.josm.data.coor.LatLon; 18 17 import org.openstreetmap.josm.data.projection.Projections; … … 82 81 removeAllTest(ds); 83 82 } 84 85 83 } -
trunk/test/unit/org/openstreetmap/josm/data/osm/RelationTest.java
r6471 r6881 8 8 import org.junit.Test; 9 9 import org.openstreetmap.josm.Main; 10 import org.openstreetmap.josm.data.Preferences;11 10 import org.openstreetmap.josm.data.coor.LatLon; 12 11 import org.openstreetmap.josm.data.projection.Projections; … … 14 13 public class RelationTest { 15 14 15 /** 16 * Setup test. 17 */ 16 18 @BeforeClass 17 19 public static void setUp() { … … 104 106 Assert.assertEquals(new BBox(w1), r1.getBBox()); 105 107 } 106 107 108 } -
trunk/test/unit/org/openstreetmap/josm/data/osm/history/HistoryNodeTest.java
r4603 r6881 1 1 // License: GPL. For details, see LICENSE file. 2 2 package org.openstreetmap.josm.data.osm.history; 3 4 3 5 4 import static org.junit.Assert.assertEquals; -
trunk/test/unit/org/openstreetmap/josm/data/osm/visitor/MergeSourceBuildingVisitorTest.java
r6471 r6881 12 12 import org.junit.Test; 13 13 import org.openstreetmap.josm.Main; 14 import org.openstreetmap.josm.data.Preferences;15 14 import org.openstreetmap.josm.data.coor.LatLon; 16 15 import org.openstreetmap.josm.data.osm.DataSet; … … 35 34 } 36 35 36 /** 37 * Setup test. 38 */ 37 39 @BeforeClass 38 40 public static void setUp() { -
trunk/test/unit/org/openstreetmap/josm/data/projection/EllipsoidTest.java
r6334 r6881 41 41 maxErrLon = Math.max(maxErrLon, Math.abs(lon - ll.lon())); 42 42 } 43 //System.err.println(String.format("maxerror lat: %s maxerror lon: %s", maxErrLat, maxErrLon));44 43 } 45 44 } -
trunk/test/unit/org/openstreetmap/josm/data/projection/ProjectionRegressionTest.java
r6471 r6881 1 1 // License: GPL. For details, see LICENSE file. 2 2 package org.openstreetmap.josm.data.projection; 3 4 3 5 4 import java.io.BufferedReader; … … 25 24 import org.openstreetmap.josm.Main; 26 25 import org.openstreetmap.josm.data.Bounds; 27 import org.openstreetmap.josm.data.Preferences;28 26 import org.openstreetmap.josm.data.coor.EastNorth; 29 27 import org.openstreetmap.josm.data.coor.LatLon; … … 147 145 } 148 146 147 /** 148 * Setup test. 149 */ 149 150 @BeforeClass 150 151 public static void setUp() { … … 198 199 throw new AssertionError(fail.toString()); 199 200 } 200 201 201 } 202 202 } -
trunk/test/unit/org/openstreetmap/josm/data/projection/ProjectionTest.java
r6334 r6881 12 12 public class ProjectionTest { 13 13 14 private static final boolean debug = false;15 14 private static Random rand = new Random(System.currentTimeMillis()); 16 15 … … 64 63 double maxErrLat = 0, maxErrLon = 0; 65 64 Bounds b = p.getWorldBoundsLatLon(); 66 65 67 66 text += String.format("*** %s %s%n", p.toString(), p.toCode()); 68 67 for (int num=0; num < 1000; ++num) { 69 68 70 69 double lat = rand.nextDouble() * (b.getMax().lat() - b.getMin().lat()) + b.getMin().lat(); 71 70 double lon = rand.nextDouble() * (b.getMax().lon() - b.getMin().lon()) + b.getMin().lon(); 72 71 73 72 LatLon ll = new LatLon(lat, lon); 74 73 75 74 for (int i=0; i<10; ++i) { 76 75 EastNorth en = p.latlon2eastNorth(ll); … … 80 79 maxErrLon = Math.max(maxErrLon, Math.abs(lon - ll.lon())); 81 80 } 82 81 83 82 String mark = ""; 84 83 if (maxErrLat + maxErrLon > 1e-5) { -
trunk/test/unit/org/openstreetmap/josm/data/projection/SwissGridTest.java
r6334 r6881 13 13 private boolean debug = false; 14 14 15 /** 16 * Setup test. 17 */ 15 18 @BeforeClass 16 19 public static void setUp() { -
trunk/test/unit/org/openstreetmap/josm/data/validation/tests/DuplicateNodeTest.java
r6471 r6881 7 7 import org.junit.Test; 8 8 import org.openstreetmap.josm.Main; 9 import org.openstreetmap.josm.data.Preferences;10 9 import org.openstreetmap.josm.data.coor.LatLon; 11 10 import org.openstreetmap.josm.data.osm.DataSet; … … 15 14 16 15 /** 17 * JUnit Test of "Duplicate node" validation test. 16 * JUnit Test of "Duplicate node" validation test. 18 17 */ 19 18 public class DuplicateNodeTest { 20 19 21 20 /** 22 * Setup test by initializing JOSM preferences and projection. 21 * Setup test by initializing JOSM preferences and projection. 23 22 */ 24 23 @BeforeClass … … 44 43 test.visit(ds.allPrimitives()); 45 44 test.endTest(); 46 45 47 46 assertEquals(1, test.getErrors().size()); 48 47 } -
trunk/test/unit/org/openstreetmap/josm/data/validation/tests/MapCSSTagCheckerTest.java
r6677 r6881 28 28 public class MapCSSTagCheckerTest { 29 29 30 /** 31 * Setup test. 32 */ 30 33 @Before 31 34 public void setUp() throws Exception { -
trunk/test/unit/org/openstreetmap/josm/data/validation/tests/OpeningHourTestTest.java
r6858 r6881 2 2 package org.openstreetmap.josm.data.validation.tests; 3 3 4 import org.junit.Before; 5 import org.junit.Test; 6 import org.openstreetmap.josm.Main; 7 import org.openstreetmap.josm.data.osm.Tag; 8 import org.openstreetmap.josm.data.validation.Severity; 9 import org.openstreetmap.josm.gui.preferences.map.TaggingPresetPreference; 10 import org.openstreetmap.josm.gui.tagging.TaggingPreset; 11 import org.openstreetmap.josm.gui.tagging.TaggingPresetItem; 12 import org.openstreetmap.josm.gui.tagging.TaggingPresetItems; 13 import org.openstreetmap.josm.gui.tagging.TaggingPresetReader; 14 import org.openstreetmap.josm.gui.tagging.TaggingPresetSearchAction; 4 import static org.CustomMatchers.hasSize; 5 import static org.CustomMatchers.isEmpty; 6 import static org.hamcrest.CoreMatchers.is; 7 import static org.hamcrest.CoreMatchers.not; 8 import static org.junit.Assert.assertThat; 15 9 16 10 import java.util.Arrays; … … 20 14 import java.util.Set; 21 15 22 import static org.CustomMatchers.hasSize; 23 import static org.CustomMatchers.isEmpty; 24 import static org.hamcrest.CoreMatchers.is; 25 import static org.hamcrest.CoreMatchers.not; 26 import static org.junit.Assert.assertThat; 16 import org.junit.Before; 17 import org.junit.Test; 18 import org.openstreetmap.josm.Main; 19 import org.openstreetmap.josm.data.osm.Tag; 20 import org.openstreetmap.josm.data.validation.Severity; 21 import org.openstreetmap.josm.gui.tagging.TaggingPreset; 22 import org.openstreetmap.josm.gui.tagging.TaggingPresetItem; 23 import org.openstreetmap.josm.gui.tagging.TaggingPresetItems; 24 import org.openstreetmap.josm.gui.tagging.TaggingPresetReader; 27 25 28 26 /** 29 * JUnit Test of "Opening hours" validation test. 27 * JUnit Test of "Opening hours" validation test. 30 28 */ 31 29 public class OpeningHourTestTest { … … 33 31 private static final OpeningHourTest OPENING_HOUR_TEST = new OpeningHourTest(); 34 32 33 /** 34 * Setup test. 35 */ 35 36 @Before 36 37 public void setUp() throws Exception { -
trunk/test/unit/org/openstreetmap/josm/data/validation/tests/UnconnectedWaysTest.java
r6603 r6881 19 19 UnconnectedWays bib; 20 20 21 /** 22 * Setup test. 23 */ 21 24 @Before 22 25 public void setUp() throws Exception {
Note:
See TracChangeset
for help on using the changeset viewer.
