View Javadoc

1   package com.diasparsoftware.htmlunitx;
2   
3   import java.io.IOException;
4   import java.net.URL;
5   import java.util.*;
6   
7   import org.apache.commons.httpclient.HttpState;
8   
9   import com.gargoylesoftware.htmlunit.*;
10  
11  public class TestableWebConnection extends WebConnection {
12      private Map responses = new HashMap();
13  
14      public TestableWebConnection(WebClient client) {
15          super(client);
16      }
17  
18      public WebResponse getResponse(URL url,
19          SubmitMethod submitMethod, List parameters,
20          Map requestHeaders) throws IOException {
21  
22          return (WebResponse) responses.get(url);
23      }
24  
25      public void setResponse(WebResponse response) {
26          responses.put(response.getUrl(), response);
27      }
28  
29      public HttpState getStateForUrl(URL url) {
30          return new HttpState();
31      }
32  
33  }