farmserverfunctionaltest.java

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

JAVA
39
字号
package jsunit.java.tests_server.net.jsunit;

import net.jsunit.configuration.Configuration;
import net.jsunit.model.ResultType;
import org.jdom.Document;

import java.net.URLEncoder;

public class FarmServerFunctionalTest extends FunctionalTestCase {

    private JsUnitFarmServer farmServer;
    private int otherPort;

    public void setUp() throws Exception {
        super.setUp();
        otherPort = new TestPortManager().newPort();
        farmServer = new JsUnitFarmServer(new Configuration(new FunctionalTestFarmConfigurationSource(otherPort, port)));
        farmServer.start();
    }

    protected int webTesterPort() {
        return otherPort;
    }

    public void testHitFarmRunner() throws Exception {
        String url =
                "/runner?url=" + URLEncoder.encode("http://localhost:" + port + "/jsunit/tests/jsUnitUtilityTests.html", "UTF-8");
        webTester.beginAt(url);
        Document document = responseXmlDocument();
        assertEquals(ResultType.SUCCESS.name(), document.getRootElement().getAttribute("type").getValue());
    }

    public void tearDown() throws Exception {
        farmServer.dispose();
        super.tearDown();
    }

}

⌨️ 快捷键说明

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