< prev index next >

test/langtools/jdk/javadoc/doclet/testIndexTaglet/TestIndexTaglet.java

Print this page




  59         Path srcDir = base.resolve("src");
  60         Path outDir = base.resolve("out");
  61 
  62         MethodBuilder method = MethodBuilder
  63                 .parse("public void func(A a) {}")
  64                 .setComments("test description with {@index search_phrase_a class a}");
  65 
  66         new ClassBuilder(tb, "pkg.A")
  67                 .setModifiers("public", "class")
  68                 .addMembers(method)
  69                 .write(srcDir);
  70 
  71         javadoc("-d", outDir.toString(),
  72                 "-sourcepath", srcDir.toString(),
  73                 "pkg");
  74 
  75         checkExit(Exit.OK);
  76 
  77         checkOrder("pkg/A.html",
  78                 "<h2>Method Details</h2>\n",
  79                 "<div class=\"block\">test description with <a id=\"search_phrase_a\" "
  80                  +    "class=\"searchTagResult\">search_phrase_a</a></div>");
  81 
  82         checkOrder("pkg/A.html",
  83                 "<h2>Method Summary</h2>\n",
  84                 "<div class=\"block\">test description with search_phrase_a</div>");
  85     }
  86 
  87     @Test
  88     public void testIndexWithinATag(Path base) throws Exception {
  89         Path srcDir = base.resolve("src");
  90         Path outDir = base.resolve("out");
  91 
  92         new ClassBuilder(tb, "pkg2.A")
  93                 .setModifiers("public", "class")
  94                 .addMembers(MethodBuilder.parse("public void func(){}")
  95                         .setComments("a within a : <a href='..'>{@index check}</a>"))
  96                 .write(srcDir);
  97 
  98         javadoc("-d", outDir.toString(),
  99                 "-sourcepath", srcDir.toString(),
 100                 "pkg2");


 107 
 108     @Test
 109     public void testDuplicateReferences(Path base) throws Exception {
 110         Path srcDir = base.resolve("src");
 111         Path outDir = base.resolve("out");
 112 
 113         new ClassBuilder(tb, "pkg.A")
 114                 .setModifiers("public", "class")
 115                 .setComments("This is a class. Here is {@index foo first}.")
 116                 .addMembers(MethodBuilder.parse("public void m() {}")
 117                         .setComments("This is a method. Here is {@index foo second}."))
 118                 .write(srcDir);
 119 
 120         javadoc("-d", outDir.toString(),
 121                 "-sourcepath", srcDir.toString(),
 122                 "pkg");
 123 
 124         checkExit(Exit.OK);
 125 
 126         checkOutput("pkg/A.html", true,
 127                 "This is a class. Here is <a id=\"foo\" class=\"searchTagResult\">foo</a>.",
 128                 "This is a method. Here is <a id=\"foo-1\" class=\"searchTagResult\">foo</a>.");
 129     }
 130 }


  59         Path srcDir = base.resolve("src");
  60         Path outDir = base.resolve("out");
  61 
  62         MethodBuilder method = MethodBuilder
  63                 .parse("public void func(A a) {}")
  64                 .setComments("test description with {@index search_phrase_a class a}");
  65 
  66         new ClassBuilder(tb, "pkg.A")
  67                 .setModifiers("public", "class")
  68                 .addMembers(method)
  69                 .write(srcDir);
  70 
  71         javadoc("-d", outDir.toString(),
  72                 "-sourcepath", srcDir.toString(),
  73                 "pkg");
  74 
  75         checkExit(Exit.OK);
  76 
  77         checkOrder("pkg/A.html",
  78                 "<h2>Method Details</h2>\n",
  79                 "<div class=\"block\">test description with <span id=\"search_phrase_a\" "
  80                  +    "class=\"searchTagResult\">search_phrase_a</span></div>");
  81 
  82         checkOrder("pkg/A.html",
  83                 "<h2>Method Summary</h2>\n",
  84                 "<div class=\"block\">test description with search_phrase_a</div>");
  85     }
  86 
  87     @Test
  88     public void testIndexWithinATag(Path base) throws Exception {
  89         Path srcDir = base.resolve("src");
  90         Path outDir = base.resolve("out");
  91 
  92         new ClassBuilder(tb, "pkg2.A")
  93                 .setModifiers("public", "class")
  94                 .addMembers(MethodBuilder.parse("public void func(){}")
  95                         .setComments("a within a : <a href='..'>{@index check}</a>"))
  96                 .write(srcDir);
  97 
  98         javadoc("-d", outDir.toString(),
  99                 "-sourcepath", srcDir.toString(),
 100                 "pkg2");


 107 
 108     @Test
 109     public void testDuplicateReferences(Path base) throws Exception {
 110         Path srcDir = base.resolve("src");
 111         Path outDir = base.resolve("out");
 112 
 113         new ClassBuilder(tb, "pkg.A")
 114                 .setModifiers("public", "class")
 115                 .setComments("This is a class. Here is {@index foo first}.")
 116                 .addMembers(MethodBuilder.parse("public void m() {}")
 117                         .setComments("This is a method. Here is {@index foo second}."))
 118                 .write(srcDir);
 119 
 120         javadoc("-d", outDir.toString(),
 121                 "-sourcepath", srcDir.toString(),
 122                 "pkg");
 123 
 124         checkExit(Exit.OK);
 125 
 126         checkOutput("pkg/A.html", true,
 127                 "This is a class. Here is <span id=\"foo\" class=\"searchTagResult\">foo</span>.",
 128                 "This is a method. Here is <span id=\"foo-1\" class=\"searchTagResult\">foo</span>.");
 129     }
 130 }
< prev index next >