コード例 #1
0
 @Test
 public void testInterfaceType() throws Exception {
   DynamicType.Unloaded<?> unloaded = new ByteBuddy().redefine(InterfaceType.class).make();
   Class<?> type =
       unloaded
           .load(ClassLoadingStrategy.BOOTSTRAP_LOADER, ClassLoadingStrategy.Default.WRAPPER)
           .getLoaded();
   TypeDescription createdType = new TypeDescription.ForLoadedType(type);
   TypeDescription originalType = new TypeDescription.ForLoadedType(InterfaceType.class);
   assertThat(createdType.getTypeVariables(), is(originalType.getTypeVariables()));
   assertThat(createdType.getSuperClass(), nullValue(TypeDescription.Generic.class));
   assertThat(createdType.getInterfaces(), is(originalType.getInterfaces()));
 }
コード例 #2
0
 @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();
 }