⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 browsertestrunnerinterceptortest.java

📁 sourcode about java basic
💻 JAVA
字号:
package jsunit.java.tests_server.net.jsunit.interceptor;

import junit.framework.TestCase;
import net.jsunit.BrowserTestRunner;
import net.jsunit.MockBrowserTestRunner;
import net.jsunit.XmlRenderable;
import net.jsunit.action.JsUnitBrowserTestRunnerAction;

public class BrowserTestRunnerInterceptorTest extends TestCase {

    public void testSimple() throws Exception {
        MockJsUnitAction action = new MockJsUnitAction();
        final BrowserTestRunner mockRunner = new MockBrowserTestRunner();
        BrowserTestRunnerInterceptor.setBrowserTestRunnerSource(new BrowserTestRunnerSource() {
            public BrowserTestRunner getRunner() {
                return mockRunner;
            }

        });
        assertNull(action.getBrowserTestRunner());
        BrowserTestRunnerInterceptor interceptor = new BrowserTestRunnerInterceptor();

        MockActionInvocation mockInvocation = new MockActionInvocation(action);
        interceptor.intercept(mockInvocation);

        assertSame(mockRunner, action.getBrowserTestRunner());
        assertTrue(mockInvocation.wasInvokeCalled);
    }

    public void tearDown() throws Exception {
        BrowserTestRunnerInterceptor.setBrowserTestRunnerSource(new DefaultBrowserTestRunnerSource());
        super.tearDown();
    }

    static class MockJsUnitAction extends JsUnitBrowserTestRunnerAction {

        public String execute() throws Exception {
            return null;
        }

        public XmlRenderable getXmlRenderable() {
            return null;
        }

    }

}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -