void (String className, String methodName, boolean succeed) { if (succeed) { try { final Object data = getData(); Method testEnded = data.getClass().getMethod("testDiscoveryEnded", String.class, String.class); testEnded.invoke(data, className, methodName); } catch (Throwable t) { t.printStackTrace(); } } }