*/
@Test
public void test_invokeStaticMethodOverriden() throws Exception {
String methodName = "staticMethodAdded";
try {
Result r = getDeclaredMethod(methodName);
fail("Method shouldn't exist at first!\n" + r.toString());
} catch (ResultException e) {
assertNoSuchMethodException(TARGET_CLASS_NAME + "." + methodName + "()", e);
}
reloadType("002");
// Setup subClass and an instance of the subclass
String subClassName = TARGET_PACKAGE + ".SubClassTarget";
ReloadableType subTarget = registry.addType(subClassName, loadBytesForClass(subClassName));
Object subInstance = subTarget.getClazz().newInstance();
//Double check, the subclass 'overrides' the static method
assertMethod("public static int " + subClassName + "." + methodName + "()",
getDeclaredMethod(subTarget.getClazz(), methodName));
Result r = getDeclaredMethod(methodName);
assertMethod("public static int " + TARGET_CLASS_NAME + "." + methodName + "()", r);
Method m = (Method) r.returnValue;
// Calling the static method seemingly on a 'subinstance' the instance should be ignored!
r = invokeOn(subTarget, m);