Changeset 16765 in josm for trunk/test/unit/org


Ignore:
Timestamp:
2020-07-14T19:50:13+02:00 (4 years ago)
Author:
simon04
Message:

see #16567 - Fix DomainValidatorTestIT for JUnit 5 (patch by taylor.smock)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/test/unit/org/openstreetmap/josm/data/validation/routines/DomainValidatorTestIT.java

    r14235 r16765  
    1717package org.openstreetmap.josm.data.validation.routines;
    1818
    19 import static org.junit.Assert.assertTrue;
    20 import static org.junit.Assert.fail;
     19import static org.junit.jupiter.api.Assertions.assertTrue;
     20import static org.junit.jupiter.api.Assertions.fail;
    2121
    2222import java.io.BufferedReader;
     
    143143                            }
    144144                        } else {
    145                             System.err.println("Expected to find HTML info for "+ asciiTld);
     145                            Logging.error("Expected to find HTML info for "+ asciiTld);
    146146                        }
    147147                    }
     
    159159                if (!ianaTlds.contains(key)) {
    160160                    if (isNotInRootZone(key)) {
    161                         System.out.println("INFO: HTML entry not yet in root zone: "+key);
     161                        Logging.info("HTML entry not yet in root zone: "+key);
    162162                    } else {
    163                         System.err.println("WARN: Expected to find text entry for html: "+key);
     163                        Logging.warn("Expected to find text entry for html: "+key);
    164164                    }
    165165                }
     
    175175        }
    176176        // Check if internal tables contain any additional entries
    177         assertTrue(isInIanaList("INFRASTRUCTURE_TLDS", ianaTlds));
    178         assertTrue(isInIanaList("COUNTRY_CODE_TLDS", ianaTlds));
    179         assertTrue(isInIanaList("GENERIC_TLDS", ianaTlds));
     177        assertTrue(isInIanaList("INFRASTRUCTURE_TLDS", ianaTlds), String.join(System.lineSeparator(), Logging.getLastErrorAndWarnings()));
     178        assertTrue(isInIanaList("COUNTRY_CODE_TLDS", ianaTlds), String.join(System.lineSeparator(), Logging.getLastErrorAndWarnings()));
     179        assertTrue(isInIanaList("GENERIC_TLDS", ianaTlds), String.join(System.lineSeparator(), Logging.getLastErrorAndWarnings()));
    180180        // Don't check local TLDS assertTrue(isInIanaList("LOCAL_TLDS", ianaTlds));
    181181    }
    182182
    183183    private static void printMap(final String header, Map<String, String> map, String string) {
    184         System.out.println("Entries missing from "+ string +" List\n");
     184        Logging.warn("Entries missing from "+ string +" List\n");
    185185        if (header != null) {
    186             System.out.println("        // Taken from " + header);
     186            Logging.warn("        // Taken from " + header);
    187187        }
    188188        Iterator<Map.Entry<String, String>> it = map.entrySet().iterator();
    189189        while (it.hasNext()) {
    190190            Map.Entry<String, String> me = it.next();
    191             System.out.println("        \"" + me.getKey() + "\", // " + me.getValue());
    192         }
    193         System.out.println("\nDone");
     191            Logging.warn("        \"" + me.getKey() + "\", // " + me.getValue());
     192        }
     193        Logging.warn(System.lineSeparator() + "Done");
    194194    }
    195195
     
    237237                        }
    238238                    } else {
    239                         System.err.println("Unexpected type: " + line);
     239                        Logging.error("Unexpected type: " + line);
    240240                    }
    241241                }
     
    257257            modTime = f.lastModified();
    258258            if (modTime > System.currentTimeMillis()-HOUR) {
    259                 System.out.println("Skipping download - found recent " + f);
     259                Logging.debug("Skipping download - found recent " + f);
    260260                return modTime;
    261261            }
     
    268268            String since = sdf.format(new Date(modTime));
    269269            hc.addRequestProperty("If-Modified-Since", since);
    270             System.out.println("Found " + f + " with date " + since);
     270            Logging.debug("Found " + f + " with date " + since);
    271271        }
    272272        if (hc.getResponseCode() == 304) {
    273             System.out.println("Already have most recent " + tldurl);
     273            Logging.debug("Already have most recent " + tldurl);
    274274        } else {
    275             System.out.println("Downloading " + tldurl);
     275            Logging.debug("Downloading " + tldurl);
    276276            byte[] buff = new byte[1024];
    277277            try (InputStream is = hc.getInputStream();
     
    282282                }
    283283            }
    284             System.out.println("Done");
     284            Logging.debug("Done");
    285285        }
    286286        return f.lastModified();
     
    350350        for (int i = 0; i < array.length; i++) {
    351351            if (!ianaTlds.contains(array[i])) {
    352                 System.out.println(name + " contains unexpected value: " + array[i]);
     352                Logging.error(name + " contains unexpected value: " + array[i]);
    353353                ok = false;
    354354            }
     
    388388            final int cmp = entry.compareTo(nextEntry);
    389389            if (cmp > 0) { // out of order
    390                 System.out.println("Out of order entry: " + entry + " < " + nextEntry + " in " + name);
     390                Logging.error("Out of order entry: " + entry + " < " + nextEntry + " in " + name);
    391391                sorted = false;
    392392            } else if (cmp == 0) {
    393393                strictlySorted = false;
    394                 System.out.println("Duplicated entry: " + entry + " in " + name);
     394                Logging.error("Duplicated entry: " + entry + " in " + name);
    395395            }
    396396            if (!isLowerCase(entry)) {
    397                 System.out.println("Non lowerCase entry: " + entry + " in " + name);
     397                Logging.error("Non lowerCase entry: " + entry + " in " + name);
    398398                lowerCase = false;
    399399            }
Note: See TracChangeset for help on using the changeset viewer.