Ticket #17567: 17567-rephrase.patch

File 17567-rephrase.patch, 3.3 KB (added by GerdP, 7 years ago)
  • src/org/openstreetmap/josm/data/validation/tests/TurnrestrictionTest.java

     
    2828    protected static final int MORE_VIA = 1804;
    2929    protected static final int MORE_FROM = 1805;
    3030    protected static final int MORE_TO = 1806;
    31     protected static final int UNKNOWN_ROLE = 1807;
    32     protected static final int UNKNOWN_TYPE = 1808;
     31    protected static final int UNEXPECTED_ROLE = 1807;
     32    protected static final int UNEXPECTED_TYPE = 1808;
    3333    protected static final int FROM_VIA_NODE = 1809;
    3434    protected static final int TO_VIA_NODE = 1810;
    3535    protected static final int FROM_VIA_WAY = 1811;
     
    114114                    }
    115115                    break;
    116116                default:
    117                     errors.add(TestError.builder(this, Severity.WARNING, UNKNOWN_ROLE)
    118                             .message(tr("Unknown role in restriction"))
     117                    errors.add(TestError.builder(this, Severity.WARNING, UNEXPECTED_ROLE)
     118                            .message(tr("Unexpected role ''{0}'' in restriction", m.getRole()))
    119119                            .primitives(l)
    120120                            .highlight(m.getMember())
    121121                            .build());
     
    122122                }
    123123            } else if (m.isNode()) {
    124124                Node n = m.getNode();
    125                 switch (m.getRole()) {
    126                 case "via":
     125                if ("via".equals(m.getRole())) {
    127126                    if (!via.isEmpty()) {
    128127                        if (via.get(0) instanceof Node) {
    129128                            morevia = true;
     
    133132                    } else {
    134133                        via.add(n);
    135134                    }
    136                     break;
    137                 case "location_hint":
    138                     errors.add(TestError.builder(this, Severity.WARNING, UNKNOWN_ROLE)
    139                             .message(tr("Role ''{0}'' is not in templates", m.getRole()))
     135                } else {
     136                    errors.add(TestError.builder(this, Severity.WARNING, UNEXPECTED_ROLE)
     137                            .message(tr("Unexpected role ''{0}'' in restriction", m.getRole()))
    140138                            .primitives(l)
    141139                            .highlight(m.getMember())
    142140                            .build());
    143                     break;
    144                 default:
    145                     errors.add(TestError.builder(this, Severity.WARNING, UNKNOWN_ROLE)
    146                             .message(tr("Unknown role in restriction"))
    147                             .primitives(l)
    148                             .highlight(m.getMember())
    149                             .build());
    150141                }
    151142            } else {
    152                 errors.add(TestError.builder(this, Severity.WARNING, UNKNOWN_TYPE)
    153                         .message(tr("Unknown member type"))
     143                errors.add(TestError.builder(this, Severity.WARNING, UNEXPECTED_TYPE)
     144                        .message(tr("Unexpected member type in restriction"))
    154145                        .primitives(l)
    155146                        .highlight(m.getMember())
    156147                        .build());