Changeset 16443 in josm


Ignore:
Timestamp:
2020-05-17T15:57:57+02:00 (3 weeks ago)
Author:
simon04
Message:

see #19053 - fix cleanup3000, add non-regression test

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/data/validation/OsmValidator.java

    r16296 r16443  
    1919import java.util.Enumeration;
    2020import java.util.HashMap;
    21 import java.util.HashSet;
    2221import java.util.Iterator;
    2322import java.util.List;
    2423import java.util.Map;
    2524import java.util.Map.Entry;
    26 import java.util.Set;
    2725import java.util.SortedMap;
    2826import java.util.TreeMap;
     
    322320    private static void cleanup3000() {
    323321        // see #19053
    324         Set<String> toRemove = new HashSet<>();
    325         for (Entry<String, String> entry : ignoredErrors.entrySet()) {
    326             if (entry.getKey().equals("3000_" + entry.getValue()))
    327                 toRemove.add(entry.getValue());
    328         }
    329322        ignoredErrors.entrySet()
    330                 .removeIf(e -> toRemove.contains(e.getValue()) && !e.getKey().equals("3000_" + e.getValue()));
    331 
     323                .removeIf(e -> e.getKey().equals("3000_" + e.getValue()));
    332324    }
    333325
  • trunk/test/unit/org/openstreetmap/josm/data/validation/OsmValidatorTest.java

    r16182 r16443  
    22package org.openstreetmap.josm.data.validation;
    33
     4import static org.junit.Assert.assertEquals;
    45import static org.junit.Assert.assertFalse;
    56import static org.junit.Assert.assertNotEquals;
    67import static org.junit.Assert.assertTrue;
     8
     9import java.util.Collections;
    710
    811import org.junit.Before;
     
    8790
    8891    /**
     92     * Non-regression test for <a href="https://josm.openstreetmap.de/ticket/19053">Bug #19053</a>.
     93     * {@link OsmValidator#cleanupIgnoredErrors()} must not combine primitives.
     94     */
     95    @Test
     96    public void testCleanupIgnoredErrorsTicket19053() {
     97        OsmValidator.addIgnoredError("3000_missing tag", "missing tag");
     98        OsmValidator.cleanupIgnoredErrors();
     99        assertEquals(Collections.emptyMap(), OsmValidator.getIgnoredErrors());
     100    }
     101
     102    /**
    89103     * Test that tests are really removed, and that core tests cannot be removed
    90104     */
Note: See TracChangeset for help on using the changeset viewer.