Changeset 17619 in josm for trunk/test


Ignore:
Timestamp:
2021-03-21T13:56:21+01:00 (4 years ago)
Author:
simon04
Message:

see #4626 - Extract class MapCSSTagCheckerRule

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/test/unit/org/openstreetmap/josm/data/validation/tests/MapCSSTagCheckerTest.java

    r17275 r17619  
    3737import org.openstreetmap.josm.data.validation.TestError;
    3838import org.openstreetmap.josm.data.validation.tests.MapCSSTagChecker.ParseResult;
    39 import org.openstreetmap.josm.data.validation.tests.MapCSSTagChecker.TagCheck;
    4039import org.openstreetmap.josm.gui.mappaint.Environment;
    4140import org.openstreetmap.josm.gui.mappaint.MapPaintStyles;
     
    7170        final MapCSSTagChecker test = new MapCSSTagChecker();
    7271        Set<String> errors = new HashSet<>();
    73         test.checks.putAll("test", TagCheck.readMapCSS(new StringReader(css), errors::add).parseChecks);
     72        test.checks.putAll("test", MapCSSTagCheckerRule.readMapCSS(new StringReader(css), errors::add).parseChecks);
    7473        assertTrue(errors.isEmpty(), errors::toString);
    7574        return test;
     
    8281    @Test
    8382    void testNaturalMarsh() throws ParseException {
    84         ParseResult result = TagCheck.readMapCSS(new StringReader(
     83        ParseResult result = MapCSSTagCheckerRule.readMapCSS(new StringReader(
    8584                "*[natural=marsh] {\n" +
    8685                "   group: tr(\"deprecated\");\n" +
     
    9089                "   fixAdd: \"wetland=marsh\";\n" +
    9190                "}"));
    92         final List<TagCheck> checks = result.parseChecks;
     91        final List<MapCSSTagCheckerRule> checks = result.parseChecks;
    9392        assertEquals(1, checks.size());
    9493        assertTrue(result.parseErrors.isEmpty());
    95         final TagCheck check = checks.get(0);
     94        final MapCSSTagCheckerRule check = checks.get(0);
    9695        assertNotNull(check);
    9796        assertEquals("{0.key}=null is deprecated", check.getDescription(null));
     
    114113        assertFalse(check.test(n2));
    115114        assertEquals("The key is natural and the value is marsh",
    116                 TagCheck.insertArguments(check.rule.selectors.get(0), "The key is {0.key} and the value is {0.value}", null));
     115                MapCSSTagCheckerRule.insertArguments(check.rule.selectors.get(0), "The key is {0.key} and the value is {0.value}", null));
    117116    }
    118117
     
    124123    void testTicket10913() throws ParseException {
    125124        final OsmPrimitive p = TestUtils.addFakeDataSet(TestUtils.newWay("highway=tertiary construction=yes"));
    126         final TagCheck check = TagCheck.readMapCSS(new StringReader("way {" +
     125        final MapCSSTagCheckerRule check = MapCSSTagCheckerRule.readMapCSS(new StringReader("way {" +
    127126                "throwError: \"error\";" +
    128127                "fixChangeKey: \"highway => construction\";\n" +
     
    172171    @Test
    173172    void testTicket13630() throws ParseException {
    174         ParseResult result = TagCheck.readMapCSS(new StringReader(
     173        ParseResult result = MapCSSTagCheckerRule.readMapCSS(new StringReader(
    175174                "node[crossing=zebra] {fixRemove: \"crossing=zebra\";}"));
    176175        assertTrue(result.parseChecks.isEmpty());
     
    265264    @Test
    266265    void testTicket13762() throws ParseException {
    267         final ParseResult parseResult = TagCheck.readMapCSS(new StringReader("" +
     266        final ParseResult parseResult = MapCSSTagCheckerRule.readMapCSS(new StringReader("" +
    268267                "meta[lang=de] {\n" +
    269268                "    title: \"Deutschlandspezifische Regeln\";" +
     
    302301                "}");
    303302        assertEquals(1, test.checks.size());
    304         TagCheck check = test.checks.get("test").iterator().next();
     303        MapCSSTagCheckerRule check = test.checks.get("test").iterator().next();
    305304        assertEquals(1, check.fixCommands.size());
    306305        assertEquals(2, check.rule.declaration.instructions.size());
Note: See TracChangeset for help on using the changeset viewer.