use of org.eclipse.xtext.common.types.JvmAnnotationReference in project xtext-eclipse by eclipse.
the class AbstractTypeProviderTest method testDefaultAnnotationAnnotationValue_01.
@Test
public void testDefaultAnnotationAnnotationValue_01() throws Exception {
JvmAnnotationAnnotationValue value = (JvmAnnotationAnnotationValue) getDefaultAnnotationValue("annotationValue");
assertEquals(1, value.getValues().size());
JvmAnnotationReference reference = value.getValues().get(0);
assertEquals(TestAnnotationWithDefaults.NestedAnnotation.class.getName(), reference.getAnnotation().getIdentifier());
JvmAnnotationValue nestedAnnotationValue = reference.getValues().get(0);
assertTrue(nestedAnnotationValue instanceof JvmStringAnnotationValue);
assertEquals("AnotherString", ((JvmStringAnnotationValue) nestedAnnotationValue).getValues().get(0));
}
use of org.eclipse.xtext.common.types.JvmAnnotationReference in project xtext-eclipse by eclipse.
the class AbstractTypeProviderTest method testAnnotationWithStringDefault_04.
@Test
public void testAnnotationWithStringDefault_04() throws Exception {
String typeName = AnnotatedClassWithStringDefault.class.getName();
JvmDeclaredType type = (JvmDeclaredType) getTypeProvider().findTypeByName(typeName);
List<JvmAnnotationReference> annotations = type.getAnnotations();
assertEquals(1, annotations.size());
JvmAnnotationReference annotationReference = annotations.get(0);
assertEquals(TestAnnotationWithStringDefault.class.getName(), annotationReference.getAnnotation().getIdentifier());
checkDefaultAnnotationValuesAnnotatedExternalClass(annotationReference);
}
use of org.eclipse.xtext.common.types.JvmAnnotationReference in project xtext-eclipse by eclipse.
the class AbstractTypeProviderTest method testAnnotatedParameter_01.
@Test
public void testAnnotatedParameter_01() throws Exception {
String typeName = TestAnnotation.Annotated.class.getName();
JvmAnnotationType annotationType = (JvmAnnotationType) getTypeProvider().findTypeByName(TestAnnotation.class.getName());
JvmDeclaredType type = (JvmDeclaredType) getTypeProvider().findTypeByName(typeName);
JvmConstructor constructor = getConstructorFromType(type, TestAnnotation.Annotated.class, "Annotated(java.lang.String,java.lang.String,java.lang.String)");
JvmAnnotationTarget target = constructor.getParameters().get(0);
assertEquals(2, target.getAnnotations().size());
JvmAnnotationReference annotationReference = target.getAnnotations().get(0);
assertSame(annotationType, annotationReference.getAnnotation());
annotationType = (JvmAnnotationType) getTypeProvider().findTypeByName(TestAnnotation.NestedAnnotation.class.getName());
annotationReference = target.getAnnotations().get(1);
assertSame(annotationType, annotationReference.getAnnotation());
}
use of org.eclipse.xtext.common.types.JvmAnnotationReference in project xtext-eclipse by eclipse.
the class AbstractTypeProviderTest method testBug428340.
@Test
public void testBug428340() {
String typeName = Bug428340.class.getName();
JvmDeclaredType type = (JvmDeclaredType) getTypeProvider().findTypeByName(typeName);
JvmAnnotationReference myAnnotation = type.getAnnotations().get(0);
assertEquals("MyAnnotation", myAnnotation.getAnnotation().getSimpleName());
}
use of org.eclipse.xtext.common.types.JvmAnnotationReference in project xtext-eclipse by eclipse.
the class AbstractTypeProviderTest method testAnnotationAnnotationValue_01.
@Test
public void testAnnotationAnnotationValue_01() throws Exception {
JvmAnnotationAnnotationValue value = (JvmAnnotationAnnotationValue) getAnnotationValue("annotationValue");
assertEquals(1, value.getValues().size());
JvmAnnotationReference annotationReference = value.getValues().get(0);
assertEquals(TestAnnotation.NestedAnnotation.class.getName(), annotationReference.getAnnotation().getIdentifier());
assertEquals(1, annotationReference.getValues().size());
JvmStringAnnotationValue nestedValue = (JvmStringAnnotationValue) annotationReference.getValues().get(0);
assertEquals(1, nestedValue.getValues().size());
assertEquals("MyString", nestedValue.getValues().get(0));
}
Aggregations