@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 testMalformedFieldSignature() throws Exception { TypeDescription typeDescription = describe(SignatureMalformer.malform(MalformedBase.class)); assertThat(typeDescription.getDeclaredFields().size(), is(1)); typeDescription.getDeclaredFields().getOnly().getType().getSort(); }