Changeset 16298 in josm for trunk/test/unit/org
- Timestamp:
- 2020-04-14T08:21:37+02:00 (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/test/unit/org/openstreetmap/josm/data/validation/tests/ConnectivityRelationsTest.java
r16295 r16298 86 86 } 87 87 88 /**89 * Check for bad roles (not from/via/to)90 */91 @Test92 public void testForBadRole() {93 Relation relation = createDefaultTestRelation();94 check.visit(relation);95 int expectedFailures = 0;96 97 Assert.assertEquals(expectedFailures, check.getErrors().size());98 99 for (int i = 0; i < relation.getMembers().size(); i++) {100 String tRole = replaceMember(relation, i, "badRole");101 check.visit(relation);102 Assert.assertEquals(++expectedFailures, check.getErrors().size());103 replaceMember(relation, i, tRole);104 check.visit(relation);105 Assert.assertEquals(expectedFailures, check.getErrors().size());106 }107 }108 109 private String replaceMember(Relation relation, int index, String replacementRole) {110 RelationMember relationMember = relation.getMember(index);111 String currentRole = relationMember.getRole();112 relation.removeMember(index);113 relation.addMember(index, new RelationMember(replacementRole, relationMember.getMember()));114 return currentRole;115 }116 88 }
Note:
See TracChangeset
for help on using the changeset viewer.