< prev index next >

test/langtools/jdk/javadoc/doclet/lib/JavadocTester.java

Print this page
rev 52786 : 8210031: implementation for JVM Constants API


 505      *  to be found, or false if all of the strings are expected to be
 506      *  not found
 507      * @param strings the strings to be searched for
 508      */
 509     public void checkOutput(Output output, boolean expectedFound, String... strings) {
 510         checkOutput(output.toString(), outputMap.get(output), expectedFound, strings);
 511     }
 512 
 513     // NOTE: path may be the name of an Output stream as well as a file path
 514     private void checkOutput(String path, String fileString, boolean expectedFound, String... strings) {
 515         for (String stringToFind : strings) {
 516 //            log.logCheckOutput(path, expectedFound, stringToFind);
 517             checking("checkOutput");
 518             // Find string in file's contents
 519             boolean isFound = findString(fileString, stringToFind);
 520             if (isFound == expectedFound) {
 521                 passed(path + ": following text " + (isFound ? "found:" : "not found:") + "\n"
 522                         + stringToFind);
 523             } else {
 524                 failed(path + ": following text " + (isFound ? "found:" : "not found:") + "\n"
 525                         + stringToFind);


 526             }
 527         }
 528     }
 529 
 530     public void checkLinks() {
 531         checking("Check links");
 532         LinkChecker c = new LinkChecker(out, this::readFile);
 533         try {
 534             c.checkDirectory(outputDir.toPath());
 535             c.report();
 536             int errors = c.getErrorCount();
 537             if (errors == 0) {
 538                 passed("Links are OK");
 539             } else {
 540                 failed(errors + " errors found when checking links");
 541             }
 542         } catch (IOException e) {
 543             failed("exception thrown when reading files: " + e);
 544         }
 545     }




 505      *  to be found, or false if all of the strings are expected to be
 506      *  not found
 507      * @param strings the strings to be searched for
 508      */
 509     public void checkOutput(Output output, boolean expectedFound, String... strings) {
 510         checkOutput(output.toString(), outputMap.get(output), expectedFound, strings);
 511     }
 512 
 513     // NOTE: path may be the name of an Output stream as well as a file path
 514     private void checkOutput(String path, String fileString, boolean expectedFound, String... strings) {
 515         for (String stringToFind : strings) {
 516 //            log.logCheckOutput(path, expectedFound, stringToFind);
 517             checking("checkOutput");
 518             // Find string in file's contents
 519             boolean isFound = findString(fileString, stringToFind);
 520             if (isFound == expectedFound) {
 521                 passed(path + ": following text " + (isFound ? "found:" : "not found:") + "\n"
 522                         + stringToFind);
 523             } else {
 524                 failed(path + ": following text " + (isFound ? "found:" : "not found:") + "\n"
 525                         + stringToFind + '\n' +
 526                         "found \n" +
 527                         fileString);
 528             }
 529         }
 530     }
 531 
 532     public void checkLinks() {
 533         checking("Check links");
 534         LinkChecker c = new LinkChecker(out, this::readFile);
 535         try {
 536             c.checkDirectory(outputDir.toPath());
 537             c.report();
 538             int errors = c.getErrorCount();
 539             if (errors == 0) {
 540                 passed("Links are OK");
 541             } else {
 542                 failed(errors + " errors found when checking links");
 543             }
 544         } catch (IOException e) {
 545             failed("exception thrown when reading files: " + e);
 546         }
 547     }


< prev index next >