Changeset 10060 in josm for trunk/test/unit


Ignore:
Timestamp:
2016-03-27T19:26:23+02:00 (9 years ago)
Author:
Don-vip
Message:

see #11924 - remove deprecated code, reduce double precision in unit tests to avoid tiny differences with JDK9

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/test/unit/org/openstreetmap/josm/data/projection/ProjectionRegressionTest.java

    r9908 r10060  
    4444
    4545    private static final String PROJECTION_DATA_FILE = "data_nodist/projection/projection-regression-test-data";
    46     private static final String PROJECTION_DATA_FILE_JAVA_9 = "data_nodist/projection/projection-regression-test-data-java9";
    4746
    4847    private static class TestData {
     
    5150        public EastNorth en;
    5251        public LatLon ll2;
    53     }
    54 
    55     private static String getProjectionDataFile() {
    56         return TestUtils.getJavaVersion() >= 9 ? PROJECTION_DATA_FILE_JAVA_9 : PROJECTION_DATA_FILE;
    5752    }
    5853
     
    7166
    7267        List<TestData> prevData = new ArrayList<>();
    73         if (new File(getProjectionDataFile()).exists()) {
     68        if (new File(PROJECTION_DATA_FILE).exists()) {
    7469            prevData = readData();
    7570        }
     
    9388        Random rand = new Random();
    9489        try (BufferedWriter out = new BufferedWriter(new OutputStreamWriter(
    95                 new FileOutputStream(getProjectionDataFile()), StandardCharsets.UTF_8))) {
     90                new FileOutputStream(PROJECTION_DATA_FILE), StandardCharsets.UTF_8))) {
    9691            out.write("# Data for test/unit/org/openstreetmap/josm/data/projection/ProjectionRegressionTest.java\n");
    9792            out.write("# Format: 1. Projection code; 2. lat/lon; 3. lat/lon projected -> east/north; 4. east/north (3.) inverse projected\n");
     
    118113
    119114    private static List<TestData> readData() throws IOException, FileNotFoundException {
    120         try (BufferedReader in = new BufferedReader(new InputStreamReader(new FileInputStream(getProjectionDataFile()),
     115        try (BufferedReader in = new BufferedReader(new InputStreamReader(new FileInputStream(PROJECTION_DATA_FILE),
    121116                StandardCharsets.UTF_8))) {
    122117            List<TestData> result = new ArrayList<>();
     
    136131                next.en = new EastNorth(en.a, en.b);
    137132                next.ll2 = new LatLon(ll2.a, ll2.b);
     133                if (TestUtils.getJavaVersion() >= 9) {
     134                    next.ll = next.ll.getRoundedToOsmPrecision();
     135                    next.en = new EastNorth(LatLon.roundToOsmPrecision(en.a), LatLon.roundToOsmPrecision(en.b));
     136                    next.ll2 = next.ll2.getRoundedToOsmPrecision();
     137                }
    138138
    139139                result.add(next);
Note: See TracChangeset for help on using the changeset viewer.