versiongrabberinterceptortest.java

来自「sourcode about java basic」· Java 代码 · 共 33 行

JAVA
33
字号
package jsunit.java.tests_server.net.jsunit.interceptor;

import junit.framework.TestCase;
import com.opensymphony.xwork.Action;
import net.jsunit.action.VersionGrabberAware;
import net.jsunit.version.VersionGrabber;
import net.jsunit.version.JsUnitWebsiteVersionGrabber;

public class VersionGrabberInterceptorTest extends TestCase {

    public void testSimple() throws Exception {
        VersionGrabberInterceptor interceptor = new VersionGrabberInterceptor();
        VersionGrabberAction action = new VersionGrabberAction();
        MockActionInvocation invocation = new MockActionInvocation(action);
        interceptor.intercept(invocation);
        assertNotNull(action.versionGrabber);
        assertTrue(action.versionGrabber instanceof JsUnitWebsiteVersionGrabber);
        assertTrue(invocation.wasInvokeCalled);
    }

    static class VersionGrabberAction implements Action, VersionGrabberAware {
        private VersionGrabber versionGrabber;

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

        public void setVersionGrabber(VersionGrabber versionGrabber) {
            this.versionGrabber = versionGrabber;
        }
    }
}

⌨️ 快捷键说明

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