Changeset 18690 in josm for trunk/test/unit/org/openstreetmap/josm/data/projection
- Timestamp:
- 2023-03-13T21:59:27+01:00 (2 years ago)
- Location:
- trunk/test/unit/org/openstreetmap/josm/data/projection
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/test/unit/org/openstreetmap/josm/data/projection/EllipsoidTest.java
r18144 r18690 1 1 // License: GPL. For details, see LICENSE file. 2 2 package org.openstreetmap.josm.data.projection; 3 4 import static org.junit.jupiter.api.Assertions.fail; 3 5 4 6 import java.security.SecureRandom; 5 7 import java.util.Random; 6 8 7 import org.junit.Assert;8 9 import org.junit.jupiter.api.Test; 9 10 import org.openstreetmap.josm.data.coor.LatLon; … … 37 38 String error = String.format("point: %s iterations: %s current: %s errorLat: %s errorLon %s", 38 39 new LatLon(lat, lon), i, ll, Math.abs(lat - ll.lat()), Math.abs(lon - ll.lon())); 39 System.err.println(error); 40 Assert.fail(); 40 fail(error); 41 41 } 42 42 } -
trunk/test/unit/org/openstreetmap/josm/data/projection/ProjectionRefTest.java
r18027 r18690 1 1 // License: GPL. For details, see LICENSE file. 2 2 package org.openstreetmap.josm.data.projection; 3 4 import static org.junit.jupiter.api.Assertions.fail; 3 5 4 6 import java.io.BufferedReader; … … 34 36 import java.util.regex.Pattern; 35 37 36 import org.junit.Assert;37 38 import org.junit.jupiter.api.Test; 38 39 import org.junit.jupiter.api.extension.RegisterExtension; … … 133 134 Matcher m = projPattern.matcher(line); 134 135 if (!m.matches()) { 135 Assert.fail("unable to parse line: " + line);136 fail("unable to parse line: " + line); 136 137 } 137 138 String code = m.group(1); … … 383 384 refs.stream().map(ref -> ref.code).forEach(allCodes::remove); 384 385 if (!allCodes.isEmpty()) { 385 Assert.fail("no reference data for following projections: "+allCodes);386 fail("no reference data for following projections: "+allCodes); 386 387 } 387 388 … … 389 390 String def0 = Projections.getInit(ref.code); 390 391 if (def0 == null) { 391 Assert.fail("unknown code: "+ref.code);392 fail("unknown code: "+ref.code); 392 393 } 393 394 if (!ref.def.equals(def0)) { … … 411 412 " expected: eastnorth(%s,%s),%n" + 412 413 " but got: eastnorth(%s,%s)!%n", 413 proj .toString(), proj.toCode(), ll.lat(), ll.lon(), enRef.east(), enRef.north(), en.east(), en.north());414 proj, proj.toCode(), ll.lat(), ll.lon(), enRef.east(), enRef.north(), en.east(), en.north()); 414 415 failures.add(errorEN); 415 416 failingProjs.computeIfAbsent(proj.proj.getProj4Id(), x -> new TreeSet<>()).add(ref.code); … … 419 420 }); 420 421 if (!failures.isEmpty()) { 421 System.err.println(failures .toString());422 System.err.println(failures); 422 423 throw new AssertionError("Failing:\n" + 423 424 failingProjs.keySet().size() + " projections: " + failingProjs.keySet() + "\n" + -
trunk/test/unit/org/openstreetmap/josm/data/projection/ProjectionRegressionTest.java
r18100 r18690 161 161 for (String code : Projections.getAllProjectionCodes()) { 162 162 if (!dataCodes.contains(code)) { 163 fail.append("Did not find projection " +code+" in test data!\n");163 fail.append("Did not find projection ").append(code).append(" in test data!\n"); 164 164 } 165 165 } … … 169 169 Projection proj = Projections.getProjectionByCode(data.code); 170 170 if (proj == null) { 171 fail.append("Projection " +data.code+" from test data was not found!\n");171 fail.append("Projection ").append(data.code).append(" from test data was not found!\n"); 172 172 continue; 173 173 } … … 178 178 " expected: eastnorth(%s,%s),%n" + 179 179 " but got: eastnorth(%s,%s)!%n", 180 proj .toString(), data.code, data.ll.lat(), data.ll.lon(), data.en.east(), data.en.north(), en.east(), en.north());180 proj, data.code, data.ll.lat(), data.ll.lon(), data.en.east(), data.en.north(), en.east(), en.north()); 181 181 fail.append(error); 182 182 } … … 185 185 " expected: latlon(%s,%s),%n" + 186 186 " but got: latlon(%s,%s)!%n", 187 proj .toString(), data.code, data.en.east(), data.en.north(), data.ll2.lat(), data.ll2.lon(), ll2.lat(), ll2.lon());187 proj, data.code, data.en.east(), data.en.north(), data.ll2.lat(), data.ll2.lon(), ll2.lat(), ll2.lon()); 188 188 fail.append(error); 189 189 } … … 191 191 192 192 if (fail.length() > 0) { 193 System.err.println(fail .toString());193 System.err.println(fail); 194 194 throw new AssertionError(fail.toString()); 195 195 } -
trunk/test/unit/org/openstreetmap/josm/data/projection/ProjectionTest.java
r18494 r18690 3 3 4 4 import static org.junit.jupiter.api.Assertions.assertTrue; 5 import static org.junit.jupiter.api.Assertions.fail; 5 6 6 7 import java.security.SecureRandom; … … 10 11 import java.util.Random; 11 12 12 import org.junit.Assert;13 13 import org.junit.jupiter.api.Test; 14 14 import org.openstreetmap.josm.data.Bounds; … … 40 40 41 41 for (int i = 0; i <= 3; ++i) { 42 testProjection(Projections.getProjectionByCode("EPSG:"+ Integer.toString(27561+i))); // Lambert 4 Zones France42 testProjection(Projections.getProjectionByCode("EPSG:"+ (27561 + i))); // Lambert 4 Zones France 43 43 } 44 44 45 45 for (int i = 0; i <= 4; ++i) { 46 testProjection(Projections.getProjectionByCode("EPSG:"+ Integer.toString(2176+i))); // PUWG Poland46 testProjection(Projections.getProjectionByCode("EPSG:"+ (2176 + i))); // PUWG Poland 47 47 } 48 48 … … 50 50 51 51 for (int i = 0; i <= 60; ++i) { 52 testProjection(Projections.getProjectionByCode("EPSG:"+ Integer.toString(32601+i))); // UTM North53 testProjection(Projections.getProjectionByCode("EPSG:"+ Integer.toString(32701+i))); // UTM South52 testProjection(Projections.getProjectionByCode("EPSG:"+ (32601 + i))); // UTM North 53 testProjection(Projections.getProjectionByCode("EPSG:"+ (32701 + i))); // UTM South 54 54 } 55 55 … … 59 59 60 60 for (int i = 0; i <= 8; ++i) { 61 testProjection(Projections.getProjectionByCode("EPSG:"+ Integer.toString(3942+i))); // Lambert CC9 Zones France61 testProjection(Projections.getProjectionByCode("EPSG:"+ (3942 + i))); // Lambert CC9 Zones France 62 62 } 63 63 64 64 for (int i = 0; i <= 17; ++i) { 65 testProjection(Projections.getProjectionByCode("EPSG:"+ Integer.toString(102421+i))); // WGS_1984_ARC_System Zones65 testProjection(Projections.getProjectionByCode("EPSG:"+ (102421 + i))); // WGS_1984_ARC_System Zones 66 66 } 67 67 … … 70 70 71 71 if (error) { 72 System.err.println(text); 73 Assert.fail(); 72 fail(text); 74 73 } 75 74 } … … 80 79 Bounds b = p.getWorldBoundsLatLon(); 81 80 82 text += String.format("*** %s %s%n", p .toString(), p.toCode());81 text += String.format("*** %s %s%n", p, p.toCode()); 83 82 for (int num = 0; num < 1000; ++num) { 84 83 … … 148 147 149 148 if (error2) { 150 System.err.println(text2); 151 Assert.fail(); 149 fail(text2); 152 150 } 153 151 assertTrue(projIds.isEmpty(), "missing test: "+projIds); -
trunk/test/unit/org/openstreetmap/josm/data/projection/ProjectionsTest.java
r18030 r18690 2 2 package org.openstreetmap.josm.data.projection; 3 3 4 import static org.junit. Assert.assertNull;4 import static org.junit.jupiter.api.Assertions.assertNull; 5 5 6 6 import org.junit.jupiter.api.Test;
Note:
See TracChangeset
for help on using the changeset viewer.