/ ** * Override to run the test and assert its state * @exception Throwable if any exception is thrown * / protected void runTest () throws Throwable {assertNotNull (fName);. Method runMethod = null; try {// use getMethod to get all public inherited // methods getDeclaredMethods returns all // methods of this class but excludes the // inherited ones runMethod = getClass () getMethod (fName, null);...} catch (NoSuchMethodException e) {fail ( "Method / " FNAME " / "not found");} if (! Modifier.Ispublic (Runmethod.getModifiers ())) {Fail ("Method /" FNAME "/" Should Be PUBLIC ");} Try {Runmethod .invoke (this, new class [0]);} catch (invocationtargetexception e) {E.FillInStackTrace (); throw E.GETTARGETEXCEPTION ();} catch (} catch (lylegalaccessException e) {E.FillInstackTrace (); throw e;}}
Before seeing this code, I didn't think that the Class would have a getMethod method, and I didn't think it would be useful, and it was so wonderful.