@Test public void testNonAvailableAnnotations() throws Exception { TypeDescription typeDescription = describe( new ByteArrayClassLoader( null, ClassFileExtraction.of(MissingAnnotations.class), null, ByteArrayClassLoader.PersistenceHandler.MANIFEST, PackageDefinitionStrategy.NoOp.INSTANCE) .loadClass(MissingAnnotations.class.getName())); assertThat( typeDescription.getDeclaredAnnotations().isAnnotationPresent(SampleAnnotation.class), is(false)); assertThat( typeDescription .getDeclaredFields() .getOnly() .getDeclaredAnnotations() .isAnnotationPresent(SampleAnnotation.class), is(false)); assertThat( typeDescription .getDeclaredMethods() .filter(isMethod()) .getOnly() .getDeclaredAnnotations() .isAnnotationPresent(SampleAnnotation.class), is(false)); }
@Test(expected = GenericSignatureFormatError.class) public void testMalformedMethodSignature() throws Exception { TypeDescription typeDescription = describe(SignatureMalformer.malform(MalformedBase.class)); assertThat(typeDescription.getDeclaredMethods().filter(isMethod()).size(), is(1)); typeDescription.getDeclaredMethods().filter(isMethod()).getOnly().getReturnType().getSort(); }