1 /*******************************************************************************
2 * Copyright (c) 2000, 2016 IBM Corporation and others.
3 *
4 * This program and the accompanying materials
5 * are made available under the terms of the Eclipse Public License 2.0
6 * which accompanies this distribution, and is available at
7 * https://www.eclipse.org/legal/epl-2.0/
8 *
9 * SPDX-License-Identifier: EPL-2.0
10 *
11 * Contributors:
12 * IBM Corporation - initial API and implementation
13 *******************************************************************************/
14 package org.eclipse.jdt.core.tests.model;
15
16 import java.util.Hashtable;
17
18 import junit.framework.Test;
19
20 import org.eclipse.jdt.core.CompletionProposal;
21 import org.eclipse.jdt.core.JavaCore;
22 import org.eclipse.jdt.core.JavaModelException;
23 import org.eclipse.jdt.internal.compiler.impl.CompilerOptions;
24
25 /**
26 * Test class for completion in Javadoc comment of a type declaration.
27 */
28 @SuppressWarnings({"rawtypes", "unchecked"})
29 public class JavadocTypeCompletionModelTest extends AbstractJavadocCompletionModelTest {
30
JavadocTypeCompletionModelTest(String name)31 public JavadocTypeCompletionModelTest(String name) {
32 super(name);
33 }
34
35 static {
36 // TESTS_RANGE = new int[] { 22, -1 };
37 // TESTS_NUMBERS = new int[] { 20 };
38 }
suite()39 public static Test suite() {
40 return buildModelTestSuite(JavadocTypeCompletionModelTest.class);
41 }
42
43 /* (non-Javadoc)
44 * @see org.eclipse.jdt.core.tests.model.AbstractJavadocCompletionModelTest#setUp()
45 */
46 @Override
setUp()47 protected void setUp() throws Exception {
48 super.setUp();
49 setUpProjectOptions(CompilerOptions.VERSION_1_4);
50 }
51
52 /**
53 * @category Tests for tag names completion
54 */
test001()55 public void test001() throws JavaModelException {
56 String source =
57 "package javadoc.types;\n" +
58 "/**\n" +
59 " * Completion on empty tag name:\n" +
60 " * @\n" +
61 " */\n" +
62 "public class Test {}\n";
63 completeInJavadoc("/Completion/src/javadoc/types/Test.java", source, true, "@");
64 assertResults(
65 "author[JAVADOC_BLOCK_TAG]{@author, null, null, author, null, "+this.positions+JAVADOC_RELEVANCE+"}\n" +
66 "deprecated[JAVADOC_BLOCK_TAG]{@deprecated, null, null, deprecated, null, "+this.positions+JAVADOC_RELEVANCE+"}\n" +
67 "see[JAVADOC_BLOCK_TAG]{@see, null, null, see, null, "+this.positions+JAVADOC_RELEVANCE+"}\n" +
68 "version[JAVADOC_BLOCK_TAG]{@version, null, null, version, null, "+this.positions+JAVADOC_RELEVANCE+"}\n" +
69 "category[JAVADOC_BLOCK_TAG]{@category, null, null, category, null, "+this.positions+JAVADOC_RELEVANCE+"}\n" +
70 "since[JAVADOC_BLOCK_TAG]{@since, null, null, since, null, "+this.positions+JAVADOC_RELEVANCE+"}\n" +
71 "serial[JAVADOC_BLOCK_TAG]{@serial, null, null, serial, null, "+this.positions+JAVADOC_RELEVANCE+"}\n" +
72 "link[JAVADOC_INLINE_TAG]{{@link}, null, null, link, null, "+this.positions+JAVADOC_RELEVANCE+"}\n" +
73 "docRoot[JAVADOC_INLINE_TAG]{{@docRoot}, null, null, docRoot, null, "+this.positions+JAVADOC_RELEVANCE+"}\n" +
74 "linkplain[JAVADOC_INLINE_TAG]{{@linkplain}, null, null, linkplain, null, "+this.positions+JAVADOC_RELEVANCE+"}\n" +
75 "value[JAVADOC_INLINE_TAG]{{@value}, null, null, value, null, "+this.positions+JAVADOC_RELEVANCE+"}"
76 );
77 }
78
test002()79 public void test002() throws JavaModelException {
80 String source =
81 "package javadoc.types;\n" +
82 "/**\n" +
83 " * Completion on impossible tag name:\n" +
84 " * @par\n" +
85 " */\n" +
86 "public class Test {}\n";
87 completeInJavadoc("/Completion/src/javadoc/types/Test.java", source, true, "@par");
88 assertResults("");
89 }
90
test003()91 public void test003() throws JavaModelException {
92 String source =
93 "package javadoc.types;\n" +
94 "/**\n" +
95 " * Completion on one letter:\n" +
96 " * @v\n" +
97 " */\n" +
98 "public class Test {}\n";
99 completeInJavadoc("/Completion/src/javadoc/types/Test.java", source, true, "@v");
100 assertResults(
101 "version[JAVADOC_BLOCK_TAG]{@version, null, null, version, null, "+this.positions+JAVADOC_RELEVANCE+"}\n" +
102 "value[JAVADOC_INLINE_TAG]{{@value}, null, null, value, null, "+this.positions+JAVADOC_RELEVANCE+"}"
103 );
104 }
105
test004()106 public void test004() throws JavaModelException {
107 String source =
108 "package javadoc.types;\n" +
109 "/**\n" +
110 " * Completion with several letters:\n" +
111 " * @deprec\n" +
112 " */\n" +
113 "public class Test {}\n";
114 completeInJavadoc("/Completion/src/javadoc/types/Test.java", source, true, "@deprec");
115 assertResults(
116 "deprecated[JAVADOC_BLOCK_TAG]{@deprecated, null, null, deprecated, null, "+this.positions+JAVADOC_RELEVANCE+"}"
117 );
118 }
119
test005()120 public void test005() throws JavaModelException {
121 String source =
122 "package javadoc.types;\n" +
123 "/**\n" +
124 " * Completion on full tag name:\n" +
125 " * @link\n" +
126 " */\n" +
127 "public class Test {}\n";
128 completeInJavadoc("/Completion/src/javadoc/types/Test.java", source, true, "@link");
129 assertResults(
130 "link[JAVADOC_INLINE_TAG]{{@link}, null, null, link, null, "+this.positions+JAVADOC_RELEVANCE+"}\n" +
131 "linkplain[JAVADOC_INLINE_TAG]{{@linkplain}, null, null, linkplain, null, "+this.positions+JAVADOC_RELEVANCE+"}"
132 );
133 }
134
test006()135 public void test006() throws JavaModelException {
136 String source =
137 "package javadoc.types;\n" +
138 "/**\n" +
139 " * Completion on full tag name:\n" +
140 " * @link\n" +
141 " */\n" +
142 "public class Test {}\n";
143 completeInJavadoc("/Completion/src/javadoc/types/Test.java", source, true, "@li");
144 assertResults(
145 "link[JAVADOC_INLINE_TAG]{{@link}, null, null, link, null, "+this.positions+JAVADOC_RELEVANCE+"}\n" +
146 "linkplain[JAVADOC_INLINE_TAG]{{@linkplain}, null, null, linkplain, null, "+this.positions+JAVADOC_RELEVANCE+"}"
147 );
148 }
149
test007()150 public void test007() throws JavaModelException {
151 setUpProjectOptions(CompilerOptions.VERSION_1_3);
152 String source =
153 "package javadoc.types;\n" +
154 "/**\n" +
155 " * Completion on empty tag name:\n" +
156 " * @\n" +
157 " */\n" +
158 "// Note: this test should be done using compliance 1.3\n" +
159 "public class Test {}\n";
160 completeInJavadoc("/Completion/src/javadoc/types/Test.java", source, true, "@");
161 assertResults(
162 "author[JAVADOC_BLOCK_TAG]{@author, null, null, author, null, "+this.positions+JAVADOC_RELEVANCE+"}\n" +
163 "deprecated[JAVADOC_BLOCK_TAG]{@deprecated, null, null, deprecated, null, "+this.positions+JAVADOC_RELEVANCE+"}\n" +
164 "see[JAVADOC_BLOCK_TAG]{@see, null, null, see, null, "+this.positions+JAVADOC_RELEVANCE+"}\n" +
165 "version[JAVADOC_BLOCK_TAG]{@version, null, null, version, null, "+this.positions+JAVADOC_RELEVANCE+"}\n" +
166 "category[JAVADOC_BLOCK_TAG]{@category, null, null, category, null, "+this.positions+JAVADOC_RELEVANCE+"}\n" +
167 "since[JAVADOC_BLOCK_TAG]{@since, null, null, since, null, "+this.positions+JAVADOC_RELEVANCE+"}\n" +
168 "serial[JAVADOC_BLOCK_TAG]{@serial, null, null, serial, null, "+this.positions+JAVADOC_RELEVANCE+"}\n" +
169 "link[JAVADOC_INLINE_TAG]{{@link}, null, null, link, null, "+this.positions+JAVADOC_RELEVANCE+"}\n" +
170 "docRoot[JAVADOC_INLINE_TAG]{{@docRoot}, null, null, docRoot, null, "+this.positions+JAVADOC_RELEVANCE+"}"
171 );
172 }
173
test008()174 public void test008() throws JavaModelException {
175 setUpProjectOptions(CompilerOptions.VERSION_1_5);
176 String source =
177 "package javadoc.types;\n" +
178 "/**\n" +
179 " * Completion on empty tag name:\n" +
180 " * @\n" +
181 " */\n" +
182 "// Note: this test should be done using compliance 1.5\n" +
183 "public class Test<T> {}\n";
184 completeInJavadoc("/Completion/src/javadoc/types/Test.java", source, true, "@");
185 assertResults(
186 "author[JAVADOC_BLOCK_TAG]{@author, null, null, author, null, "+this.positions+JAVADOC_RELEVANCE+"}\n" +
187 "deprecated[JAVADOC_BLOCK_TAG]{@deprecated, null, null, deprecated, null, "+this.positions+JAVADOC_RELEVANCE+"}\n" +
188 "param[JAVADOC_BLOCK_TAG]{@param, null, null, param, null, "+this.positions+JAVADOC_RELEVANCE+"}\n" +
189 "see[JAVADOC_BLOCK_TAG]{@see, null, null, see, null, "+this.positions+JAVADOC_RELEVANCE+"}\n" +
190 "version[JAVADOC_BLOCK_TAG]{@version, null, null, version, null, "+this.positions+JAVADOC_RELEVANCE+"}\n" +
191 "category[JAVADOC_BLOCK_TAG]{@category, null, null, category, null, "+this.positions+JAVADOC_RELEVANCE+"}\n" +
192 "since[JAVADOC_BLOCK_TAG]{@since, null, null, since, null, "+this.positions+JAVADOC_RELEVANCE+"}\n" +
193 "serial[JAVADOC_BLOCK_TAG]{@serial, null, null, serial, null, "+this.positions+JAVADOC_RELEVANCE+"}\n" +
194 "link[JAVADOC_INLINE_TAG]{{@link}, null, null, link, null, "+this.positions+JAVADOC_RELEVANCE+"}\n" +
195 "docRoot[JAVADOC_INLINE_TAG]{{@docRoot}, null, null, docRoot, null, "+this.positions+JAVADOC_RELEVANCE+"}\n" +
196 "linkplain[JAVADOC_INLINE_TAG]{{@linkplain}, null, null, linkplain, null, "+this.positions+JAVADOC_RELEVANCE+"}\n" +
197 "value[JAVADOC_INLINE_TAG]{{@value}, null, null, value, null, "+this.positions+JAVADOC_RELEVANCE+"}\n" +
198 "code[JAVADOC_INLINE_TAG]{{@code}, null, null, code, null, "+this.positions+JAVADOC_RELEVANCE+"}\n" +
199 "literal[JAVADOC_INLINE_TAG]{{@literal}, null, null, literal, null, "+this.positions+JAVADOC_RELEVANCE+"}"
200 );
201 }
202
203 /**
204 * @category Tests for types completion
205 */
test010()206 public void test010() throws JavaModelException {
207 String source =
208 "package javadoc.types.tags;\n" +
209 "/**\n" +
210 " * Completion after:\n" +
211 " * @see Obj\n" +
212 " */\n" +
213 "public class BasicTestTypes {\n" +
214 "}\n";
215 completeInJavadoc("/Completion/src/javadoc/types/tags/BasicTestTypes.java", source, true, "Obj");
216 assertResults(
217 "Object[TYPE_REF]{Object, java.lang, Ljava.lang.Object;, null, null, "+this.positions+R_DRICUNR+"}"
218 );
219 }
220
test011()221 public void test011() throws JavaModelException {
222 String source =
223 "package javadoc.types.tags;\n" +
224 "/**\n" +
225 " * Completion after:\n" +
226 " * @see BasicTest\n" +
227 " */\n" +
228 "public class BasicTestTypes {\n" +
229 "}\n";
230 completeInJavadoc("/Completion/src/javadoc/types/tags/BasicTestTypes.java", source, true, "BasicTest");
231 assertResults(
232 "BasicTestTypes[TYPE_REF]{BasicTestTypes, javadoc.types.tags, Ljavadoc.types.tags.BasicTestTypes;, null, null, "+this.positions+R_DRICUNR+"}\n" +
233 "BasicTestReferences[TYPE_REF]{org.eclipse.jdt.core.tests.BasicTestReferences, org.eclipse.jdt.core.tests, Lorg.eclipse.jdt.core.tests.BasicTestReferences;, null, null, "+this.positions+R_DRICNR+"}"
234 );
235 }
236
test012()237 public void test012() throws JavaModelException {
238 String source =
239 "package javadoc.types.tags;\n" +
240 "/**\n" +
241 " * Completion after:\n" +
242 " * @see BasicTestTypes\n" +
243 " */\n" +
244 "public class BasicTestTypes {\n" +
245 "}\n";
246 completeInJavadoc("/Completion/src/javadoc/types/tags/BasicTestTypes.java", source, true, "BasicTest");
247 assertResults(
248 "BasicTestTypes[TYPE_REF]{BasicTestTypes, javadoc.types.tags, Ljavadoc.types.tags.BasicTestTypes;, null, null, "+this.positions+R_DRICUNR+"}\n" +
249 "BasicTestReferences[TYPE_REF]{org.eclipse.jdt.core.tests.BasicTestReferences, org.eclipse.jdt.core.tests, Lorg.eclipse.jdt.core.tests.BasicTestReferences;, null, null, "+this.positions+R_DRICNR+"}"
250 );
251 }
252
test013()253 public void test013() throws JavaModelException {
254 setUpProjectOptions(CompilerOptions.VERSION_1_5);
255 String source =
256 "package javadoc.types.tags;\n" +
257 "/**\n" +
258 " * Completion after:\n" +
259 " * @see BasicTest\n" +
260 " */\n" +
261 "public class BasicTestTypes<TPARAM> {\n" +
262 "}\n";
263 completeInJavadoc("/Completion/src/javadoc/types/tags/BasicTestTypes.java", source, true, "BasicTest");
264 assertResults(
265 "BasicTestTypes<TPARAM>[TYPE_REF]{BasicTestTypes, javadoc.types.tags, Ljavadoc.types.tags.BasicTestTypes<TTPARAM;>;, null, null, "+this.positions+R_DRICUNR+"}\n" +
266 "BasicTestReferences[TYPE_REF]{org.eclipse.jdt.core.tests.BasicTestReferences, org.eclipse.jdt.core.tests, Lorg.eclipse.jdt.core.tests.BasicTestReferences;, null, null, "+this.positions+R_DRICNR+"}"
267 );
268 }
269
test014()270 public void test014() throws JavaModelException {
271 String source =
272 "package javadoc.types.tags;\n" +
273 "/**\n" +
274 " * Completion after:\n" +
275 " * @see javadoc.types.tags.BasicTest\n" +
276 " * Note: JDT-UI failed on this one\n" +
277 " */\n" +
278 "public class BasicTestTypes {\n" +
279 "}\n";
280 completeInJavadoc("/Completion/src/javadoc/types/tags/BasicTestTypes.java", source, true, "javadoc.types.tags.BasicTest");
281 assertResults(
282 "BasicTestTypes[TYPE_REF]{BasicTestTypes, javadoc.types.tags, Ljavadoc.types.tags.BasicTestTypes;, null, null, "+this.positions+R_DRICNR+"}"
283 );
284 }
285
test015()286 public void test015() throws JavaModelException {
287 setUpProjectOptions(CompilerOptions.VERSION_1_5);
288 String source =
289 "package javadoc.types.tags;\n" +
290 "/**\n" +
291 " * Completion after:\n" +
292 " * @see javadoc.types.tags.BasicTest\n" +
293 " * Note: JDT-UI failed on this one\n" +
294 " */\n" +
295 "public class BasicTestTypes<TPARAM> {\n" +
296 "}\n";
297 completeInJavadoc("/Completion/src/javadoc/types/tags/BasicTestTypes.java", source, true, "javadoc.types.tags.BasicTest");
298 assertResults(
299 "BasicTestTypes<TPARAM>[TYPE_REF]{BasicTestTypes, javadoc.types.tags, Ljavadoc.types.tags.BasicTestTypes<TTPARAM;>;, null, null, "+this.positions+R_DRICNR+"}"
300 );
301 }
302
test016()303 public void test016() throws JavaModelException {
304 String source =
305 "package javadoc.types.tags;\n" +
306 "/**\n" +
307 " * Completion after:\n" +
308 " * @see java.la\n" +
309 " * Note: JDT-UI fails on this one\n" +
310 " */\n" +
311 "public class BasicTestTypes {\n" +
312 "}\n";
313 completeInJavadoc("/Completion/src/javadoc/types/tags/BasicTestTypes.java", source, true, "java.la");
314 assertResults(
315 "java.lang[PACKAGE_REF]{java.lang, java.lang, null, null, null, "+this.positions+R_DRICQNR+"}"
316 );
317 }
318
test017()319 public void test017() throws JavaModelException {
320 String source =
321 "package javadoc.types.tags;\n" +
322 "/**\n" +
323 " * Completion after:\n" +
324 " * @see java.lang\n" +
325 " * Note: JDT-UI fails on this one\n" +
326 " */\n" +
327 "public class BasicTestTypes {\n" +
328 "}\n";
329 completeInJavadoc("/Completion/src/javadoc/types/tags/BasicTestTypes.java", source, true, "java.la");
330 assertResults(
331 "java.lang[PACKAGE_REF]{java.lang, java.lang, null, null, null, "+this.positions+R_DRICQNR+"}"
332 );
333 }
334
test018()335 public void test018() throws JavaModelException {
336 String source =
337 "package javadoc.types.tags;\n" +
338 "/**\n" +
339 " * Completion after:\n" +
340 " * @see pack.Bin\n" +
341 " */\n" +
342 "public class BasicTestTypes {\n" +
343 "}\n";
344 completeInJavadoc("/Completion/src/javadoc/types/tags/BasicTestTypes.java", source, true, "pack.Bin");
345 assertSortedResults(
346 "Bin1[TYPE_REF]{pack.Bin1, pack, Lpack.Bin1;, null, null, "+this.positions+R_DRICQNR+"}\n" +
347 "Bin2[TYPE_REF]{pack.Bin2, pack, Lpack.Bin2;, null, null, "+this.positions+R_DRICQNR+"}\n" +
348 "Bin3[TYPE_REF]{pack.Bin3, pack, Lpack.Bin3;, null, null, "+this.positions+R_DRICQNR+"}\n" +
349 "Bin4[TYPE_REF]{pack.Bin4, pack, Lpack.Bin4;, null, null, "+this.positions+R_DRICQNR+"}\n" +
350 "Bin5[TYPE_REF]{pack.Bin5, pack, Lpack.Bin5;, null, null, "+this.positions+R_DRICQNR+"}"
351 );
352 }
353
test019()354 public void test019() throws JavaModelException {
355 String source =
356 "package javadoc.types.tags;\n" +
357 "/**\n" +
358 " * Completion after:\n" +
359 " * @see pack.Bin2\n" +
360 " */\n" +
361 "public class BasicTestTypes {\n" +
362 "}\n";
363 completeInJavadoc("/Completion/src/javadoc/types/tags/BasicTestTypes.java", source, true, "pack.Bin");
364 assertSortedResults(
365 "Bin1[TYPE_REF]{pack.Bin1, pack, Lpack.Bin1;, null, null, "+this.positions+R_DRICQNR+"}\n" +
366 "Bin2[TYPE_REF]{pack.Bin2, pack, Lpack.Bin2;, null, null, "+this.positions+R_DRICQNR+"}\n" +
367 "Bin3[TYPE_REF]{pack.Bin3, pack, Lpack.Bin3;, null, null, "+this.positions+R_DRICQNR+"}\n" +
368 "Bin4[TYPE_REF]{pack.Bin4, pack, Lpack.Bin4;, null, null, "+this.positions+R_DRICQNR+"}\n" +
369 "Bin5[TYPE_REF]{pack.Bin5, pack, Lpack.Bin5;, null, null, "+this.positions+R_DRICQNR+"}"
370 );
371 }
372
test020()373 public void test020() throws JavaModelException {
374 String source =
375 "package javadoc.types.tags;\n" +
376 "/**\n" +
377 " * Completion after:\n" +
378 " * @see pack.Bin2\n" +
379 " */\n" +
380 "public class BasicTestTypes {\n" +
381 "}\n";
382 completeInJavadoc("/Completion/src/javadoc/types/tags/BasicTestTypes.java", source, true, "pack.Bin2");
383 assertSortedResults(
384 "Bin2[TYPE_REF]{pack.Bin2, pack, Lpack.Bin2;, null, null, "+this.positions+R_DRICENQNR+"}"
385 );
386 }
387
test021()388 public void test021() throws JavaModelException {
389 String source =
390 "package javadoc.types.tags;\n" +
391 "/**\n" +
392 " * Completion after:\n" +
393 " * @see I\n" +
394 " * Note: completion list shoud not include base types.\n" +
395 " */\n" +
396 "public class BasicTestTypes {\n" +
397 "}\n";
398 completeInJavadoc("/Completion/src/javadoc/types/tags/BasicTestTypes.java", source, true, "I");
399 assertSortedResults(
400 "IllegalMonitorStateException[TYPE_REF]{IllegalMonitorStateException, java.lang, Ljava.lang.IllegalMonitorStateException;, null, null, "+this.positions+R_DRICUNR+"}\n" +
401 "InterruptedException[TYPE_REF]{InterruptedException, java.lang, Ljava.lang.InterruptedException;, null, null, "+this.positions+R_DRICUNR+"}"
402 );
403 }
404
test022()405 public void test022() throws JavaModelException {
406 setUpProjectOptions(CompilerOptions.VERSION_1_5);
407 String source =
408 "package javadoc.types.tags;\n" +
409 "/**\n" +
410 " * Completion after:\n" +
411 " * @see java.lang.\n" +
412 " */\n" +
413 "public class BasicTestTypes {\n" +
414 "}\n";
415 completeInJavadoc("/Completion/src/javadoc/types/tags/BasicTestTypes.java", source, true, "java.lang.");
416 assertSortedResults(
417 "java.lang.annotation[PACKAGE_REF]{java.lang.annotation, java.lang.annotation, null, null, null, "+this.positions+R_DRICQNR+"}\n" +
418 "CharSequence[TYPE_REF]{CharSequence, java.lang, Ljava.lang.CharSequence;, null, null, "+this.positions+R_DRICNR+"}\n" +
419 "Class[TYPE_REF]{Class, java.lang, Ljava.lang.Class;, null, null, "+this.positions+R_DRICNR+"}\n" +
420 "CloneNotSupportedException[TYPE_REF]{CloneNotSupportedException, java.lang, Ljava.lang.CloneNotSupportedException;, null, null, "+this.positions+R_DRICNR+"}\n" +
421 "Comparable[TYPE_REF]{Comparable, java.lang, Ljava.lang.Comparable;, null, null, "+this.positions+R_DRICNR+"}\n" +
422 "Deprecated[TYPE_REF]{Deprecated, java.lang, Ljava.lang.Deprecated;, null, null, "+this.positions+R_DRICNR+"}\n" +
423 "Enum[TYPE_REF]{Enum, java.lang, Ljava.lang.Enum;, null, null, "+this.positions+R_DRICNR+"}\n" +
424 "Error[TYPE_REF]{Error, java.lang, Ljava.lang.Error;, null, null, "+this.positions+R_DRICNR+"}\n" +
425 "Exception[TYPE_REF]{Exception, java.lang, Ljava.lang.Exception;, null, null, "+this.positions+R_DRICNR+"}\n" +
426 "IllegalMonitorStateException[TYPE_REF]{IllegalMonitorStateException, java.lang, Ljava.lang.IllegalMonitorStateException;, null, null, "+this.positions+R_DRICNR+"}\n" +
427 "InterruptedException[TYPE_REF]{InterruptedException, java.lang, Ljava.lang.InterruptedException;, null, null, "+this.positions+R_DRICNR+"}\n" +
428 "Object[TYPE_REF]{Object, java.lang, Ljava.lang.Object;, null, null, "+this.positions+R_DRICNR+"}\n" +
429 "RuntimeException[TYPE_REF]{RuntimeException, java.lang, Ljava.lang.RuntimeException;, null, null, "+this.positions+R_DRICNR+"}\n" +
430 "String[TYPE_REF]{String, java.lang, Ljava.lang.String;, null, null, "+this.positions+R_DRICNR+"}\n" +
431 "Throwable[TYPE_REF]{Throwable, java.lang, Ljava.lang.Throwable;, null, null, "+this.positions+R_DRICNR+"}"
432 );
433 }
434
test023()435 public void test023() throws JavaModelException {
436 String source =
437 "package javadoc.types.tags;\n" +
438 "/**\n" +
439 " * Completion after:\n" +
440 " * @see java.\n" +
441 " */\n" +
442 "public class BasicTestTypes {\n" +
443 "}\n";
444 completeInJavadoc("/Completion/src/javadoc/types/tags/BasicTestTypes.java", source, true, "java.");
445 assertResults(
446 "java.lang[PACKAGE_REF]{java.lang, java.lang, null, null, null, "+this.positions+R_DRICQNR+"}\n" +
447 "java.io[PACKAGE_REF]{java.io, java.io, null, null, null, "+this.positions+R_DRICQNR+"}"
448 );
449 }
450
test024()451 public void test024() throws JavaModelException {
452 setUpProjectOptions(CompilerOptions.VERSION_1_5);
453 String source =
454 "package javadoc.types.tags;\n" +
455 "/**\n" +
456 " * Completion after:\n" +
457 " * @see java.lang\n" +
458 " */\n" +
459 "public class BasicTestTypes {\n" +
460 "}\n";
461 completeInJavadoc("/Completion/src/javadoc/types/tags/BasicTestTypes.java", source, true, "java.");
462 assertResults(
463 "java.util[PACKAGE_REF]{java.util, java.util, null, null, null, "+this.positions+R_DRICQNR+"}\n" +
464 "java.lang.annotation[PACKAGE_REF]{java.lang.annotation, java.lang.annotation, null, null, null, "+this.positions+R_DRICQNR+"}\n" +
465 "java.lang[PACKAGE_REF]{java.lang, java.lang, null, null, null, "+this.positions+R_DRICQNR+"}\n" +
466 "java.io[PACKAGE_REF]{java.io, java.io, null, null, null, "+this.positions+R_DRICQNR+"}"
467 );
468 }
469
test025()470 public void test025() throws JavaModelException {
471 String source =
472 "package javadoc.types.tags;\n" +
473 "/**\n" +
474 " * Completion after:\n" +
475 " * @see java.lang.Obj\n" +
476 " */\n" +
477 "public class BasicTestTypes {\n" +
478 "}\n";
479 completeInJavadoc("/Completion/src/javadoc/types/tags/BasicTestTypes.java", source, true, "java.lang.");
480 assertSortedResults(
481 "Class[TYPE_REF]{Class, java.lang, Ljava.lang.Class;, null, null, "+this.positions+R_DRICNR+"}\n" +
482 "CloneNotSupportedException[TYPE_REF]{CloneNotSupportedException, java.lang, Ljava.lang.CloneNotSupportedException;, null, null, "+this.positions+R_DRICNR+"}\n" +
483 "Error[TYPE_REF]{Error, java.lang, Ljava.lang.Error;, null, null, "+this.positions+R_DRICNR+"}\n" +
484 "Exception[TYPE_REF]{Exception, java.lang, Ljava.lang.Exception;, null, null, "+this.positions+R_DRICNR+"}\n" +
485 "IllegalMonitorStateException[TYPE_REF]{IllegalMonitorStateException, java.lang, Ljava.lang.IllegalMonitorStateException;, null, null, "+this.positions+R_DRICNR+"}\n" +
486 "InterruptedException[TYPE_REF]{InterruptedException, java.lang, Ljava.lang.InterruptedException;, null, null, "+this.positions+R_DRICNR+"}\n" +
487 "Object[TYPE_REF]{Object, java.lang, Ljava.lang.Object;, null, null, "+this.positions+R_DRICNR+"}\n" +
488 "RuntimeException[TYPE_REF]{RuntimeException, java.lang, Ljava.lang.RuntimeException;, null, null, "+this.positions+R_DRICNR+"}\n" +
489 "String[TYPE_REF]{String, java.lang, Ljava.lang.String;, null, null, "+this.positions+R_DRICNR+"}\n" +
490 "Throwable[TYPE_REF]{Throwable, java.lang, Ljava.lang.Throwable;, null, null, "+this.positions+R_DRICNR+"}"
491 );
492 }
493
test026()494 public void test026() throws JavaModelException {
495 String source =
496 "package javadoc.types.tags;\n" +
497 "/**\n" +
498 " * Completion after:\n" +
499 " * @see java.lang.Objec\n" +
500 " */\n" +
501 "public class BasicTestTypes {\n" +
502 "}\n";
503 completeInJavadoc("/Completion/src/javadoc/types/tags/BasicTestTypes.java", source, true, "java.lang.Ob");
504 assertResults(
505 "Object[TYPE_REF]{Object, java.lang, Ljava.lang.Object;, null, null, "+this.positions+R_DRICNR+"}"
506 );
507 }
508
509 /**
510 * @category Tests for member types completion
511 */
test030()512 public void test030() throws JavaModelException {
513 String source =
514 "package javadoc.types.tags;\n" +
515 "/**\n" +
516 " * Completion after:\n" +
517 " * @see BasicTestTypesM\n" +
518 " */\n" +
519 "public class BasicTestTypes {\n" +
520 " class BasicTestTypesMember {}\n" +
521 "}\n" +
522 "class BasicTestTypesTestSecondary {}";
523 completeInJavadoc("/Completion/src/javadoc/types/tags/BasicTestTypes.java", source, true, "BasicTestTypesM");
524 assertResults(
525 "BasicTestTypes.BasicTestTypesMember[TYPE_REF]{BasicTestTypesMember, javadoc.types.tags, Ljavadoc.types.tags.BasicTestTypes$BasicTestTypesMember;, null, null, "+this.positions+R_DRICUNR+"}"
526 );
527 }
528
test031()529 public void test031() throws JavaModelException {
530 String source =
531 "package javadoc.types.tags;\n" +
532 "/**\n" +
533 " * Completion after:\n" +
534 " * @see BasicTestTypesMember\n" +
535 " */\n" +
536 "public class BasicTestTypes {\n" +
537 " class BasicTestTypesMember {}\n" +
538 "}\n" +
539 "class BasicTestTypesSecondary {}";
540 completeInJavadoc("/Completion/src/javadoc/types/tags/BasicTestTypes.java", source, true, "BasicTestTypesM");
541 assertResults(
542 "BasicTestTypes.BasicTestTypesMember[TYPE_REF]{BasicTestTypesMember, javadoc.types.tags, Ljavadoc.types.tags.BasicTestTypes$BasicTestTypesMember;, null, null, "+this.positions+R_DRICUNR+"}"
543 );
544 }
545
test032()546 public void test032() throws JavaModelException {
547 String source =
548 "package javadoc.types.tags;\n" +
549 "/**\n" +
550 " * Completion after:\n" +
551 " * @see BasicTestTypes.BasicTestTypesM\n" +
552 " */\n" +
553 "public class BasicTestTypes {\n" +
554 " class BasicTestTypesMember {}\n" +
555 "}\n" +
556 "class BasicTestTypesSecondary {}";
557 completeInJavadoc("/Completion/src/javadoc/types/tags/BasicTestTypes.java", source, true, "BasicTestTypesM");
558 assertResults(
559 "BasicTestTypes.BasicTestTypesMember[TYPE_REF]{BasicTestTypesMember, javadoc.types.tags, Ljavadoc.types.tags.BasicTestTypes$BasicTestTypesMember;, null, null, "+this.positions+R_DRICNR+"}"
560 );
561 }
562
test033()563 public void test033() throws JavaModelException {
564 String source =
565 "package javadoc.types.tags;\n" +
566 "/**\n" +
567 " * Completion after:\n" +
568 " * @see javadoc.types.tags.BasicTestTypes.BasicTestTypesM\n" +
569 " */\n" +
570 "public class BasicTestTypes {\n" +
571 " class BasicTestTypesMember {}\n" +
572 "}\n" +
573 "class BasicTestTypesSecondary {}";
574 completeInJavadoc("/Completion/src/javadoc/types/tags/BasicTestTypes.java", source, true, "BasicTestTypesM");
575 assertResults(
576 "BasicTestTypes.BasicTestTypesMember[TYPE_REF]{BasicTestTypesMember, javadoc.types.tags, Ljavadoc.types.tags.BasicTestTypes$BasicTestTypesMember;, null, null, "+this.positions+R_DRICNR+"}"
577 );
578 }
579
test034()580 public void test034() throws JavaModelException {
581 String source =
582 "package javadoc.types.tags;\n" +
583 "/**\n" +
584 " * Completion after:\n" +
585 " * @see BasicTestTypesS\n" +
586 " */\n" +
587 "public class BasicTestTypes {\n" +
588 "}\n" +
589 "class BasicTestTypesSecondary {}";
590 completeInJavadoc("/Completion/src/javadoc/types/tags/BasicTestTypes.java", source, true, "BasicTestTypesS");
591 assertResults(
592 "BasicTestTypesSecondary[TYPE_REF]{BasicTestTypesSecondary, javadoc.types.tags, Ljavadoc.types.tags.BasicTestTypesSecondary;, null, null, "+this.positions+R_DRICUNR+"}"
593 );
594 }
595
test035()596 public void test035() throws JavaModelException {
597 String source =
598 "package javadoc.types.tags;\n" +
599 "/**\n" +
600 " * Completion after:\n" +
601 " * @see javadoc.types.tags.BasicTestTypesS\n" +
602 " */\n" +
603 "public class BasicTestTypes {\n" +
604 "}\n" +
605 "class BasicTestTypesSecondary {}";
606 completeInJavadoc("/Completion/src/javadoc/types/tags/BasicTestTypes.java", source, true, "javadoc.types.tags.BasicTestTypesS");
607 assertResults(
608 "BasicTestTypesSecondary[TYPE_REF]{BasicTestTypesSecondary, javadoc.types.tags, Ljavadoc.types.tags.BasicTestTypesSecondary;, null, null, "+this.positions+R_DRICNR+"}"
609 );
610 }
611
test036()612 public void test036() throws JavaModelException {
613 String source =
614 "package javadoc.types.tags;\n" +
615 "/**\n" +
616 " * Completion after:\n" +
617 " * @see javadoc.types.tags.BasicTestTypesSecondary\n" +
618 " */\n" +
619 "public class BasicTestTypes {\n" +
620 "}\n" +
621 "class BasicTestTypesSecondary {}";
622 completeInJavadoc("/Completion/src/javadoc/types/tags/BasicTestTypes.java", source, true, "javadoc.types.tags.BasicTestTypesS");
623 assertResults(
624 "BasicTestTypesSecondary[TYPE_REF]{BasicTestTypesSecondary, javadoc.types.tags, Ljavadoc.types.tags.BasicTestTypesSecondary;, null, null, "+this.positions+R_DRICNR+"}"
625 );
626 }
627
test037()628 public void test037() throws JavaModelException {
629 String source =
630 "package javadoc.types.tags;\n" +
631 "/**\n" +
632 " * Completion after:\n" +
633 " * @see javadoc.types.tags.BasicTestTypes.BasicTestTypes\n" +
634 " */\n" +
635 "public class BasicTestTypes {\n" +
636 "}\n" +
637 "class BasicTestTypesSecondary {}";
638 completeInJavadoc("/Completion/src/javadoc/types/tags/BasicTestTypes.java", source, true, "javadoc.types.tags.BasicTestTypes.BasicTestTypes");
639 assertResults("");
640 }
641
642
643 /**
644 * @category Tests for fields completion
645 */
test040()646 public void test040() throws JavaModelException {
647 String source =
648 "package javadoc.types.tags;\n" +
649 "/**\n" +
650 " * Completion after:\n" +
651 " * @see BasicTestReferences#FIE\n" +
652 " * Note: JDT/UI create one proposal on this one\n" +
653 " */\n" +
654 "public class BasicTestTypes {\n" +
655 "}";
656 completeInJavadoc("/Completion/src/javadoc/types/tags/BasicTestTypes.java", source, true, "FIE");
657 assertResults("");
658 }
659
test041()660 public void test041() throws JavaModelException {
661 String source =
662 "package javadoc.types.tags;\n" +
663 "/**\n" +
664 " * Completion after:\n" +
665 " * @see org.eclipse.jdt.core.tests.BasicTestReferences#FIE\n" +
666 " */\n" +
667 "public class BasicTestTypes {\n" +
668 "}";
669 completeInJavadoc("/Completion/src/javadoc/types/tags/BasicTestTypes.java", source, true, "FIE");
670 assertResults(
671 "FIELD[FIELD_REF]{FIELD, Lorg.eclipse.jdt.core.tests.BasicTestReferences;, I, FIELD, null, "+this.positions+R_DRICNR+"}"
672 );
673 }
674
test042()675 public void test042() throws JavaModelException {
676 String source =
677 "package javadoc.types.tags;\n" +
678 "/**\n" +
679 " * Completion after:\n" +
680 " * @see org.eclipse.jdt.core.tests.BasicTestReferences#FIELD\n" +
681 " */\n" +
682 "public class BasicTestTypes {\n" +
683 "}";
684 completeInJavadoc("/Completion/src/javadoc/types/tags/BasicTestTypes.java", source, true, "FIE");
685 assertResults(
686 "FIELD[FIELD_REF]{FIELD, Lorg.eclipse.jdt.core.tests.BasicTestReferences;, I, FIELD, null, "+this.positions+R_DRICNR+"}"
687 );
688 }
689
test043()690 public void test043() throws JavaModelException {
691 String source =
692 "package javadoc.types.tags;\n" +
693 "/**\n" +
694 " * Completion after:\n" +
695 " * @see #fo\n" +
696 " */\n" +
697 "public class BasicTestTypes {\n" +
698 " int foo;\n" +
699 "}";
700 completeInJavadoc("/Completion/src/javadoc/types/tags/BasicTestTypes.java", source, true, "fo");
701 assertResults(
702 "foo[FIELD_REF]{foo, Ljavadoc.types.tags.BasicTestTypes;, I, foo, null, "+this.positions+R_DRICNRNS+"}"
703 );
704 }
705
test044()706 public void test044() throws JavaModelException {
707 String source =
708 "package javadoc.types.tags;\n" +
709 "/**\n" +
710 " * Completion after:\n" +
711 " * @see #foo\n" +
712 " */\n" +
713 "public class BasicTestTypes {\n" +
714 " int foo;\n" +
715 "}";
716 completeInJavadoc("/Completion/src/javadoc/types/tags/BasicTestTypes.java", source, true, "fo");
717 assertResults(
718 "foo[FIELD_REF]{foo, Ljavadoc.types.tags.BasicTestTypes;, I, foo, null, "+this.positions+R_DRICNRNS+"}"
719 );
720 }
721
test045()722 public void test045() throws JavaModelException {
723 String[] sources = {
724 "/Completion/src/javadoc/types/tags/BasicTestTypes.java",
725 "package javadoc.types.tags;\n" +
726 "/**\n" +
727 " * Completion after:\n" +
728 " * @see OtherTypes#fo\n" +
729 " */\n" +
730 "public class BasicTestTypes {\n" +
731 "}",
732 "/Completion/src/javadoc/types/tags/OtherTypes.java",
733 "package javadoc.types.tags;\n" +
734 "public class OtherTypes {\n" +
735 " int foo;\n" +
736 "}"
737 };
738 completeInJavadoc(sources, true, "fo");
739 assertResults(
740 "foo[FIELD_REF]{foo, Ljavadoc.types.tags.OtherTypes;, I, foo, null, "+this.positions+R_DRICNRNS+"}"
741 );
742 }
743
744
745 /**
746 * @category Tests for methods completion
747 */
test050()748 public void test050() throws JavaModelException {
749 String source =
750 "package javadoc.types.tags;\n" +
751 "/**\n" +
752 " * Completion after:\n" +
753 " * @see BasicTestMethod.meth\n" +
754 " * Note that test result may change if bug https://bugs.eclipse.org/bugs/show_bug.cgi?id=26814 was fixed\n" +
755 " */\n" +
756 "public class BasicTestTypes {\n" +
757 " void method() {}\n" +
758 " void paramMethod(String str, int x, Object obj) {}\n" +
759 "}\n";
760 completeInJavadoc("/Completion/src/javadoc/types/tags/BasicTestTypes.java", source, true, "meth");
761 assertResults("");
762 }
763
test051()764 public void test051() throws JavaModelException {
765 String source =
766 "package javadoc.types.tags;\n" +
767 "/**\n" +
768 " * Completion after:\n" +
769 " * @see BasicTestMethod#unknown\n" +
770 " * - completion list shoud be empty\n" +
771 " */\n" +
772 "public class BasicTestTypes {\n" +
773 " void method() {}\n" +
774 " void paramMethod(String str, int x, Object obj) {}\n" +
775 "}\n";
776 completeInJavadoc("/Completion/src/javadoc/types/tags/BasicTestTypes.java", source, true, "unknown");
777 assertResults("");
778 }
779
test052()780 public void test052() throws JavaModelException {
781 String[] sources = {
782 "/Completion/src/javadoc/types/tags/BasicTestTypes.java",
783 "package javadoc.types.tags;\n" +
784 "/**\n" +
785 " * Completion after:\n" +
786 " * @see OtherTypes#meth\n" +
787 " */\n" +
788 "public class BasicTestTypes {\n" +
789 "}",
790 "/Completion/src/javadoc/types/tags/OtherTypes.java",
791 "package javadoc.types.tags;\n" +
792 "public class OtherTypes {\n" +
793 " void method() {};\n" +
794 "}"
795 };
796 completeInJavadoc(sources, true, "meth");
797 assertResults(
798 "method[METHOD_REF]{method(), Ljavadoc.types.tags.OtherTypes;, ()V, method, null, "+this.positions+R_DRICNRNS+"}"
799 );
800 }
801
test053()802 public void test053() throws JavaModelException {
803 String[] sources = {
804 "/Completion/src/javadoc/types/tags/BasicTestTypes.java",
805 "package javadoc.types.tags;\n" +
806 "/**\n" +
807 " * Completion after:\n" +
808 " * @see OtherTypes#method\n" +
809 " */\n" +
810 "public class BasicTestTypes {\n" +
811 "}",
812 "/Completion/src/javadoc/types/tags/OtherTypes.java",
813 "package javadoc.types.tags;\n" +
814 "public class OtherTypes {\n" +
815 " void method() {};\n" +
816 "}"
817 };
818 completeInJavadoc(sources, true, "meth");
819 assertResults(
820 "method[METHOD_REF]{method(), Ljavadoc.types.tags.OtherTypes;, ()V, method, null, "+this.positions+R_DRICNRNS+"}"
821 );
822 }
823
824 /**
825 * @category Tests for type parameters completion
826 */
test060()827 public void test060() throws JavaModelException {
828 setUpProjectOptions(CompilerOptions.VERSION_1_5);
829 String source =
830 "package javadoc.types.tags;\n" +
831 "/**\n" +
832 " * Completion after:\n" +
833 " * @param \n" +
834 " */\n" +
835 "public class BasicTestTypes<TPARAM> {}\n";
836 completeInJavadoc("/Completion/src/javadoc/types/tags/BasicTestTypes.java", source, true, "@param ", 0); // empty token
837 assertResults(
838 "TPARAM[JAVADOC_PARAM_REF]{<TPARAM>, null, null, TPARAM, null, "+this.positions+JAVADOC_RELEVANCE+"}"
839 );
840 }
841
test061()842 public void test061() throws JavaModelException {
843 setUpProjectOptions(CompilerOptions.VERSION_1_5);
844 String source =
845 "package javadoc.types.tags;\n" +
846 "/**\n" +
847 " * Completion after:\n" +
848 " * @param <\n" +
849 " * Note:\n" +
850 " * JDT/UI fails on this one (no proposal)\n" +
851 " */\n" +
852 "public class BasicTestTypes<TPARAM> {}\n";
853 completeInJavadoc("/Completion/src/javadoc/types/tags/BasicTestTypes.java", source, true, "<");
854 assertResults(
855 "TPARAM[JAVADOC_PARAM_REF]{<TPARAM>, null, null, TPARAM, null, "+this.positions+JAVADOC_RELEVANCE+"}"
856 );
857 }
858
test062()859 public void test062() throws JavaModelException {
860 setUpProjectOptions(CompilerOptions.VERSION_1_5);
861 String source =
862 "package javadoc.types.tags;\n" +
863 "/**\n" +
864 " * Completion after:\n" +
865 " * @param <TPA\n" +
866 " * Note:\n" +
867 " * JDT/UI fails on this one (no proposal)\n" +
868 " */\n" +
869 "public class BasicTestTypes<TPARAM> {}\n";
870 completeInJavadoc("/Completion/src/javadoc/types/tags/BasicTestTypes.java", source, true, "<TPA");
871 assertResults(
872 "TPARAM[JAVADOC_PARAM_REF]{<TPARAM>, null, null, TPARAM, null, "+this.positions+JAVADOC_RELEVANCE+"}"
873 );
874 }
875
test063()876 public void test063() throws JavaModelException {
877 setUpProjectOptions(CompilerOptions.VERSION_1_5);
878 String source =
879 "package javadoc.types.tags;\n" +
880 "/**\n" +
881 " * Completion after:\n" +
882 " * @param <TPARAM\n" +
883 " * Note:\n" +
884 " * JDT/UI fails on this one (no proposal)\n" +
885 " */\n" +
886 "public class BasicTestTypes<TPARAM> {}\n";
887 completeInJavadoc("/Completion/src/javadoc/types/tags/BasicTestTypes.java", source, true, "<TPA");
888 assertResults(
889 "TPARAM[JAVADOC_PARAM_REF]{<TPARAM>, null, null, TPARAM, null, "+this.positions+JAVADOC_RELEVANCE+"}"
890 );
891 }
892
test064()893 public void test064() throws JavaModelException {
894 setUpProjectOptions(CompilerOptions.VERSION_1_5);
895 String source =
896 "package javadoc.types.tags;\n" +
897 "/**\n" +
898 " * Completion after:\n" +
899 " * @param <TPARAM\n" +
900 " * Note:\n" +
901 " * JDT/UI fails on this one (no proposal)\n" +
902 " */\n" +
903 "public class BasicTestTypes<TPARAM> {}\n";
904 completeInJavadoc("/Completion/src/javadoc/types/tags/BasicTestTypes.java", source, true, "<TPARAM");
905 assertResults(
906 "TPARAM[JAVADOC_PARAM_REF]{<TPARAM>, null, null, TPARAM, null, "+this.positions+JAVADOC_RELEVANCE+"}"
907 );
908 }
909
test065()910 public void test065() throws JavaModelException {
911 setUpProjectOptions(CompilerOptions.VERSION_1_5);
912 String source =
913 "package javadoc.types.tags;\n" +
914 "/**\n" +
915 " * Completion after:\n" +
916 " * @param <TPARAM>\n" +
917 " * Note:\n" +
918 " * JDT/UI fails on this one (no proposal)\n" +
919 " */\n" +
920 "public class BasicTestTypes<TPARAM> {}\n";
921 completeInJavadoc("/Completion/src/javadoc/types/tags/BasicTestTypes.java", source, true, "<TPARAM");
922 assertResults(
923 "TPARAM[JAVADOC_PARAM_REF]{<TPARAM>, null, null, TPARAM, null, "+this.positions+JAVADOC_RELEVANCE+"}"
924 );
925 }
926
test066()927 public void test066() throws JavaModelException {
928 setUpProjectOptions(CompilerOptions.VERSION_1_5);
929 String source =
930 "package javadoc.types.tags;\n" +
931 "/**\n" +
932 " * Completion after:\n" +
933 " * @param <TPARAM>\n" +
934 " * Note:\n" +
935 " * JDT/UI fails on this one (no proposal)\n" +
936 " */\n" +
937 "public class BasicTestTypes<TPARAM> {}\n";
938 completeInJavadoc("/Completion/src/javadoc/types/tags/BasicTestTypes.java", source, true, "<TPARAM>");
939 assertResults(
940 "TPARAM[JAVADOC_PARAM_REF]{<TPARAM>, null, null, TPARAM, null, "+this.positions+JAVADOC_RELEVANCE+"}"
941 );
942 }
943
test067()944 public void test067() throws JavaModelException {
945 setUpProjectOptions(CompilerOptions.VERSION_1_5);
946 String source =
947 "package javadoc.types.tags;\n" +
948 "/**\n" +
949 " * Completion after:\n" +
950 " * @param <T1>\n" +
951 " * @param <T1>\n" +
952 " */\n" +
953 "public class BasicTestTypes<T1, T2, T3> {}\n";
954 completeInJavadoc("/Completion/src/javadoc/types/tags/BasicTestTypes.java", source, true, "<T1>");
955 assertResults("");
956 }
957
test068()958 public void test068() throws JavaModelException {
959 setUpProjectOptions(CompilerOptions.VERSION_1_5);
960 String source =
961 "package javadoc.types.tags;\n" +
962 "/**\n" +
963 " * Completion after:\n" +
964 " * @param <T1>\n" +
965 " * @param <T1>\n" +
966 " */\n" +
967 "public class BasicTestTypes<T1, T2, T3> {}\n";
968 completeInJavadoc("/Completion/src/javadoc/types/tags/BasicTestTypes.java", source, true, "<T1>", 2); //2nd position
969 assertResults("");
970 }
971
test069()972 public void test069() throws JavaModelException {
973 setUpProjectOptions(CompilerOptions.VERSION_1_5);
974 String source =
975 "package javadoc.types.tags;\n" +
976 "/**\n" +
977 " * Completion after:\n" +
978 " * @param <T1>\n" +
979 " ** @param \n" +
980 " * @param <T3>\n" +
981 " */\n" +
982 "public class BasicTestTypes<T1, T2, T3> {}\n";
983 completeInJavadoc("/Completion/src/javadoc/types/tags/BasicTestTypes.java", source, true, "** @param ", 0); // empty token
984 assertResults(
985 "T2[JAVADOC_PARAM_REF]{<T2>, null, null, T2, null, "+this.positions+JAVADOC_RELEVANCE+"}"
986 );
987 }
988
test070()989 public void test070() throws JavaModelException {
990 setUpProjectOptions(CompilerOptions.VERSION_1_5);
991 String source =
992 "package javadoc.types.tags;\n" +
993 "/**\n" +
994 " * Completion after:\n" +
995 " * @param <T1>\n" +
996 " * @param <T2>\n" +
997 " * @param <T3>\n" +
998 " */\n" +
999 "public class BasicTestTypes<T1, T2, T3> {}\n";
1000 completeInJavadoc("/Completion/src/javadoc/types/tags/BasicTestTypes.java", source, true, "<T", 3); // 3rd position
1001 assertResults(
1002 "T3[JAVADOC_PARAM_REF]{<T3>, null, null, T3, null, "+this.positions+JAVADOC_RELEVANCE+"}"
1003 );
1004 }
1005
test071()1006 public void test071() throws JavaModelException {
1007 setUpProjectOptions(CompilerOptions.VERSION_1_5);
1008 String source =
1009 "package javadoc.types.tags;\n" +
1010 "/**\n" +
1011 " * Completion after:\n" +
1012 " * @param <T1>\n" +
1013 " * @param <T2>\n" +
1014 " * @param <T3>\n" +
1015 " ** @param \n" +
1016 " */\n" +
1017 "public class BasicTestTypes<T1, T2, T3> {}\n";
1018 completeInJavadoc("/Completion/src/javadoc/types/tags/BasicTestTypes.java", source, true, "** @param ", 0); // empty token
1019 assertResults("");
1020 }
1021
1022 /**
1023 * @tests Tests for camel case completion
1024 */
test080()1025 public void test080() throws JavaModelException {
1026 this.oldOptions = JavaCore.getOptions();
1027 try {
1028 Hashtable options = new Hashtable(this.oldOptions);
1029 options.put(JavaCore.CODEASSIST_CAMEL_CASE_MATCH, JavaCore.ENABLED);
1030 JavaCore.setOptions(options);
1031
1032 String source =
1033 "package javadoc.types.tags;\n" +
1034 "/**\n" +
1035 " * Completion after:\n" +
1036 " * @see BTT\n" +
1037 " */\n" +
1038 "public class BasicTestTypes {}\n";
1039 completeInJavadoc("/Completion/src/javadoc/types/tags/BasicTestTypes.java", source, true, "BTT");
1040 assertResults("BasicTestTypes[TYPE_REF]{BasicTestTypes, javadoc.types.tags, Ljavadoc.types.tags.BasicTestTypes;, null, null, "+this.positions+ (R_DEFAULT + 17) +"}");
1041 } finally {
1042 JavaCore.setOptions(this.oldOptions);
1043 }
1044 }
1045 /**
1046 * @category Tests for filtered completion
1047 */
test100()1048 public void test100() throws JavaModelException {
1049 String source =
1050 "package javadoc.types;\n" +
1051 "/**\n" +
1052 " * Completion after:\n" +
1053 " * bla ZBasi bla\n" +
1054 " */\n" +
1055 "public class ZBasicTestTypes {}\n";
1056 completeInJavadoc(
1057 "/Completion/src/javadoc/types/ZBasicTestTypes.java",
1058 source,
1059 true,
1060 "ZBasi",
1061 1,
1062 new int[]{});
1063 assertResults(
1064 "ZBasicTestTypes[TYPE_REF]{ZBasicTestTypes, javadoc.types, Ljavadoc.types.ZBasicTestTypes;, null, null, "+this.positions+R_DRICUNR+"}\n" +
1065 "ZBasicTestTypes[JAVADOC_TYPE_REF]{{@link ZBasicTestTypes}, javadoc.types, Ljavadoc.types.ZBasicTestTypes;, null, null, "+this.positions+R_DRICUNRIT+"}"
1066 );
1067 }
test101()1068 public void test101() throws JavaModelException {
1069 String source =
1070 "package javadoc.types;\n" +
1071 "/**\n" +
1072 " * Completion after:\n" +
1073 " * bla ZBasi bla\n" +
1074 " */\n" +
1075 "public class ZBasicTestTypes {}\n";
1076 completeInJavadoc(
1077 "/Completion/src/javadoc/types/ZBasicTestTypes.java",
1078 source,
1079 true,
1080 "ZBasi",
1081 1,
1082 new int[]{CompletionProposal.JAVADOC_TYPE_REF});
1083 assertResults(
1084 "ZBasicTestTypes[TYPE_REF]{ZBasicTestTypes, javadoc.types, Ljavadoc.types.ZBasicTestTypes;, null, null, "+this.positions+R_DRICUNR+"}"
1085 );
1086 }
test102()1087 public void test102() throws JavaModelException {
1088 String source =
1089 "package javadoc.types;\n" +
1090 "/**\n" +
1091 " * Completion after:\n" +
1092 " * bla ZBasi bla\n" +
1093 " */\n" +
1094 "public class ZBasicTestTypes {}\n";
1095 completeInJavadoc(
1096 "/Completion/src/javadoc/types/ZBasicTestTypes.java",
1097 source,
1098 true,
1099 "ZBasi",
1100 1,
1101 new int[]{CompletionProposal.TYPE_REF});
1102 assertResults(
1103 "ZBasicTestTypes[JAVADOC_TYPE_REF]{{@link ZBasicTestTypes}, javadoc.types, Ljavadoc.types.ZBasicTestTypes;, null, null, "+this.positions+R_DRICUNRIT+"}"
1104 );
1105 }
test103()1106 public void test103() throws JavaModelException {
1107 String source =
1108 "package javadoc.types;\n" +
1109 "/**\n" +
1110 " * Completion after:\n" +
1111 " * bla ZBasicTestTypes#fo bla\n" +
1112 " */\n" +
1113 "public class ZBasicTestTypes {\n" +
1114 " public void foo() {}\n" +
1115 "}\n";
1116 completeInJavadoc(
1117 "/Completion/src/javadoc/types/ZBasicTestTypes.java",
1118 source,
1119 true,
1120 "ZBasicTestTypes#fo",
1121 1,
1122 new int[]{});
1123 assertResults(
1124 "foo[JAVADOC_METHOD_REF]{{@link ZBasicTestTypes#foo()}, Ljavadoc.types.ZBasicTestTypes;, ()V, foo, null, "+this.positions+R_DRICNRNSIT+"}"
1125 );
1126 }
test104()1127 public void test104() throws JavaModelException {
1128 String source =
1129 "package javadoc.types;\n" +
1130 "/**\n" +
1131 " * Completion after:\n" +
1132 " * bla ZBasicTestTypes#fo bla\n" +
1133 " */\n" +
1134 "public class ZBasicTestTypes {\n" +
1135 " public void foo() {}\n" +
1136 "}\n";
1137 completeInJavadoc(
1138 "/Completion/src/javadoc/types/ZBasicTestTypes.java",
1139 source,
1140 true,
1141 "ZBasicTestTypes#fo",
1142 1,
1143 new int[]{CompletionProposal.JAVADOC_METHOD_REF});
1144 assertResults(
1145 ""
1146 );
1147 }
test105()1148 public void test105() throws JavaModelException {
1149 String source =
1150 "package javadoc.types;\n" +
1151 "/**\n" +
1152 " * Completion after:\n" +
1153 " * bla ZBasicTestTypes#fo bla\n" +
1154 " */\n" +
1155 "public class ZBasicTestTypes {\n" +
1156 " public void foo() {}\n" +
1157 "}\n";
1158 completeInJavadoc(
1159 "/Completion/src/javadoc/types/ZBasicTestTypes.java",
1160 source,
1161 true,
1162 "ZBasicTestTypes#fo",
1163 1,
1164 new int[]{CompletionProposal.METHOD_REF});
1165 assertResults(
1166 "foo[JAVADOC_METHOD_REF]{{@link ZBasicTestTypes#foo()}, Ljavadoc.types.ZBasicTestTypes;, ()V, foo, null, "+this.positions+R_DRICNRNSIT+"}"
1167 );
1168 }
test106()1169 public void test106() throws JavaModelException {
1170 String source =
1171 "package javadoc.types;\n" +
1172 "/**\n" +
1173 " * Completion after:\n" +
1174 " * bla ZBasicTestTypes#fo bla\n" +
1175 " */\n" +
1176 "public class ZBasicTestTypes {\n" +
1177 " public int foo;\n" +
1178 "}\n";
1179 completeInJavadoc(
1180 "/Completion/src/javadoc/types/ZBasicTestTypes.java",
1181 source,
1182 true,
1183 "ZBasicTestTypes#fo",
1184 1,
1185 new int[]{});
1186 assertResults(
1187 "foo[JAVADOC_FIELD_REF]{{@link ZBasicTestTypes#foo}, Ljavadoc.types.ZBasicTestTypes;, I, foo, null, "+this.positions+R_DRICNRNSIT+"}"
1188 );
1189 }
test107()1190 public void test107() throws JavaModelException {
1191 String source =
1192 "package javadoc.types;\n" +
1193 "/**\n" +
1194 " * Completion after:\n" +
1195 " * bla ZBasicTestTypes#fo bla\n" +
1196 " */\n" +
1197 "public class ZBasicTestTypes {\n" +
1198 " public int foo;\n" +
1199 "}\n";
1200 completeInJavadoc(
1201 "/Completion/src/javadoc/types/ZBasicTestTypes.java",
1202 source,
1203 true,
1204 "ZBasicTestTypes#fo",
1205 1,
1206 new int[]{CompletionProposal.JAVADOC_FIELD_REF});
1207 assertResults(
1208 ""
1209 );
1210 }
test108()1211 public void test108() throws JavaModelException {
1212 String source =
1213 "package javadoc.types;\n" +
1214 "/**\n" +
1215 " * Completion after:\n" +
1216 " * bla ZBasicTestTypes#fo bla\n" +
1217 " */\n" +
1218 "public class ZBasicTestTypes {\n" +
1219 " public int foo;\n" +
1220 "}\n";
1221 completeInJavadoc(
1222 "/Completion/src/javadoc/types/ZBasicTestTypes.java",
1223 source,
1224 true,
1225 "ZBasicTestTypes#fo",
1226 1,
1227 new int[]{CompletionProposal.FIELD_REF});
1228 assertResults(
1229 "foo[JAVADOC_FIELD_REF]{{@link ZBasicTestTypes#foo}, Ljavadoc.types.ZBasicTestTypes;, I, foo, null, "+this.positions+R_DRICNRNSIT+"}"
1230 );
1231 }
test109()1232 public void test109() throws JavaModelException {
1233 String source =
1234 "package javadoc.types;\n" +
1235 "/**\n" +
1236 " * Completion after:\n" +
1237 " * bla javadoc.types.ZBasi bla\n" +
1238 " */\n" +
1239 "public class ZBasicTestTypes {}\n";
1240 completeInJavadoc(
1241 "/Completion/src/javadoc/types/ZBasicTestTypes.java",
1242 source,
1243 true,
1244 "javadoc.types.ZBasi",
1245 1,
1246 new int[]{});
1247 assertResults(
1248 "ZBasicTestTypes[TYPE_REF]{ZBasicTestTypes, javadoc.types, Ljavadoc.types.ZBasicTestTypes;, null, null, "+this.positions+R_DRICNR+"}\n" +
1249 "ZBasicTestTypes[JAVADOC_TYPE_REF]{{@link ZBasicTestTypes}, javadoc.types, Ljavadoc.types.ZBasicTestTypes;, null, null, "+this.positions+R_DRICNRIT+"}"
1250 );
1251 }
test110()1252 public void test110() throws JavaModelException {
1253 String source =
1254 "package javadoc.types;\n" +
1255 "/**\n" +
1256 " * Completion after:\n" +
1257 " * bla javadoc.types.ZBasi bla\n" +
1258 " */\n" +
1259 "public class ZBasicTestTypes {}\n";
1260 completeInJavadoc(
1261 "/Completion/src/javadoc/types/ZBasicTestTypes.java",
1262 source,
1263 true,
1264 "javadoc.types.ZBasi",
1265 1,
1266 new int[]{CompletionProposal.JAVADOC_TYPE_REF});
1267 assertResults(
1268 "ZBasicTestTypes[TYPE_REF]{ZBasicTestTypes, javadoc.types, Ljavadoc.types.ZBasicTestTypes;, null, null, "+this.positions+R_DRICNR+"}"
1269 );
1270 }
test111()1271 public void test111() throws JavaModelException {
1272 String source =
1273 "package javadoc.types;\n" +
1274 "/**\n" +
1275 " * Completion after:\n" +
1276 " * bla javadoc.types.ZBasi bla\n" +
1277 " */\n" +
1278 "public class ZBasicTestTypes {}\n";
1279 completeInJavadoc(
1280 "/Completion/src/javadoc/types/ZBasicTestTypes.java",
1281 source,
1282 true,
1283 "javadoc.types.ZBasi",
1284 1,
1285 new int[]{CompletionProposal.TYPE_REF});
1286 assertResults(
1287 "ZBasicTestTypes[JAVADOC_TYPE_REF]{{@link ZBasicTestTypes}, javadoc.types, Ljavadoc.types.ZBasicTestTypes;, null, null, "+this.positions+R_DRICNRIT+"}"
1288 );
1289 }
test112()1290 public void test112() throws JavaModelException {
1291 String source =
1292 "package javadoc.types;\n" +
1293 "/**\n" +
1294 " * Completion after:\n" +
1295 " * bla javadoc.types.ZBasicTestTypes.Inn bla\n" +
1296 " */\n" +
1297 "public class ZBasicTestTypes {\n" +
1298 " public class Inner {}\n" +
1299 "}\n";
1300 completeInJavadoc(
1301 "/Completion/src/javadoc/types/ZBasicTestTypes.java",
1302 source,
1303 true,
1304 "javadoc.types.ZBasicTestTypes.Inn",
1305 1,
1306 new int[]{});
1307 assertResults(
1308 "ZBasicTestTypes.Inner[TYPE_REF]{Inner, javadoc.types, Ljavadoc.types.ZBasicTestTypes$Inner;, null, null, "+this.positions+R_DRICNR+"}\n" +
1309 "ZBasicTestTypes.Inner[JAVADOC_TYPE_REF]{{@link Inner}, javadoc.types, Ljavadoc.types.ZBasicTestTypes$Inner;, null, null, "+this.positions+R_DRICNRIT+"}"
1310 );
1311 }
test113()1312 public void test113() throws JavaModelException {
1313 String source =
1314 "package javadoc.types;\n" +
1315 "/**\n" +
1316 " * Completion after:\n" +
1317 " * bla javadoc.types.ZBasicTestTypes.Inn bla\n" +
1318 " */\n" +
1319 "public class ZBasicTestTypes {\n" +
1320 " public class Inner {}\n" +
1321 "}\n";
1322 completeInJavadoc(
1323 "/Completion/src/javadoc/types/ZBasicTestTypes.java",
1324 source,
1325 true,
1326 "javadoc.types.ZBasicTestTypes.Inn",
1327 1,
1328 new int[]{CompletionProposal.JAVADOC_TYPE_REF});
1329 assertResults(
1330 "ZBasicTestTypes.Inner[TYPE_REF]{Inner, javadoc.types, Ljavadoc.types.ZBasicTestTypes$Inner;, null, null, "+this.positions+R_DRICNR+"}"
1331 );
1332 }
test114()1333 public void test114() throws JavaModelException {
1334 String source =
1335 "package javadoc.types;\n" +
1336 "/**\n" +
1337 " * Completion after:\n" +
1338 " * bla javadoc.types.ZBasicTestTypes.Inn bla\n" +
1339 " */\n" +
1340 "public class ZBasicTestTypes {\n" +
1341 " public class Inner {}\n" +
1342 "}\n";
1343 completeInJavadoc(
1344 "/Completion/src/javadoc/types/ZBasicTestTypes.java",
1345 source,
1346 true,
1347 "javadoc.types.ZBasicTestTypes.Inn",
1348 1,
1349 new int[]{CompletionProposal.TYPE_REF});
1350 assertResults(
1351 "ZBasicTestTypes.Inner[JAVADOC_TYPE_REF]{{@link Inner}, javadoc.types, Ljavadoc.types.ZBasicTestTypes$Inner;, null, null, "+this.positions+R_DRICNRIT+"}"
1352 );
1353 }
1354 }
1355