MimicCreator { public void mimicInterfaces(CtClass src, CtClass dst) throws NotFoundException { for (CtClass interfazz : src.getInterfaces()) { if (!hasInterface(dst, interfazz)) { dst.addInterface(interfazz); } } } MimicCreator();  MimicCreator(String key); boolean hasField(CtClass clazz, CtField field); boolean hasInterface(CtClass dst, CtClass interfazz); void mimicClass(CtClass src, CtClass dst, MimicMode defaultMimicMode, MimicMethod[] mimicMethods); void mimicConstructors(CtClass src, CtClass dst); void mimicFields(CtClass src, CtClass dst); void mimicInterfaces(CtClass src, CtClass dst); void mimicMethods(CtClass src, CtClass dst, MimicMode defaultMimicMode, MimicMethod[] mimicMethods);  }
@Test public void testMimicInterfaces() throws Exception { CtClass interfazz = ClassPool.getDefault().makeInterface("Able" + TestCounter.testCounter); src.addInterface(interfazz); Class<?> interfaceClass = ClassPool.getDefault().toClass(interfazz); mimicCreator.mimicInterfaces(src, dst); assertHasInterface(interfaceClass, dst.toClass()); }
@Test public void testMimicInterfaces_with_same_interfaces() throws Exception { CtClass interfazz = ClassPool.getDefault().makeInterface("Able" + TestCounter.testCounter); src.addInterface(interfazz); dst.addInterface(interfazz); Class<?> interfaceClass = ClassPool.getDefault().toClass(interfazz); mimicCreator.mimicInterfaces(src, dst); assertHasInterface(interfaceClass, dst.toClass()); }