01: package org.testng;
02:
03: /**
04: * If a test class implements this interface, its run() method
05: * will be invoked instead of each @Test method found. The invocation of
06: * the test method will then be performed upon invocation of the callBack()
07: * method of the IHookCallBack parameter.
08: *
09: * This is useful to test classes that require JAAS authentication, which can
10: * be implemented as follows:
11: *
12: * <pre>
13: * public void run(final IHookCallBack icb, ITestResult testResult) {
14: * // Preferably initialized in a @Configuration method
15: * mySubject = authenticateWithJAAs();
16: *
17: * Subject.doAs(mySubject, new PrivilegedExceptionAction() {
18: * public Object run() {
19: * icb.callback(testResult);
20: * }
21: * };
22: * }
23: * </pre>
24: *
25: * @author cbeust
26: * @date Jan 28, 2006
27: */
28: public interface IHookable {
29: public void run(IHookCallBack callBack, ITestResult testResult);
30: }
|