use of com.gargoylesoftware.htmlunit.Page in project spring-framework by spring-projects.
the class DelegatingWebConnectionTests method verifyExampleInClassLevelJavadoc.
@Test
@EnabledForTestGroups(LONG_RUNNING)
public void verifyExampleInClassLevelJavadoc() throws Exception {
WebClient webClient = new WebClient();
MockMvc mockMvc = MockMvcBuilders.standaloneSetup().build();
MockMvcWebConnection mockConnection = new MockMvcWebConnection(mockMvc, webClient);
WebRequestMatcher cdnMatcher = new UrlRegexRequestMatcher(".*?//code.jquery.com/.*");
WebConnection httpConnection = new HttpWebConnection(webClient);
webClient.setWebConnection(new DelegatingWebConnection(mockConnection, new DelegateWebConnection(cdnMatcher, httpConnection)));
Page page = webClient.getPage("https://code.jquery.com/jquery-1.11.0.min.js");
assertThat(page.getWebResponse().getStatusCode()).isEqualTo(200);
assertThat(page.getWebResponse().getContentAsString()).isNotEmpty();
}
use of com.gargoylesoftware.htmlunit.Page in project spring-framework by spring-projects.
the class MockMvcWebConnectionTests method contextPathNull.
@Test
public void contextPathNull() throws IOException {
this.webClient.setWebConnection(new MockMvcWebConnection(this.mockMvc, this.webClient, null));
Page page = this.webClient.getPage("http://localhost/context/a");
assertThat(page.getWebResponse().getStatusCode()).isEqualTo(200);
}
Aggregations