testdatatest.java

来自「simple spider 源码 better light faster ja」· Java 代码 · 共 38 行

JAVA
38
字号
package com.develop.ss.httpunit;

import junit.framework.TestCase;
import com.meterware.httpunit.WebConversation;
import com.meterware.httpunit.WebResponse;
import com.meterware.httpunit.WebLink;
import com.develop.ss.test.ConfigBean;

import java.io.IOException;
import java.net.MalformedURLException;
import java.util.logging.Logger;

import org.xml.sax.SAXException;

public class TestdataTest extends TestCase implements Constants {
  WebConversation conversation = new WebConversation();
  ConfigBean config;
  private static Logger log = Logger.getLogger("com.develop.ss.httpunit");

  public TestdataTest(String name) {
    super(name);
  }

  protected void setUp() throws Exception {
    config = new ConfigBean();
  }

  public void testDataPagesPresent() throws IOException, SAXException, MalformedURLException {
    WebResponse response = conversation.getResponse(config.getWebappUrl() + "/testdata/default.html");
    WebLink[] links = response.getLinks();
    for (int i = 0; i < links.length; i++) {
      WebLink link = links[i];
      link.click();
    }
    assertEquals(LINKS, links.length);
  }
}

⌨️ 快捷键说明

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