Ticket #16567: 16567.domainvalidatortestit.patch

File 16567.domainvalidatortestit.patch, 3.2 KB (added by taylor.smock, 6 years ago)

Use Logging.error + Logging.getLastErrorAndWarnings() to show output when JUnit 5 doesn't show system errors. Also use JUnit 5 Assertions instead of JUnit 4 Assert.

  • test/unit/org/openstreetmap/josm/data/validation/routines/DomainValidatorTestIT.java

     
    1616 */
    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;
    2323import java.io.Closeable;
     
    142142                                }
    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                    }
    148148                    ianaTlds.add(asciiTld);
     
    174174            }
    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
     
    349349        boolean ok = true;
    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            }
    355355        }
     
    387387            final String nextEntry = array[i+1];
    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            }
    400400        }