title: How to unit test my HtmlUnit code with an xml file
body: <p>I am writing an application that uses HtmlUnit to screen scrape some data. The logic of which fields come from which parts of the page, and the XPath to retrieve them is getting a bit complicated, so before I refactor I want to write some simple unit tests. I have used the 'page.asXml()' method to get the page XML and save that as a file in my test resources folder, but how can I load it back in as an HtmlPage?</p>
  
  <p>eg</p>
  
  <pre><code>    HtmlPage page = webClient.getPage(url);
      System.out.println(page.asXml());
  </code></pre>
  
  <p>Now in my unit test I want to do the equivalent of:</p>
  
  <pre><code>    HtmlPage page = new HtmlPage(myXmlTestFile);
  </code></pre>
  
  <p>But I can't seem to find anything that will do this. Any ideas?</p>