@Test public void testAppendInterceptors() throws Exception { final List<String> called = new ArrayList<>(); Binder.replaceBindModule(new BindModule() { @Override protected AbstractExecuteTestSuiteInterceptor[] getExecuteTestSuiteInterceptors() { return appendInterceptors(super.getExecuteTestSuiteInterceptors(), new AbstractExecuteTestSuiteInterceptor() { @Override protected Result invoke(MethodInvocation invocation, TestSuite testSuite, Selenese parent, Context context) throws Throwable { called.add("ExecuteTestSuite1"); Result result = (Result) invocation.proceed(); called.add("ExecuteTestSuite2"); return result; } }); } @Override protected AbstractExecuteTestCaseInterceptor[] getExecuteTestCaseInterceptors() { return appendInterceptors(super.getExecuteTestCaseInterceptors(), new AbstractExecuteTestCaseInterceptor() { @Override protected Result invoke(MethodInvocation invocation, ITestCase testCase, Selenese parent, Context context) throws Throwable { called.add("ExecuteTestCase1"); Result result = (Result) invocation.proceed(); called.add("ExecuteTestCase2"); return result; } }); } @Override protected AbstractDoCommandInterceptor[] getDoCommandInterceptors() { return appendInterceptors(super.getDoCommandInterceptors(), new AbstractDoCommandInterceptor() { @Override protected Result invoke(MethodInvocation invocation, Context context, ICommand command, String[] curArgs) throws Throwable { called.add("DoCommand1"); Result result = (Result) invocation.proceed(); called.add("DoCommand2"); return result; } }); } }); execute(); assertThat(called, is(equalTo(Arrays.asList( "ExecuteTestSuite1", "ExecuteTestCase1", "DoCommand1", "DoCommand2", "ExecuteTestCase2", "ExecuteTestSuite2")))); }
public static void replaceBindModule(BindModule module) { injector = Guice.createInjector(module); }
Binder { public static void replaceBindModule(BindModule module) { injector = Guice.createInjector(module); } }
Binder { public static void replaceBindModule(BindModule module) { injector = Guice.createInjector(module); } private  Binder(); }
Binder { public static void replaceBindModule(BindModule module) { injector = Guice.createInjector(module); } private  Binder(); static void replaceBindModule(BindModule module); static TestCase newTestCase(SourceType sourceType, String filename, String name, String baseURL); @Deprecated static TestCase newTestCase(String filename, String name, String baseURL); static TestSuite newTestSuite(String filename, String name); static TestProject newTestProject(String filename, String name); static ErrorTestCase newErrorTestCase(String filename, InvalidSeleneseException e); static ErrorTestSuite newErrorTestSuite(String filename, InvalidSeleneseException e); static ErrorTestProject newErrorTestProject(String filename, InvalidSeleneseException e); static CommandList newCommandList(); }
Binder { public static void replaceBindModule(BindModule module) { injector = Guice.createInjector(module); } private  Binder(); static void replaceBindModule(BindModule module); static TestCase newTestCase(SourceType sourceType, String filename, String name, String baseURL); @Deprecated static TestCase newTestCase(String filename, String name, String baseURL); static TestSuite newTestSuite(String filename, String name); static TestProject newTestProject(String filename, String name); static ErrorTestCase newErrorTestCase(String filename, InvalidSeleneseException e); static ErrorTestSuite newErrorTestSuite(String filename, InvalidSeleneseException e); static ErrorTestProject newErrorTestProject(String filename, InvalidSeleneseException e); static CommandList newCommandList();  }