test/langtools/jdk/javadoc/doclet/testValueTag/TestValueTag.java
changeset 50612 e10812a82a3b
parent 48654 36f58bd6269f
child 53097 2e82ca64b25d
--- a/test/langtools/jdk/javadoc/doclet/testValueTag/TestValueTag.java	Mon Jun 18 13:40:16 2018 -0700
+++ b/test/langtools/jdk/javadoc/doclet/testValueTag/TestValueTag.java	Mon Jun 18 13:52:30 2018 -0700
@@ -23,7 +23,7 @@
 
 /*
  * @test
- * @bug      4764045 8004825 8026567 8191030
+ * @bug      4764045 8004825 8026567 8191030 8204330
  * @summary  This test ensures that the value tag works in all
  *           use cases, the tests are explained below.
  * @author   jamieh
@@ -33,6 +33,12 @@
  * @run main TestValueTag
  */
 
+import java.io.IOException;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import java.util.List;
+
 public class TestValueTag extends JavadocTester {
 
     public static void main(String... args) throws Exception {
@@ -110,7 +116,7 @@
         checkForException();
     }
 
-    @Test()
+    @Test
     void test2() {
         javadoc("-Xdoclint:none",
                 "-d", "out2",
@@ -133,7 +139,7 @@
         checkForException();
     }
 
-    @Test()
+    @Test
     void test3() {
         javadoc("-d", "out3",
                 "-sourcepath", testSrc,
@@ -146,10 +152,37 @@
                 "The value2 is <a href=\"#CONSTANT\">\"constant\"</a>.",
                 "The value3 is <a href=\"../pkg2/Class3.html#TEST_12_PASSES\">"
                 + "\"Test 12 passes\"</a>.");
+        checkForException();
+    }
+
+    @Test
+    void test4() throws IOException {
+        Path base = Paths.get("test4");
+        Path src = base.resolve("src");
+        Files.createDirectories(src.resolve("p"));
+        Files.write(src.resolve("p").resolve("C.java"), List.of(
+                "package p;",
+                "/** This class defines specialChars: {@value C#specialChars}. */",
+                "public class C {",
+                "    /** The value is {@value}. */",
+                "    public static final String specialChars = \"abc < def & ghi > jkl\";",
+                "}"));
+
+        javadoc("-d", base.resolve("out").toString(),
+                "-sourcepath", src.toString(),
+                "p");
+        checkExit(Exit.OK);
+        checkOutput("p/C.html", false,
+                "The value is \"abc < def & ghi > jkl\".");
+        checkOutput("p/C.html", true,
+                "The value is \"abc &lt; def &amp; ghi &gt; jkl\".");
+
+        checkForException();
     }
 
 
     void checkForException() {
         checkOutput(Output.STDERR, false, "DocletAbortException");
+        checkOutput(Output.STDERR, false, "IllegalArgumentException");
     }
 }