1package test.hook;
2
3import org.testng.IHookCallBack;
4import org.testng.IHookable;
5import org.testng.ITestResult;
6import org.testng.Reporter;
7import org.testng.annotations.DataProvider;
8import org.testng.annotations.Test;
9
10/**
11 * Test harness for {@link IHookable}
12 *
13 * @author <a href="mailto:cedric@beust.com">Cedric Beust</a>
14 * @since Aug 01, 2006
15 */
16public class HookSuccess599Test implements IHookable {
17  static boolean m_hook = false;
18  static boolean m_testWasRun = false;
19  static String m_parameter = null;
20
21  @Override
22  public void run(IHookCallBack callBack, ITestResult testResult) {
23    m_hook = true;
24    Object[] parameters = callBack.getParameters();
25    if (parameters.length > 0) {
26      m_parameter = parameters[0].toString();
27    }
28    callBack.runTestMethod(testResult);
29  }
30
31  @DataProvider
32  public Object[][] dp() {
33    return new Object[][] {
34        new Object[] { "foo" }
35    };
36  }
37
38  @Test(dataProvider = "dp", timeOut = 100)
39  public void verify(String name) {
40    m_testWasRun = true;
41    Reporter.log("output from hook test.verify");
42  }
43}
44