@Test
public void testCopyClassAnnontations() {

  final CtClass fromClass = ClassPool.getDefault().makeClass("fromClass");
  final CtClass toClass = ClassPool.getDefault().makeClass("toClass");
  // Create class annotations
  final ConstPool fromPool = fromClass.getClassFile().getConstPool();
  final AnnotationsAttribute attr =
      new AnnotationsAttribute(fromPool, AnnotationsAttribute.visibleTag);
  final Annotation anno = new Annotation("java.lang.Integer", fromPool);
  anno.addMemberValue("copyClassName", new IntegerMemberValue(fromPool, 246));
  attr.addAnnotation(anno);
  fromClass.getClassFile().addAttribute(attr);
  JavassistUtils.copyClassAnnotations(fromClass, toClass);
  final Annotation toAnno =
      ((AnnotationsAttribute) toClass.getClassFile().getAttribute(
          AnnotationsAttribute.visibleTag)).getAnnotation("java.lang.Integer");
  Assert.assertEquals(
      246,
      ((IntegerMemberValue) toAnno.getMemberValue("copyClassName")).getValue());
}