Search in sources :

Example 16 with AnnotationDescription

use of net.bytebuddy.description.annotation.AnnotationDescription in project byte-buddy by raphw.

the class ElementMatchersTest method testIsAnnotation.

@Test
public void testIsAnnotation() throws Exception {
    AnnotationDescription annotationDescription = new TypeDescription.ForLoadedType(IsAnnotatedWith.class).getDeclaredAnnotations().ofType(IsAnnotatedWithAnnotation.class);
    assertThat(ElementMatchers.is(IsAnnotatedWith.class.getAnnotation(IsAnnotatedWithAnnotation.class)).matches(annotationDescription), is(true));
    assertThat(ElementMatchers.is(Other.class.getAnnotation(OtherAnnotation.class)).matches(annotationDescription), is(false));
}
Also used : AnnotationDescription(net.bytebuddy.description.annotation.AnnotationDescription) Test(org.junit.Test)

Aggregations

AnnotationDescription (net.bytebuddy.description.annotation.AnnotationDescription)16 Test (org.junit.Test)12 AnnotationList (net.bytebuddy.description.annotation.AnnotationList)5 TypeDescription (net.bytebuddy.description.type.TypeDescription)4 ArrayList (java.util.ArrayList)2 MethodDescription (net.bytebuddy.description.method.MethodDescription)2 ByteArrayClassLoader (net.bytebuddy.dynamic.loading.ByteArrayClassLoader)2 LinkedHashMap (java.util.LinkedHashMap)1 Map (java.util.Map)1 Random (java.util.Random)1 AnnotationDescriptionBuilderTest (net.bytebuddy.description.annotation.AnnotationDescriptionBuilderTest)1 AnnotationValue (net.bytebuddy.description.annotation.AnnotationValue)1 EnumerationDescription (net.bytebuddy.description.enumeration.EnumerationDescription)1 MethodList (net.bytebuddy.description.method.MethodList)1 MethodDelegationBinder (net.bytebuddy.implementation.bind.MethodDelegationBinder)1