Lines 1-5
Link Here
|
1 |
/******************************************************************************* |
1 |
/******************************************************************************* |
2 |
* Copyright (c) 2000, 2008 IBM Corporation and others. |
2 |
* Copyright (c) 2000, 2011 IBM Corporation and others. |
3 |
* All rights reserved. This program and the accompanying materials |
3 |
* All rights reserved. This program and the accompanying materials |
4 |
* are made available under the terms of the Eclipse Public License v1.0 |
4 |
* are made available under the terms of the Eclipse Public License v1.0 |
5 |
* which accompanies this distribution, and is available at |
5 |
* which accompanies this distribution, and is available at |
Lines 10-21
Link Here
|
10 |
*******************************************************************************/ |
10 |
*******************************************************************************/ |
11 |
package org.eclipse.jdt.core.tests.model; |
11 |
package org.eclipse.jdt.core.tests.model; |
12 |
|
12 |
|
13 |
import org.eclipse.core.runtime.CoreException; |
13 |
import java.io.IOException; |
14 |
import org.eclipse.jdt.core.*; |
14 |
import java.util.HashMap; |
15 |
import org.eclipse.jdt.core.tests.util.Util; |
15 |
import java.util.Map; |
16 |
|
16 |
|
17 |
import junit.framework.Test; |
17 |
import junit.framework.Test; |
18 |
|
18 |
|
|
|
19 |
import org.eclipse.core.runtime.CoreException; |
20 |
import org.eclipse.jdt.core.Flags; |
21 |
import org.eclipse.jdt.core.IAnnotation; |
22 |
import org.eclipse.jdt.core.ICodeAssist; |
23 |
import org.eclipse.jdt.core.ICompilationUnit; |
24 |
import org.eclipse.jdt.core.IJavaElement; |
25 |
import org.eclipse.jdt.core.IJavaProject; |
26 |
import org.eclipse.jdt.core.ILocalVariable; |
27 |
import org.eclipse.jdt.core.IMemberValuePair; |
28 |
import org.eclipse.jdt.core.IMethod; |
29 |
import org.eclipse.jdt.core.IPackageFragmentRoot; |
30 |
import org.eclipse.jdt.core.ISourceRange; |
31 |
import org.eclipse.jdt.core.IType; |
32 |
import org.eclipse.jdt.core.JavaCore; |
33 |
import org.eclipse.jdt.core.JavaModelException; |
34 |
import org.eclipse.jdt.core.tests.util.Util; |
35 |
import org.eclipse.jdt.internal.core.LocalVariable; |
36 |
|
19 |
public class TypeResolveTests extends ModifyingResourceTests { |
37 |
public class TypeResolveTests extends ModifyingResourceTests { |
20 |
ICompilationUnit cu; |
38 |
ICompilationUnit cu; |
21 |
public TypeResolveTests(String name) { |
39 |
public TypeResolveTests(String name) { |
Lines 95-101
Link Here
|
95 |
} |
113 |
} |
96 |
static { |
114 |
static { |
97 |
// TESTS_NUMBERS = new int[] { 182, 183 }; |
115 |
// TESTS_NUMBERS = new int[] { 182, 183 }; |
98 |
// TESTS_NAMES = new String[] {"test0177"}; |
116 |
// TESTS_NAMES = new String[] { "testParamAnnotations4" }; |
99 |
} |
117 |
} |
100 |
public static Test suite() { |
118 |
public static Test suite() { |
101 |
return buildModelTestSuite(TypeResolveTests.class); |
119 |
return buildModelTestSuite(TypeResolveTests.class); |
Lines 299-302
Link Here
|
299 |
"p4.A.Inner", |
317 |
"p4.A.Inner", |
300 |
types); |
318 |
types); |
301 |
} |
319 |
} |
|
|
320 |
/** |
321 |
* @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=334783" |
322 |
*/ |
323 |
public void testParamAnnotations() throws CoreException { |
324 |
try { |
325 |
createJavaProject("P", new String[] {"src"}, new String[] {"JCL15_LIB"}, "bin", "1.5"); |
326 |
String source = "package p;\n" + |
327 |
"public class X<T> {\n" + |
328 |
" X<String> field;\n" + |
329 |
" @Inject\n" + |
330 |
" public void Test(@Default String processor) {}\n" + |
331 |
"}" + |
332 |
"@interface Inject{\n" + |
333 |
"}" + |
334 |
"@interface Default{\n" + |
335 |
"}"; |
336 |
createFolder("/P/src/p"); |
337 |
createFile( |
338 |
"/P/src/p/X.java", |
339 |
source |
340 |
); |
341 |
waitForAutoBuild(); |
342 |
|
343 |
ICompilationUnit unit = getCompilationUnit("/P/src/p/X.java"); |
344 |
IJavaElement[] variable = ((ICodeAssist) unit).codeSelect(source.indexOf("processor"), "processor".length()); |
345 |
|
346 |
assertEquals(1, variable.length); |
347 |
String annotationString = "@Default [in processor [in Test(String) [in X [in X.java [in p [in src [in P]]]]]]]"; |
348 |
assertEquals(annotationString, ((LocalVariable)variable[0]).getAnnotations()[0].toString()); |
349 |
IType type = unit.getType("X"); |
350 |
|
351 |
IMethod method = type.getMethods()[0]; |
352 |
assertEquals(annotationString, method.getParameters()[0].getAnnotations()[0].toString()); |
353 |
} finally { |
354 |
deleteProject("P"); |
355 |
} |
356 |
} |
357 |
/** |
358 |
* @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=334783" |
359 |
*/ |
360 |
public void testParamAnnotations2() throws CoreException, IOException { |
361 |
try { |
362 |
IJavaProject project = createJavaProject("P", new String[] {"src"}, new String[] {"JCL15_LIB"}, "bin", "1.5"); |
363 |
String[] pathAndContents = new String[]{"p/X.java", |
364 |
"package p;\n" + |
365 |
"public class X<T> {\n" + |
366 |
" X<String> field;\n" + |
367 |
" @Inject\n" + |
368 |
" public void Test(@Default String processor) {}\n" + |
369 |
"}" + |
370 |
"@interface Inject{\n" + |
371 |
"}" + |
372 |
"@interface Default{\n" + |
373 |
"}"}; |
374 |
addLibrary(project, "lib334783.jar", "libsrc.zip", pathAndContents, JavaCore.VERSION_1_5); |
375 |
|
376 |
waitForAutoBuild(); |
377 |
IPackageFragmentRoot root = project.getPackageFragmentRoot(getFile("/P/lib334783.jar")); |
378 |
IType type = root.getPackageFragment("p").getClassFile("X.class").getType(); |
379 |
String annotationString = "@p.Default [in processor [in Test(java.lang.String) [in X [in X.class [in p [in lib334783.jar [in P]]]]]]]"; |
380 |
|
381 |
IMethod method = type.getMethods()[1]; |
382 |
assertEquals(annotationString, method.getParameters()[0].getAnnotations()[0].toString()); |
383 |
} finally { |
384 |
deleteProject("P"); |
385 |
} |
386 |
} |
387 |
/** |
388 |
* @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=334783" |
389 |
*/ |
390 |
public void testParamAnnotations3() throws CoreException { |
391 |
try { |
392 |
createJavaProject("P", new String[] {"src"}, new String[] {"JCL15_LIB"}, "bin", "1.5"); |
393 |
String source = "package p;\n" + |
394 |
"public class X<T> {\n" + |
395 |
" X<String> field;\n" + |
396 |
" @Inject\n" + |
397 |
" public void Test(int i, @Default @Marker(id=1) String processor, int k) {}\n" + |
398 |
"}\n" + |
399 |
"@interface Inject{\n" + |
400 |
"}\n" + |
401 |
"@interface Marker {\n" + |
402 |
" int id() default 0;\n" + |
403 |
"}\n" + |
404 |
"@interface Default{\n" + |
405 |
"}"; |
406 |
createFolder("/P/src/p"); |
407 |
createFile( |
408 |
"/P/src/p/X.java", |
409 |
source |
410 |
); |
411 |
waitForAutoBuild(); |
412 |
|
413 |
ICompilationUnit unit = getCompilationUnit("/P/src/p/X.java"); |
414 |
IJavaElement[] variable = ((ICodeAssist) unit).codeSelect(source.indexOf("processor"), "processor".length()); |
415 |
|
416 |
assertEquals(1, variable.length); |
417 |
String annotationString1 = "@Default [in processor [in Test(int, String, int) [in X [in X.java [in p [in src [in P]]]]]]]"; |
418 |
String annotationString2 = "@Marker [in processor [in Test(int, String, int) [in X [in X.java [in p [in src [in P]]]]]]]"; |
419 |
assertEquals(annotationString1, ((LocalVariable)variable[0]).getAnnotations()[0].toString()); |
420 |
IType type = unit.getType("X"); |
421 |
|
422 |
IMethod method = type.getMethods()[0]; |
423 |
IAnnotation[] parameterAnnotations = method.getParameters()[1].getAnnotations(); |
424 |
assertEquals("Wrong length", 2, parameterAnnotations.length); |
425 |
assertEquals(annotationString1, parameterAnnotations[0].toString()); |
426 |
IAnnotation iAnnotation = parameterAnnotations[1]; |
427 |
assertEquals(annotationString2, iAnnotation.toString()); |
428 |
IMemberValuePair[] memberValuePairs = iAnnotation.getMemberValuePairs(); |
429 |
assertEquals("Wrong number of pairs", 1, memberValuePairs.length); |
430 |
StringBuffer output = new StringBuffer(); |
431 |
output.append(memberValuePairs[0].getMemberName()); |
432 |
output.append(' '); |
433 |
output.append(memberValuePairs[0].getValue()); |
434 |
assertEquals("Wrong value", "id 1", String.valueOf(output)); |
435 |
assertEquals("Wrong length", 0, method.getParameters()[0].getAnnotations().length); |
436 |
assertEquals("Wrong length", 0, method.getParameters()[2].getAnnotations().length); |
437 |
} finally { |
438 |
deleteProject("P"); |
439 |
} |
440 |
} |
441 |
/** |
442 |
* @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=334783" |
443 |
*/ |
444 |
public void testParamAnnotations4() throws CoreException, IOException { |
445 |
try { |
446 |
IJavaProject project = createJavaProject("P", new String[] {"src"}, new String[] {"JCL15_LIB"}, "bin", "1.5"); |
447 |
String sourceX = |
448 |
"package p;\n" + |
449 |
"public class X<T> {\n" + |
450 |
" X<String> field;\n" + |
451 |
" @Inject @Marker(id=3)\n" + |
452 |
" public void Test(final int i, @Default final @Marker(id=1) String processor, int k) {}\n" + |
453 |
"}"; |
454 |
String[] pathAndContents = new String[]{"p/X.java", |
455 |
sourceX, |
456 |
"p/Inject.java", |
457 |
"package p;\n"+ |
458 |
"public @interface Inject{\n" + |
459 |
"}", |
460 |
"p/Marker.java", |
461 |
"package p;\n" + |
462 |
"public @interface Marker {\n" + |
463 |
" int id() default 0;\n" + |
464 |
"}", |
465 |
"p/Default.java", |
466 |
"package p;\n" + |
467 |
"public @interface Default{\n" + |
468 |
"}"}; |
469 |
addLibrary(project, "lib334783_2.jar", "lib334783_2src.zip", pathAndContents, JavaCore.VERSION_1_5); |
470 |
|
471 |
waitForAutoBuild(); |
472 |
IPackageFragmentRoot root = project.getPackageFragmentRoot(getFile("/P/lib334783_2.jar")); |
473 |
IType type = root.getPackageFragment("p").getClassFile("X.class").getType(); |
474 |
String annotationString1 = "@p.Default [in processor [in Test(int, java.lang.String, int) [in X [in X.class [in p [in lib334783_2.jar [in P]]]]]]]"; |
475 |
String annotationString2 = "@p.Marker [in processor [in Test(int, java.lang.String, int) [in X [in X.class [in p [in lib334783_2.jar [in P]]]]]]]"; |
476 |
IMethod method = type.getMethods()[1]; |
477 |
IAnnotation[] annotations = method.getAnnotations(); |
478 |
assertEquals("Wrong length", 2, annotations.length); |
479 |
assertEquals("@p.Inject [in Test(int, java.lang.String, int) [in X [in X.class [in p [in lib334783_2.jar [in P]]]]]]", annotations[0].toString()); |
480 |
IAnnotation annotation = annotations[1]; |
481 |
assertEquals("@p.Marker [in Test(int, java.lang.String, int) [in X [in X.class [in p [in lib334783_2.jar [in P]]]]]]", annotation.toString()); |
482 |
IMemberValuePair[] memberValuePairs = annotation.getMemberValuePairs(); |
483 |
assertEquals("Wrong number of pairs", 1, memberValuePairs.length); |
484 |
StringBuffer output = new StringBuffer(); |
485 |
output.append(memberValuePairs[0].getMemberName()); |
486 |
output.append(' '); |
487 |
output.append(memberValuePairs[0].getValue()); |
488 |
assertEquals("Wrong value", "id 3", String.valueOf(output)); |
489 |
ILocalVariable localVariable = method.getParameters()[1]; |
490 |
ISourceRange sourceRange = localVariable.getSourceRange(); |
491 |
String localSource = sourceX.substring( |
492 |
sourceRange.getOffset(), |
493 |
sourceRange.getOffset() + sourceRange.getLength()); |
494 |
assertEquals("Wrong source", "@Default final @Marker(id=1) String processor", localSource); |
495 |
assertTrue("Wrong modifiers", Flags.isFinal(localVariable.getFlags())); |
496 |
IAnnotation[] parameterAnnotations = localVariable.getAnnotations(); |
497 |
assertEquals("Wrong length", 2, parameterAnnotations.length); |
498 |
assertEquals(annotationString1, parameterAnnotations[0].toString()); |
499 |
annotation = parameterAnnotations[1]; |
500 |
assertEquals(annotationString2, annotation.toString()); |
501 |
memberValuePairs = annotation.getMemberValuePairs(); |
502 |
assertEquals("Wrong number of pairs", 1, memberValuePairs.length); |
503 |
output = new StringBuffer(); |
504 |
output.append(memberValuePairs[0].getMemberName()); |
505 |
output.append(' '); |
506 |
output.append(memberValuePairs[0].getValue()); |
507 |
assertEquals("Wrong value", "id 1", String.valueOf(output)); |
508 |
localVariable = method.getParameters()[0]; |
509 |
assertEquals("Wrong length", 0, localVariable.getAnnotations().length); |
510 |
assertTrue("Wrong modifiers", Flags.isFinal(localVariable.getFlags())); |
511 |
assertEquals("Wrong length", 0, method.getParameters()[2].getAnnotations().length); |
512 |
} finally { |
513 |
deleteProject("P"); |
514 |
} |
515 |
} |
516 |
/** |
517 |
* @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=334783" |
518 |
*/ |
519 |
public void testParamAnnotations5() throws CoreException, IOException { |
520 |
try { |
521 |
IJavaProject project = createJavaProject("P", new String[] {"src"}, new String[] {"JCL15_LIB"}, "bin", "1.5"); |
522 |
String[] pathAndContents = new String[]{"p/X.java", |
523 |
"package p;\n" + |
524 |
"public class X<T> {\n" + |
525 |
" X<String> field;\n" + |
526 |
" @Inject @Marker(id=3)\n" + |
527 |
" public void Test(int i, @Default @Marker(id=1) String processor, int k) {}\n" + |
528 |
"}", |
529 |
"p/Inject.java", |
530 |
"package p;\n"+ |
531 |
"public @interface Inject{\n" + |
532 |
"}", |
533 |
"p/Marker.java", |
534 |
"package p;\n" + |
535 |
"public @interface Marker {\n" + |
536 |
" int id() default 0;\n" + |
537 |
"}", |
538 |
"p/Default.java", |
539 |
"package p;\n" + |
540 |
"public @interface Default{\n" + |
541 |
"}"}; |
542 |
Map options = new HashMap(); |
543 |
options.put(JavaCore.COMPILER_LOCAL_VARIABLE_ATTR, JavaCore.DO_NOT_GENERATE); |
544 |
addLibrary(project, "lib334783_3.jar", "lib334783_3src.zip", pathAndContents, JavaCore.VERSION_1_5, options); |
545 |
|
546 |
waitForAutoBuild(); |
547 |
IPackageFragmentRoot root = project.getPackageFragmentRoot(getFile("/P/lib334783_3.jar")); |
548 |
IType type = root.getPackageFragment("p").getClassFile("X.class").getType(); |
549 |
String annotationString1 = "@p.Default [in arg1 [in Test(int, java.lang.String, int) [in X [in X.class [in p [in lib334783_3.jar [in P]]]]]]]"; |
550 |
String annotationString2 = "@p.Marker [in arg1 [in Test(int, java.lang.String, int) [in X [in X.class [in p [in lib334783_3.jar [in P]]]]]]]"; |
551 |
IMethod method = type.getMethods()[1]; |
552 |
IAnnotation[] annotations = method.getAnnotations(); |
553 |
assertEquals("Wrong length", 2, annotations.length); |
554 |
assertEquals("@p.Inject [in Test(int, java.lang.String, int) [in X [in X.class [in p [in lib334783_3.jar [in P]]]]]]", annotations[0].toString()); |
555 |
IAnnotation annotation = annotations[1]; |
556 |
assertEquals("@p.Marker [in Test(int, java.lang.String, int) [in X [in X.class [in p [in lib334783_3.jar [in P]]]]]]", annotation.toString()); |
557 |
IMemberValuePair[] memberValuePairs = annotation.getMemberValuePairs(); |
558 |
assertEquals("Wrong number of pairs", 1, memberValuePairs.length); |
559 |
StringBuffer output = new StringBuffer(); |
560 |
output.append(memberValuePairs[0].getMemberName()); |
561 |
output.append(' '); |
562 |
output.append(memberValuePairs[0].getValue()); |
563 |
assertEquals("Wrong value", "id 3", String.valueOf(output)); |
564 |
IAnnotation[] parameterAnnotations = method.getParameters()[1].getAnnotations(); |
565 |
assertEquals("Wrong length", 2, parameterAnnotations.length); |
566 |
assertEquals(annotationString1, parameterAnnotations[0].toString()); |
567 |
annotation = parameterAnnotations[1]; |
568 |
assertEquals(annotationString2, annotation.toString()); |
569 |
memberValuePairs = annotation.getMemberValuePairs(); |
570 |
assertEquals("Wrong number of pairs", 1, memberValuePairs.length); |
571 |
output = new StringBuffer(); |
572 |
output.append(memberValuePairs[0].getMemberName()); |
573 |
output.append(' '); |
574 |
output.append(memberValuePairs[0].getValue()); |
575 |
assertEquals("Wrong value", "id 1", String.valueOf(output)); |
576 |
assertEquals("Wrong length", 0, method.getParameters()[0].getAnnotations().length); |
577 |
assertEquals("Wrong length", 0, method.getParameters()[2].getAnnotations().length); |
578 |
} finally { |
579 |
deleteProject("P"); |
580 |
} |
581 |
} |
582 |
/** |
583 |
* @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=334783" |
584 |
*/ |
585 |
public void testParamAnnotations6() throws CoreException { |
586 |
try { |
587 |
createJavaProject("P", new String[] {"src"}, new String[] {"JCL15_LIB"}, "bin", "1.5"); |
588 |
String source = "package p;\n" + |
589 |
"public class X<T> {\n" + |
590 |
" X<String> field;\n" + |
591 |
" public void Test() {}\n" + |
592 |
"}"; |
593 |
createFolder("/P/src/p"); |
594 |
createFile( |
595 |
"/P/src/p/X.java", |
596 |
source |
597 |
); |
598 |
waitForAutoBuild(); |
599 |
|
600 |
ICompilationUnit unit = getCompilationUnit("/P/src/p/X.java"); |
601 |
IType type = unit.getType("X"); |
602 |
IMethod method = type.getMethods()[0]; |
603 |
ILocalVariable[] localVariables = method.getParameters(); |
604 |
assertNotNull(localVariables); |
605 |
assertEquals("Wrong length", 0, localVariables.length); |
606 |
} finally { |
607 |
deleteProject("P"); |
608 |
} |
609 |
} |
610 |
/** |
611 |
* @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=334783" |
612 |
*/ |
613 |
public void testParamAnnotations7() throws CoreException, IOException { |
614 |
try { |
615 |
IJavaProject project = createJavaProject("P", new String[] {"src"}, new String[] {"JCL15_LIB"}, "bin", "1.5"); |
616 |
String[] pathAndContents = new String[]{"p/X.java", |
617 |
"package p;\n" + |
618 |
"public class X<T> {\n" + |
619 |
" X<String> field;\n" + |
620 |
" public void Test() {}\n" + |
621 |
"}" |
622 |
}; |
623 |
addLibrary(project, "lib334783.jar", "libsrc.zip", pathAndContents, JavaCore.VERSION_1_5); |
624 |
|
625 |
waitForAutoBuild(); |
626 |
IPackageFragmentRoot root = project.getPackageFragmentRoot(getFile("/P/lib334783.jar")); |
627 |
IType type = root.getPackageFragment("p").getClassFile("X.class").getType(); |
628 |
|
629 |
IMethod method = type.getMethods()[1]; |
630 |
ILocalVariable[] localVariables = method.getParameters(); |
631 |
assertNotNull(localVariables); |
632 |
assertEquals("Wrong length", 0, localVariables.length); |
633 |
} finally { |
634 |
deleteProject("P"); |
635 |
} |
636 |
} |
637 |
/** |
638 |
* @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=334783" |
639 |
*/ |
640 |
public void testParamAnnotations8() throws CoreException, IOException { |
641 |
try { |
642 |
IJavaProject project = createJavaProject("P", new String[] {"src"}, new String[] {"JCL15_LIB"}, "bin", "1.5"); |
643 |
String[] pathAndContents = new String[]{"p/X.java", |
644 |
"package p;\n" + |
645 |
"public class X<T> {\n" + |
646 |
" X<String> field;\n" + |
647 |
" @Inject @Marker(id=3)\n" + |
648 |
" public X(int i, @Default @Marker(id=1) String processor, int k) {}\n" + |
649 |
"}", |
650 |
"p/Inject.java", |
651 |
"package p;\n"+ |
652 |
"public @interface Inject{\n" + |
653 |
"}", |
654 |
"p/Marker.java", |
655 |
"package p;\n" + |
656 |
"public @interface Marker {\n" + |
657 |
" int id() default 0;\n" + |
658 |
"}", |
659 |
"p/Default.java", |
660 |
"package p;\n" + |
661 |
"public @interface Default{\n" + |
662 |
"}"}; |
663 |
Map options = new HashMap(); |
664 |
options.put(JavaCore.COMPILER_LOCAL_VARIABLE_ATTR, JavaCore.DO_NOT_GENERATE); |
665 |
addLibrary(project, "lib334783_3.jar", "lib334783_3src.zip", pathAndContents, JavaCore.VERSION_1_5, options); |
666 |
|
667 |
waitForAutoBuild(); |
668 |
IPackageFragmentRoot root = project.getPackageFragmentRoot(getFile("/P/lib334783_3.jar")); |
669 |
IType type = root.getPackageFragment("p").getClassFile("X.class").getType(); |
670 |
String annotationString1 = "@p.Default [in arg1 [in X(int, java.lang.String, int) [in X [in X.class [in p [in lib334783_3.jar [in P]]]]]]]"; |
671 |
String annotationString2 = "@p.Marker [in arg1 [in X(int, java.lang.String, int) [in X [in X.class [in p [in lib334783_3.jar [in P]]]]]]]"; |
672 |
IMethod method = type.getMethods()[0]; |
673 |
IAnnotation[] annotations = method.getAnnotations(); |
674 |
assertEquals("Wrong length", 2, annotations.length); |
675 |
assertEquals("@p.Inject [in X(int, java.lang.String, int) [in X [in X.class [in p [in lib334783_3.jar [in P]]]]]]", annotations[0].toString()); |
676 |
IAnnotation annotation = annotations[1]; |
677 |
assertEquals("@p.Marker [in X(int, java.lang.String, int) [in X [in X.class [in p [in lib334783_3.jar [in P]]]]]]", annotation.toString()); |
678 |
IMemberValuePair[] memberValuePairs = annotation.getMemberValuePairs(); |
679 |
assertEquals("Wrong number of pairs", 1, memberValuePairs.length); |
680 |
StringBuffer output = new StringBuffer(); |
681 |
output.append(memberValuePairs[0].getMemberName()); |
682 |
output.append(' '); |
683 |
output.append(memberValuePairs[0].getValue()); |
684 |
assertEquals("Wrong value", "id 3", String.valueOf(output)); |
685 |
IAnnotation[] parameterAnnotations = method.getParameters()[1].getAnnotations(); |
686 |
assertEquals("Wrong length", 2, parameterAnnotations.length); |
687 |
assertEquals(annotationString1, parameterAnnotations[0].toString()); |
688 |
annotation = parameterAnnotations[1]; |
689 |
assertEquals(annotationString2, annotation.toString()); |
690 |
memberValuePairs = annotation.getMemberValuePairs(); |
691 |
assertEquals("Wrong number of pairs", 1, memberValuePairs.length); |
692 |
output = new StringBuffer(); |
693 |
output.append(memberValuePairs[0].getMemberName()); |
694 |
output.append(' '); |
695 |
output.append(memberValuePairs[0].getValue()); |
696 |
assertEquals("Wrong value", "id 1", String.valueOf(output)); |
697 |
assertEquals("Wrong length", 0, method.getParameters()[0].getAnnotations().length); |
698 |
assertEquals("Wrong length", 0, method.getParameters()[2].getAnnotations().length); |
699 |
} finally { |
700 |
deleteProject("P"); |
701 |
} |
702 |
} |
302 |
} |
703 |
} |