Ignore:
Timestamp:
2018-11-30T09:45:11+01:00 (5 years ago)
Author:
GerdP
Message:

fix #16978 Use distinct code number for each test group in CrossingWays and UnconnectedWays

File:
1 edited

Legend:

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

    r14305 r14468  
    4646 */
    4747public abstract class UnconnectedWays extends Test {
     48    private final int code;
    4849
    4950    /**
     
    5152     */
    5253    public static class UnconnectedHighways extends UnconnectedWays {
     54        static final int UNCONNECTED_HIGHWAYS = 1311;
    5355
    5456        /**
     
    5658         */
    5759        public UnconnectedHighways() {
    58             super(tr("Unconnected highways"));
     60            super(tr("Unconnected highways"), UNCONNECTED_HIGHWAYS);
    5961        }
    6062
     
    6971     */
    7072    public static class UnconnectedRailways extends UnconnectedWays {
    71 
     73        static final int UNCONNECTED_RAILWAYS = 1321;
    7274        /**
    7375         * Constructs a new {@code UnconnectedRailways} test.
    7476         */
    7577        public UnconnectedRailways() {
    76             super(tr("Unconnected railways"));
     78            super(tr("Unconnected railways"), UNCONNECTED_RAILWAYS);
    7779        }
    7880
     
    8789     */
    8890    public static class UnconnectedWaterways extends UnconnectedWays {
    89 
     91        static final int UNCONNECTED_WATERWAYS = 1331;
    9092        /**
    9193         * Constructs a new {@code UnconnectedWaterways} test.
    9294         */
    9395        public UnconnectedWaterways() {
    94             super(tr("Unconnected waterways"));
     96            super(tr("Unconnected waterways"), UNCONNECTED_WATERWAYS);
    9597        }
    9698
     
    105107     */
    106108    public static class UnconnectedNaturalOrLanduse extends UnconnectedWays {
    107 
     109        static final int UNCONNECTED_NATURAL_OR_LANDUSE = 1341;
    108110        /**
    109111         * Constructs a new {@code UnconnectedNaturalOrLanduse} test.
    110112         */
    111113        public UnconnectedNaturalOrLanduse() {
    112             super(tr("Unconnected natural lands and landuses"));
     114            super(tr("Unconnected natural lands and landuses"), UNCONNECTED_NATURAL_OR_LANDUSE);
    113115        }
    114116
     
    123125     */
    124126    public static class UnconnectedPower extends UnconnectedWays {
    125 
     127        static final int UNCONNECTED_POWER = 1351;
    126128        /**
    127129         * Constructs a new {@code UnconnectedPower} test.
    128130         */
    129131        public UnconnectedPower() {
    130             super(tr("Unconnected power ways"));
     132            super(tr("Unconnected power ways"), UNCONNECTED_POWER);
    131133        }
    132134
     
    156158     */
    157159    public UnconnectedWays(String title) {
     160        this(title, UNCONNECTED_WAYS);
     161
     162    }
     163
     164    /**
     165     * Constructs a new {@code UnconnectedWays} test with the given code.
     166     * @param title The test title
     167     * @param code The test code
     168     * @since 14468
     169     */
     170    public UnconnectedWays(String title, int code) {
    158171        super(title, tr("This test checks if a way has an endpoint very near to another way."));
     172        this.code = code;
    159173    }
    160174
     
    268282    protected final void addErrors(Severity severity, Map<Node, Way> errorMap, String message) {
    269283        for (Map.Entry<Node, Way> error : errorMap.entrySet()) {
    270             errors.add(TestError.builder(this, severity, UNCONNECTED_WAYS)
     284            errors.add(TestError.builder(this, severity, code)
    271285                    .message(message)
    272286                    .primitives(error.getKey(), error.getValue())
Note: See TracChangeset for help on using the changeset viewer.