Changeset 11491 in josm for trunk/test/unit
- Timestamp:
- 2017-01-25T12:57:27+01:00 (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/test/unit/org/openstreetmap/josm/data/validation/tests/MapCSSTagCheckerTest.java
r11084 r11491 7 7 import static org.junit.Assert.assertTrue; 8 8 9 import java.io.InputStream; 9 10 import java.io.StringReader; 10 11 import java.util.Collection; … … 14 15 import java.util.Set; 15 16 17 import org.junit.Ignore; 16 18 import org.junit.Rule; 17 19 import org.junit.Test; 18 20 import org.openstreetmap.josm.Main; 21 import org.openstreetmap.josm.TestUtils; 19 22 import org.openstreetmap.josm.command.ChangePropertyCommand; 20 23 import org.openstreetmap.josm.command.ChangePropertyKeyCommand; … … 30 33 import org.openstreetmap.josm.data.validation.tests.MapCSSTagChecker.TagCheck; 31 34 import org.openstreetmap.josm.gui.mappaint.mapcss.parsergen.ParseException; 35 import org.openstreetmap.josm.io.OsmReader; 32 36 import org.openstreetmap.josm.testutils.JOSMTestRules; 33 37 … … 44 48 @Rule 45 49 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") 46 public JOSMTestRules test = new JOSMTestRules() ;50 public JOSMTestRules test = new JOSMTestRules().projection(); 47 51 48 52 static MapCSSTagChecker buildTagChecker(String css) throws ParseException { … … 58 62 @Test 59 63 public void testNaturalMarsh() throws ParseException { 60 ParseResult result = MapCSSTagChecker.TagCheck.readMapCSS(new StringReader(64 ParseResult result = TagCheck.readMapCSS(new StringReader( 61 65 "*[natural=marsh] {\n" + 62 66 " group: tr(\"deprecated\");\n" + … … 66 70 " fixAdd: \"wetland=marsh\";\n" + 67 71 "}")); 68 final List< MapCSSTagChecker.TagCheck> checks = result.parseChecks;72 final List<TagCheck> checks = result.parseChecks; 69 73 assertEquals(1, checks.size()); 70 74 assertTrue(result.parseErrors.isEmpty()); 71 final MapCSSTagChecker.TagCheck check = checks.get(0);75 final TagCheck check = checks.get(0); 72 76 assertNotNull(check); 73 77 assertEquals("{0.key}=null is deprecated", check.getDescription(null)); … … 87 91 assertFalse(check.test(n2)); 88 92 assertEquals("The key is natural and the value is marsh", 89 MapCSSTagChecker.TagCheck.insertArguments(check.rule.selectors.get(0), "The key is {0.key} and the value is {0.value}", null));93 TagCheck.insertArguments(check.rule.selectors.get(0), "The key is {0.key} and the value is {0.value}", null)); 90 94 } 91 95 … … 145 149 @Test 146 150 public void testTicket13630() throws ParseException { 147 ParseResult result = MapCSSTagChecker.TagCheck.readMapCSS(new StringReader(151 ParseResult result = TagCheck.readMapCSS(new StringReader( 148 152 "node[crossing=zebra] {fixRemove: \"crossing=zebra\";}")); 149 153 assertTrue(result.parseChecks.isEmpty()); … … 151 155 } 152 156 157 /** 158 * Unit test of {@code min-josm-version} processing. 159 * @throws ParseException if a parsing error occurs 160 */ 153 161 @Test 154 162 public void testPreprocessing() throws ParseException { … … 160 168 } 161 169 170 /** 171 * Unit test of {@link MapCSSTagChecker#initialize}. 172 * @throws Exception if an error occurs 173 */ 162 174 @Test 163 175 public void testInit() throws Exception { … … 187 199 assertTrue(parseResult.parseErrors.isEmpty()); 188 200 } 201 202 /** 203 * Non-regression test for <a href="https://josm.openstreetmap.de/ticket/14287">Bug #14287</a>. 204 * @throws Exception if an error occurs 205 */ 206 @Test 207 @Ignore("not fixed yet") 208 public void testTicket14287() throws Exception { 209 final MapCSSTagChecker test = buildTagChecker( 210 "node[amenity=parking] ∈ *[amenity=parking] {" + 211 " throwWarning: tr(\"{0} inside {1}\", \"amenity=parking\", \"amenity=parking\");" + 212 "}"); 213 try (InputStream is = TestUtils.getRegressionDataStream(14287, "example.osm")) { 214 test.visit(OsmReader.parseDataSet(is, null).allPrimitives()); 215 assertEquals(6, test.getErrors().size()); 216 } 217 } 189 218 }
Note:
See TracChangeset
for help on using the changeset viewer.