Changeset 9382 in josm for trunk/test/unit


Ignore:
Timestamp:
2016-01-10T10:49:51+01:00 (9 years ago)
Author:
simon04
Message:

fix #12329 - Tag checker: Losing valid values when auto-fixing in some tests

File:
1 edited

Legend:

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

    r9231 r9382  
    4545     */
    4646    @Test
    47     public void testInvalidKey() throws IOException {
     47    public void testMisspelledKey1() throws IOException {
    4848        final List<TestError> errors = test(OsmUtils.createPrimitive("node Name=Main"));
    4949        assertEquals(1, errors.size());
    5050        assertEquals("Misspelled property key", errors.get(0).getMessage());
    5151        assertEquals("Key 'Name' looks like 'name'.", errors.get(0).getDescription());
     52        assertEquals(true, errors.get(0).isFixable());
    5253    }
    5354
     
    5758     */
    5859    @Test
    59     public void testMisspelledKey() throws IOException {
     60    public void testMisspelledKey2() throws IOException {
    6061        final List<TestError> errors = test(OsmUtils.createPrimitive("node landuse;=forest"));
    6162        assertEquals(1, errors.size());
    6263        assertEquals("Misspelled property key", errors.get(0).getMessage());
    6364        assertEquals("Key 'landuse;' looks like 'landuse'.", errors.get(0).getDescription());
     65        assertEquals(true, errors.get(0).isFixable());
     66    }
     67
     68    /**
     69     * Check for mispelled key where the suggested alternative is in use. The error should not be fixable.
     70     * @throws IOException if any I/O error occurs
     71     */
     72    @Test
     73    public void testMisspelledKeyButAlternativeInUse() throws IOException {
     74        // ticket 12329
     75        final List<TestError> errors = test(OsmUtils.createPrimitive("node amenity=fuel brand=bah Brand=foo"));
     76        assertEquals(1, errors.size());
     77        assertEquals("Misspelled property key", errors.get(0).getMessage());
     78        assertEquals("Key 'Brand' looks like 'brand'.", errors.get(0).getDescription());
     79        assertEquals(false, errors.get(0).isFixable());
    6480    }
    6581
Note: See TracChangeset for help on using the changeset viewer.