use of com.gargoylesoftware.htmlunit.WebConnection in project spring-framework by spring-projects.
the class MockMvcConnectionBuilderSupportTests method mockMvc.
@Test
public void mockMvc() throws Exception {
MockMvc mockMvc = MockMvcBuilders.webAppContextSetup(wac).build();
WebConnection conn = new MockMvcWebConnectionBuilderSupport(mockMvc) {
}.createConnection(this.client);
assertMockMvcUsed(conn, "http://localhost/");
assertMockMvcNotUsed(conn, "http://example.com/");
}
use of com.gargoylesoftware.htmlunit.WebConnection in project spring-framework by spring-projects.
the class MockMvcConnectionBuilderSupportTests method defaultContextPathEmpty.
@Test
public void defaultContextPathEmpty() throws Exception {
WebConnection conn = this.builder.createConnection(this.client);
assertThat(getResponse(conn, "http://localhost/abc").getContentAsString(), equalTo(""));
}
use of com.gargoylesoftware.htmlunit.WebConnection in project spring-framework by spring-projects.
the class MockMvcConnectionBuilderSupportTests method defaultContextPathCustom.
@Test
public void defaultContextPathCustom() throws Exception {
WebConnection conn = this.builder.contextPath("/abc").createConnection(this.client);
assertThat(getResponse(conn, "http://localhost/abc/def").getContentAsString(), equalTo("/abc"));
}
use of com.gargoylesoftware.htmlunit.WebConnection in project spring-framework by spring-projects.
the class MockMvcConnectionBuilderSupportTests method mockMvcExampleDotCom.
@Test
public void mockMvcExampleDotCom() throws Exception {
WebConnection conn = this.builder.useMockMvcForHosts("example.com").createConnection(this.client);
assertMockMvcUsed(conn, "http://localhost/");
assertMockMvcUsed(conn, "http://example.com/");
assertMockMvcNotUsed(conn, "http://other.com/");
}
use of com.gargoylesoftware.htmlunit.WebConnection in project spring-framework by spring-projects.
the class MockMvcConnectionBuilderSupportTests method mockMvcAlwaysUseMockMvc.
@Test
public void mockMvcAlwaysUseMockMvc() throws Exception {
WebConnection conn = this.builder.alwaysUseMockMvc().createConnection(this.client);
assertMockMvcUsed(conn, "http://other.com/");
}
Aggregations