Path: blob/master/test/langtools/jdk/internal/shellsupport/doc/JavadocFormatterTest.java
41153 views
/*1* Copyright (c) 2015, 2021, Oracle and/or its affiliates. All rights reserved.2* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.3*4* This code is free software; you can redistribute it and/or modify it5* under the terms of the GNU General Public License version 2 only, as6* published by the Free Software Foundation.7*8* This code is distributed in the hope that it will be useful, but WITHOUT9* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or10* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License11* version 2 for more details (a copy is included in the LICENSE file that12* accompanied this code).13*14* You should have received a copy of the GNU General Public License version15* 2 along with this work; if not, write to the Free Software Foundation,16* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.17*18* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA19* or visit www.oracle.com if you need additional information or have any20* questions.21*/2223/*24* @test25* @bug 8131019 8169561 826145026* @summary Test JavadocFormatter27* @library /tools/lib28* @modules jdk.compiler/jdk.internal.shellsupport.doc29* @run testng JavadocFormatterTest30*/3132import java.util.Objects;3334import jdk.internal.shellsupport.doc.JavadocFormatter;35import org.testng.annotations.Test;3637@Test38public class JavadocFormatterTest {3940private static final String CODE_RESET = "\033[0m";41private static final String CODE_HIGHLIGHT = "\033[1m";42private static final String CODE_UNDERLINE = "\033[4m";4344public void testReflow() {45String actual;46String expected;4748actual = new JavadocFormatter(25, true).formatJavadoc(49"test",50"1234 1234\n1234\n1234 12345 123456789012345678901234567890 1234 1234\n1234 {@code 1234} 1234 1234\n1234 1234 123456 123456\n<b>123456</b>\n123456 123456 {@link String string} 1");5152expected = CODE_HIGHLIGHT + "test" + CODE_RESET + "\n" +53"1234 1234 1234 1234 12345\n" +54"123456789012345678901234567890\n" +55"1234 1234 1234 1234 1234\n" +56"1234 1234 1234 123456\n" +57"123456 123456 123456\n" +58"123456 string 1\n";5960if (!Objects.equals(actual, expected)) {61throw new AssertionError("Incorrect output: " + actual);62}6364actual = new JavadocFormatter(66, true).formatJavadoc("test",65"@param <T> 51234 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234\n" +66"@param <E> 61234 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234\n" +67"@param shortName 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234 " +68"1234 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234" +69" 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234" +70" 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234 \n" +71"@param aVeryLongName1234567890123456789012345678901234567890 " +72"1234 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234 " +73"1234 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234 " +74" 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234" +75" 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234 \n");7677expected = CODE_HIGHLIGHT + "test" + CODE_RESET + "\n" +78"\n" +79CODE_UNDERLINE + "Type Parameters:" + CODE_RESET + "\n" +80"T - 51234 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234\n" +81"E - 61234 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234\n" +82"\n" +83CODE_UNDERLINE + "Parameters:" + CODE_RESET + "\n" +84"shortName - 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234\n" +85" 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234\n" +86" 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234\n" +87" 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234\n" +88" 1234 1234 1234 1234\n" +89"aVeryLongName1234567890123456789012345678901234567890 - \n" +90" 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234\n" +91" 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234\n" +92" 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234\n" +93" 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234\n";9495if (!Objects.equals(actual, expected)) {96throw new AssertionError("Incorrect output: " + actual);97}9899actual = new JavadocFormatter(66, true).formatJavadoc("test",100"@throws ShortExcp 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234 " +101"1234 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234" +102" 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234" +103" 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234 \n" +104"@throws aVeryLongException1234567890123456789012345678901234567890 " +105"1234 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234 " +106"1234 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234 " +107" 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234" +108" 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234 \n");109110expected = CODE_HIGHLIGHT + "test" + CODE_RESET + "\n" +111"\n" +112CODE_UNDERLINE + "Thrown Exceptions:" + CODE_RESET + "\n" +113"ShortExcp - 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234\n" +114" 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234\n" +115" 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234\n" +116" 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234\n" +117" 1234 1234 1234 1234\n" +118"aVeryLongException1234567890123456789012345678901234567890 - \n" +119" 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234\n" +120" 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234\n" +121" 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234\n" +122" 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234\n";123124if (!Objects.equals(actual, expected)) {125throw new AssertionError("Incorrect output: " + actual);126}127actual = new JavadocFormatter(66, true).formatJavadoc("test",128"@return 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234 " +129"1234 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234" +130" 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234" +131" 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234 \n");132133expected = CODE_HIGHLIGHT + "test" + CODE_RESET + "\n" +134"\n" +135CODE_UNDERLINE + "Returns:" + CODE_RESET + "\n" +136"1234 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234\n" +137"1234 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234\n" +138"1234 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234\n" +139"1234 1234 1234 1234 1234 1234 1234 1234 1234 \n";140141if (!Objects.equals(actual, expected)) {142throw new AssertionError("Incorrect output: " + actual);143}144145//handling of <p>, <pre>:146actual = new JavadocFormatter(66, true).formatJavadoc("test",147"1234 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234 " +148"1234 1234 1234 1234 1234 <p>1234 1234 <p>1234 1234 1234 1234 1234 " +149"1234 1234 1234 1234 1234 1234 1234 1234 <p>1234 1234 1234 1234 " +150"1234 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234 \n" +151"<blockquote><pre>\n" +152"for (String data : content) {\n" +153" System.err.println(data);\n" +154"}\n" +155"</pre></blockquote>\n");156157expected = CODE_HIGHLIGHT + "test" + CODE_RESET + "\n" +158"1234 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234\n" +159"1234 1234 1234 1234\n" +160"1234 1234\n" +161"1234 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234\n" +162"1234 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234\n" +163"1234 1234 1234\n" +164" for (String data : content) {\n" +165" System.err.println(data);\n" +166" }\n" +167" \n";168169if (!Objects.equals(actual, expected)) {170throw new AssertionError("Incorrect output: " + actual);171}172173//list handling:174actual = new JavadocFormatter(66, true).formatJavadoc("test",175"<ul>" +176" <li>A 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234</li>" +177" <li>B 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234" +178" <li>C 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234<ol>" +179" <li>D 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234</li>" +180" <li>E 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234<ul>" +181" <li>F 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234<ol>" +182" <li>G 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234" +183" </ol>" +184" </ul>" +185" </OL>" +186" <LI><p>H 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234 <p>1234 1234 1234 1234 1234 1234 1234<ul>" +187" <li>I 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234" +188" </ul>" +189"</ul> followup" +190"<dl>" +191"<dt>Term1</dt>" +192"<dd>A 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234</dd>" +193"<dt>Term2" +194"<dd>B 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234" +195"<dt>Term3" +196"<dd>C 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234" +197"</dl>" +198"<dl>" +199"<dt>TermUnfinished" +200"</dl> followup");201202expected = CODE_HIGHLIGHT + "test" + CODE_RESET + "\n" +203" * A 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234\n" +204" 1234 1234 1234 1234 1234\n" +205" * B 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234\n" +206" 1234 1234 1234 1234 1234\n" +207" * C 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234\n" +208" 1234 1234 1234 1234 1234\n" +209" 1. D 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234\n" +210" 1234 1234 1234 1234 1234 1234\n" +211" 2. E 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234\n" +212" 1234 1234 1234 1234 1234 1234\n" +213" * F 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234\n" +214" 1234 1234 1234 1234 1234 1234 1234\n" +215" 1. G 1234 1234 1234 1234 1234 1234 1234 1234 1234\n" +216" 1234 1234 1234 1234 1234 1234 1234 1234\n" +217" * H 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234\n" +218" 1234 1234 1234 1234 1234 1234 1234\n" +219" * I 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234\n" +220" 1234 1234 1234 1234 1234 1234\n" +221"followup\n" +222CODE_HIGHLIGHT + "Term1" + CODE_RESET + "\n" +223" A 1234 1234 1234 1234 1234 1234 1234 1234 1234\n" +224" 1234 1234 1234 1234 1234 1234 1234 1234\n" +225CODE_HIGHLIGHT + "Term2" + CODE_RESET + "\n" +226" B 1234 1234 1234 1234 1234 1234 1234 1234 1234\n" +227" 1234 1234 1234 1234 1234 1234 1234 1234\n" +228CODE_HIGHLIGHT + "Term3" + CODE_RESET + "\n" +229" C 1234 1234 1234 1234 1234 1234 1234 1234 1234\n" +230" 1234 1234 1234 1234 1234 1234 1234 1234\n" +231CODE_HIGHLIGHT + "TermUnfinished" + CODE_RESET + "\n" +232"followup\n";233234if (!Objects.equals(actual, expected)) {235throw new AssertionError("Incorrect output: " + actual);236}237238//sections:239actual = new JavadocFormatter(66, true).formatJavadoc("test",240"text 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234 " +241"1234 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234 " +242"<h3>1234 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234</h3>" +243"1234 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234 " +244"1234 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234");245246expected = CODE_HIGHLIGHT + "test" + CODE_RESET + "\n" +247"text 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234\n" +248"1234 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234\n" +249"1234 1234 1234 1234 1234 1234 1234 1234 1234\n" +250"\n" +251CODE_UNDERLINE + "1234 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234\n" +252"1234 1234 1234 1234 1234" + CODE_RESET + "\n" +253"1234 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234\n" +254"1234 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234\n" +255"1234 1234 1234 1234 1234 1234 1234 1234\n";256257if (!Objects.equals(actual, expected)) {258throw new AssertionError("Incorrect output: " + actual);259}260261//table:262actual = new JavadocFormatter(66, true).formatJavadoc("test",263"<table>" +264"<tr>" +265"<th>A 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234</th>" +266"<th>B 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234</th>" +267"<th>C 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234</th>" +268"</tr>" +269"<tr>" +270"<td>A 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234</td> \n" +271"<td>B 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234" +272"<td>C 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234" +273"<tr>" +274"<td>A 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234</td>" +275"<td>B 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234</td>" +276"<td>C 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234</td>" +277"</tr>" +278"<tr>" +279"<td>1234 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234</td>" +280"<td>1234 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234</td>" +281"</table>");282283expected = CODE_HIGHLIGHT + "test" + CODE_RESET + "\n" +284"----------------------------------------------------------------\n" +285"| " + CODE_HIGHLIGHT + "A 1234 1234 1234" + CODE_RESET + " | " + CODE_HIGHLIGHT + "B 1234 1234 1234" + CODE_RESET + " | " + CODE_HIGHLIGHT + "C 1234 1234 1234" + CODE_RESET + " |\n" +286"| " + CODE_HIGHLIGHT + "1234 1234 1234" + CODE_RESET + " | " + CODE_HIGHLIGHT + "1234 1234 1234" + CODE_RESET + " | " + CODE_HIGHLIGHT + "1234 1234 1234" + CODE_RESET + " |\n" +287"| " + CODE_HIGHLIGHT + "1234 1234 1234" + CODE_RESET + " | " + CODE_HIGHLIGHT + "1234 1234 1234" + CODE_RESET + " | " + CODE_HIGHLIGHT + "1234 1234 1234" + CODE_RESET + " |\n" +288"| " + CODE_HIGHLIGHT + "1234 1234 1234" + CODE_RESET + " | " + CODE_HIGHLIGHT + "1234 1234 1234" + CODE_RESET + " | " + CODE_HIGHLIGHT + "1234 1234 1234" + CODE_RESET + " |\n" +289"| " + CODE_HIGHLIGHT + "1234 1234 1234" + CODE_RESET + " | " + CODE_HIGHLIGHT + "1234 1234 1234" + CODE_RESET + " | " + CODE_HIGHLIGHT + "1234 1234 1234" + CODE_RESET + " |\n" +290"| " + CODE_HIGHLIGHT + "1234 1234" + CODE_RESET + " | " + CODE_HIGHLIGHT + "1234 1234" + CODE_RESET + " | " + CODE_HIGHLIGHT + "1234 1234" + CODE_RESET + " |\n" +291"----------------------------------------------------------------\n" +292"| A 1234 1234 1234 | B 1234 1234 1234 | C 1234 1234 1234 |\n" +293"| 1234 1234 1234 | 1234 1234 1234 | 1234 1234 1234 |\n" +294"| 1234 1234 1234 | 1234 1234 1234 | 1234 1234 1234 |\n" +295"| 1234 1234 1234 | 1234 1234 1234 | 1234 1234 1234 |\n" +296"| 1234 1234 1234 | 1234 1234 1234 | 1234 1234 1234 |\n" +297"| 1234 1234 | 1234 1234 | 1234 1234 |\n" +298"----------------------------------------------------------------\n" +299"| A 1234 1234 1234 | B 1234 1234 1234 | C 1234 1234 1234 |\n" +300"| 1234 1234 1234 | 1234 1234 1234 | 1234 1234 1234 |\n" +301"| 1234 1234 1234 | 1234 1234 1234 | 1234 1234 1234 |\n" +302"| 1234 1234 1234 | 1234 1234 1234 | 1234 1234 1234 |\n" +303"| 1234 1234 1234 | 1234 1234 1234 | 1234 1234 1234 |\n" +304"| 1234 1234 | 1234 1234 | 1234 1234 |\n" +305"----------------------------------------------------------------\n" +306"| 1234 1234 1234 | 1234 1234 1234 |\n" +307"| 1234 1234 1234 | 1234 1234 1234 |\n" +308"| 1234 1234 1234 | 1234 1234 1234 |\n" +309"| 1234 1234 1234 | 1234 1234 1234 |\n" +310"| 1234 1234 1234 | 1234 1234 1234 |\n" +311"| 1234 1234 | 1234 1234 |\n" +312"-------------------------------------------\n";313314if (!Objects.equals(actual, expected)) {315throw new AssertionError("Incorrect output: " + actual);316}317318//no escape sequences:319actual = new JavadocFormatter(66, false).formatJavadoc("test",320"@param shortName 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234 " +321"1234 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234" +322" 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234" +323" 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234 \n" +324"@param aVeryLongName1234567890123456789012345678901234567890 " +325"1234 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234 " +326"1234 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234 " +327" 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234" +328" 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234 \n");329330expected = "test\n" +331"\n" +332"Parameters:\n" +333"shortName - 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234\n" +334" 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234\n" +335" 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234\n" +336" 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234\n" +337" 1234 1234 1234 1234\n" +338"aVeryLongName1234567890123456789012345678901234567890 - \n" +339" 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234\n" +340" 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234\n" +341" 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234\n" +342" 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234\n";343344if (!Objects.equals(actual, expected)) {345throw new AssertionError("Incorrect output: " + actual);346}347348//null javadoc:349actual = new JavadocFormatter(66, true).formatJavadoc("test", null);350351expected = CODE_HIGHLIGHT + "test" + CODE_RESET + "\n";352353if (!Objects.equals(actual, expected)) {354throw new AssertionError("Incorrect output: " + actual);355}356357//stray tags:358for (String tag : new String[] {"li", "ol", "h3", "table", "tr", "td", "dl", "dt", "dd"}) {359for (boolean closing : new boolean[] {false, true}) {360actual = new JavadocFormatter(66, true).formatJavadoc("test",361"<" + (closing ? "/" : "") + tag + ">text");362363if (!actual.contains("text")) {364throw new AssertionError("Incorrect output: " + actual);365}366}367}368369//entities:370actual = new JavadocFormatter(66, false).formatJavadoc("test",371"α < A B > &broken; � �\n");372373expected = "test\n" +374"\u03b1 < A B > &broken; � �\n";375376if (!Objects.equals(actual, expected)) {377throw new AssertionError("Incorrect output: " + actual);378}379380//img:381actual = new JavadocFormatter(66, true).formatJavadoc("test",382"1234 <img src='any.png' alt='text'/> 1234");383384expected = CODE_HIGHLIGHT + "test" + CODE_RESET + "\n" +385"1234 text 1234\n";386387if (!Objects.equals(actual, expected)) {388throw new AssertionError("Incorrect output: " + actual);389}390391//unknown HTML tag:392actual = new JavadocFormatter(66, false).formatJavadoc("test",393"1234 <unknown any any>1234</unknown> 1234");394395expected = "test\n" +396"1234 1234 1234\n";397398if (!Objects.equals(actual, expected)) {399throw new AssertionError("Incorrect output: " + actual);400}401}402403public void testSpaceAtEndOfLine() {404String header = "Class<?> Class<T>.forName(Module module, String name)";405String javadoc = """406@throws SecurityException407<ul>408<li> test </li>409</ul>410""";411412new JavadocFormatter(60, true).formatJavadoc(header, javadoc);413}414415}416417418