Changeset 9023 in josm for trunk/test/unit/org/openstreetmap


Ignore:
Timestamp:
2015-11-19T00:33:55+01:00 (9 years ago)
Author:
Don-vip
Message:

see #12102 - cleanup TagChecker

  • code refactor/cleanup/simplification
  • clean list of ignored tags by removing tags that have been added to internal presets during past years
  • add unit test to detect these tags if we add new tags to internal presets that are currently being ignored
File:
1 edited

Legend:

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

    r8863 r9023  
    33
    44import static org.junit.Assert.assertEquals;
     5import static org.junit.Assert.assertTrue;
    56
    67import java.io.IOException;
     8import java.util.ArrayList;
    79import java.util.List;
    810
     
    1214import org.openstreetmap.josm.data.osm.OsmPrimitive;
    1315import org.openstreetmap.josm.data.osm.OsmUtils;
     16import org.openstreetmap.josm.data.osm.Tag;
    1417import org.openstreetmap.josm.data.validation.TestError;
    1518import org.openstreetmap.josm.gui.tagging.presets.TaggingPresets;
     
    6871        assertEquals("Value 'forrest' for key 'landuse' not in presets.", errors.get(0).getDescription());
    6972    }
     73
     74    /**
     75     * Checks that tags specifically ignored are effectively not in internal presets.
     76     * @throws IOException if any I/O error occurs
     77     */
     78    @Test
     79    public void testIgnoredTagsNotInPresets() throws IOException {
     80        List<String> errors = new ArrayList<>();
     81        new TagChecker().initialize();
     82        for (Tag tag : TagChecker.getIgnoredTags()) {
     83            if (TagChecker.isTagInPresets(tag.getKey(), tag.getValue())) {
     84                errors.add(tag.toString());
     85            }
     86        }
     87        assertTrue(errors.toString(), errors.isEmpty());
     88    }
    7089}
Note: See TracChangeset for help on using the changeset viewer.