@Test
public void basicSubclassWorks()
        throws NotFoundException, CannotCompileException, IllegalAccessException, InstantiationException {

    CtClass superClass = pool.get(TestClassAlpha.class.getName());
    CtClass subClass = pool.makeClass(makeNewName());
    subClass.setSuperclass(superClass);
    CtMethod toStringMethod = superClass.getDeclaredMethod("toString");
    CtMethod override = CtNewMethod.copy(toStringMethod, "toString", subClass, null); 
    override.setBody("return ($r) super.toString().concat(\"Beta!\");");
    subClass.addMethod(override);
    Class<TestClassAlpha> betaClass = ClassLoadingUtil.toClass(subClass);
    TestClassAlpha beta = betaClass.newInstance();
    assertEquals("AlphaBeta!", beta.toString());
}