Changeset 18027 in josm
- Timestamp:
- 2021-07-15T02:59:58+02:00 (3 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/test/unit/org/openstreetmap/josm/data/projection/ProjectionRefTest.java
r17333 r18027 19 19 import java.util.Arrays; 20 20 import java.util.Collection; 21 import java.util.Collections; 21 22 import java.util.HashMap; 22 23 import java.util.HashSet; … … 29 30 import java.util.TreeMap; 30 31 import java.util.TreeSet; 32 import java.util.concurrent.ConcurrentHashMap; 31 33 import java.util.regex.Matcher; 32 34 import java.util.regex.Pattern; 33 35 34 import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;35 36 import org.junit.Assert; 37 import org.junit.jupiter.api.Test; 36 38 import org.junit.jupiter.api.extension.RegisterExtension; 37 import org.junit.jupiter.api.Test;38 39 import org.openstreetmap.josm.data.Bounds; 39 40 import org.openstreetmap.josm.data.coor.EastNorth; … … 43 44 import org.openstreetmap.josm.tools.Pair; 44 45 import org.openstreetmap.josm.tools.PlatformManager; 46 47 import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; 45 48 46 49 /** … … 374 377 @Test 375 378 void testProjections() throws IOException { 376 S tringBuilder fail = new StringBuilder();377 Map<String, Set<String>> failingProjs = new HashMap<>();379 Set<String> failures = Collections.synchronizedSet(new TreeSet<>()); 380 Map<String, Set<String>> failingProjs = new ConcurrentHashMap<>(); 378 381 Set<String> allCodes = new HashSet<>(Projections.getAllProjectionCodes()); 379 382 Collection<RefEntry> refs = readData(); 380 381 for (RefEntry ref : refs) { 383 refs.stream().map(ref -> ref.code).forEach(allCodes::remove); 384 if (!allCodes.isEmpty()) { 385 Assert.fail("no reference data for following projections: "+allCodes); 386 } 387 388 refs.parallelStream().forEach(ref -> { 382 389 String def0 = Projections.getInit(ref.code); 383 390 if (def0 == null) { … … 385 392 } 386 393 if (!ref.def.equals(def0)) { 387 fail .append("definitions for ").append(ref.code).append(" do not match\n");394 failures.add("definitions for ".concat(ref.code).concat(" do not match\n")); 388 395 } else { 389 396 CustomProjection proj = (CustomProjection) Projections.getProjectionByCode(ref.code); … … 405 412 " but got: eastnorth(%s,%s)!%n", 406 413 proj.toString(), proj.toCode(), ll.lat(), ll.lon(), enRef.east(), enRef.north(), en.east(), en.north()); 407 fail .append(errorEN);414 failures.add(errorEN); 408 415 failingProjs.computeIfAbsent(proj.proj.getProj4Id(), x -> new TreeSet<>()).add(ref.code); 409 416 } 410 417 } 411 418 } 412 allCodes.remove(ref.code); 413 } 414 if (!allCodes.isEmpty()) { 415 Assert.fail("no reference data for following projections: "+allCodes); 416 } 417 if (fail.length() > 0) { 418 System.err.println(fail.toString()); 419 }); 420 if (!failures.isEmpty()) { 421 System.err.println(failures.toString()); 419 422 throw new AssertionError("Failing:\n" + 420 423 failingProjs.keySet().size() + " projections: " + failingProjs.keySet() + "\n" +
Note:
See TracChangeset
for help on using the changeset viewer.