@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));
 }
 @Override
 public ISpecies getParentSpecies() {
   if (parentSpecies == null) {
     final TypeDescription parentSpecDesc = getDescription().getParent();
     // Takes care of invalid species (see Issue 711)
     if (parentSpecDesc == null || parentSpecDesc == getDescription()) {
       return null;
     }
     ISpecies currentMacroSpec = this.getMacroSpecies();
     while (currentMacroSpec != null && parentSpecies == null) {
       parentSpecies = currentMacroSpec.getMicroSpecies(parentSpecDesc.getName());
       currentMacroSpec = currentMacroSpec.getMacroSpecies();
     }
   }
   return parentSpecies;
 }
 @Test
 public void testEquals() throws Exception {
   TypeDescription identical = describe(SampleClass.class);
   assertThat(identical, is(identical));
   TypeDescription equalFirst = mock(TypeDescription.class);
   when(equalFirst.getSort()).thenReturn(TypeDefinition.Sort.NON_GENERIC);
   when(equalFirst.asErasure()).thenReturn(equalFirst);
   when(equalFirst.getName()).thenReturn(SampleClass.class.getName());
   assertThat(describe(SampleClass.class), is(equalFirst));
   assertThat(describe(SampleClass.class), not(describe(SampleInterface.class)));
   assertThat(
       describe(SampleClass.class),
       not((TypeDescription) new TypeDescription.ForLoadedType(SampleInterface.class)));
   TypeDefinition nonRawType = mock(TypeDescription.Generic.class);
   when(nonRawType.getSort()).thenReturn(TypeDefinition.Sort.VARIABLE);
   assertThat(describe(SampleClass.class), not(nonRawType));
   assertThat(describe(SampleClass.class), not(new Object()));
   assertThat(describe(SampleClass.class), not(equalTo(null)));
   assertThat(
       describe(Object[].class),
       is((TypeDescription) new TypeDescription.ForLoadedType(Object[].class)));
   assertThat(describe(Object[].class), not(TypeDescription.OBJECT));
 }
 @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();
 }
 @Test(expected = GenericSignatureFormatError.class)
 public void testMalformedTypeSignature() throws Exception {
   TypeDescription typeDescription = describe(SignatureMalformer.malform(MalformedBase.class));
   assertThat(typeDescription.getInterfaces().size(), is(1));
   typeDescription.getInterfaces().getOnly().getSort();
 }