org.springframework.test.web.servlet.htmlunit.webdriver.MockMvcHtmlUnitDriverBuilder Java Examples

The following examples show how to use org.springframework.test.web.servlet.htmlunit.webdriver.MockMvcHtmlUnitDriverBuilder. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: CalendarApplicationTests.java    From Spring-Security-Third-Edition with MIT License 5 votes vote down vote up
@Before
    public void setup() {
        webClient = MockMvcWebClientBuilder
                // demonstrates applying a MockMvcConfigurer (Spring Security)
//                .webAppContextSetup(context, springSecurity())
                .webAppContextSetup(context)
                // for illustration only - defaults to ""
                .contextPath("")
                // By default MockMvc is used for localhost only;
                // the following will use MockMvc for example.com and example.org as well
                .useMockMvcForHosts("example.com","example.org")
                .build();

        driver = MockMvcHtmlUnitDriverBuilder
                .webAppContextSetup(context)
                .build();

        /*MockMvc mockMvc = MockMvcBuilders
                .webAppContextSetup(context)
//                .apply(springSecurity())
                .build();

        webClient = MockMvcWebClientBuilder
                .mockMvcSetup(mockMvc)
                // for illustration only - defaults to ""
                .contextPath("")
                // By default MockMvc is used for localhost only;
                // the following will use MockMvc for example.com and example.org as well
                .useMockMvcForHosts("example.com","example.org")
                .build();*/
    }
 
Example #2
Source File: FindByUsernameTests.java    From spring-session with Apache License 2.0 5 votes vote down vote up
@Test
void terminateOtherSession() throws Exception {
	HomePage forgotToLogout = home(this.driver);

	this.driver2 = MockMvcHtmlUnitDriverBuilder.mockMvcSetup(this.mockMvc).build();
	HomePage terminateFogotSession = home(this.driver2);
	terminateFogotSession.terminateSession(forgotToLogout.getSessionId()).assertAt();

	LoginPage login = HomePage.go(this.driver);
	login.assertAt();
}
 
Example #3
Source File: MockMvcHtmlUnitWebDriverCreateTaskTests.java    From spring4-sandbox with Apache License 2.0 5 votes vote down vote up
@Before
public void setUp() throws Exception {
	driver = MockMvcHtmlUnitDriverBuilder
			.webAppContextSetup(context)
			.withDelegate(new WebConnectionHtmlUnitDriver(BrowserVersion.CHROME))
			.contextPath("")
			.build();
}
 
Example #4
Source File: AbstractAcceptanceTest.java    From dddsample-core with MIT License 4 votes vote down vote up
@Before
public void setup() {
    driver = MockMvcHtmlUnitDriverBuilder.webAppContextSetup(context).contextPath("/dddsample").build();
}
 
Example #5
Source File: HttpRedisJsonTest.java    From spring-session with Apache License 2.0 4 votes vote down vote up
@BeforeEach
void setup() {
	this.driver = MockMvcHtmlUnitDriverBuilder.mockMvcSetup(this.mockMvc).build();
}
 
Example #6
Source File: BootTests.java    From spring-session with Apache License 2.0 4 votes vote down vote up
@BeforeEach
void setup() {
	this.driver = MockMvcHtmlUnitDriverBuilder.mockMvcSetup(this.mockMvc).build();
}
 
Example #7
Source File: FindByUsernameTests.java    From spring-session with Apache License 2.0 4 votes vote down vote up
@BeforeEach
void setup() {
	this.driver = MockMvcHtmlUnitDriverBuilder.mockMvcSetup(this.mockMvc).build();
}
 
Example #8
Source File: BootTests.java    From spring-session with Apache License 2.0 4 votes vote down vote up
@BeforeEach
void setup() {
	this.driver = MockMvcHtmlUnitDriverBuilder.mockMvcSetup(this.mockMvc).build();
}
 
Example #9
Source File: BootTests.java    From spring-session with Apache License 2.0 4 votes vote down vote up
@BeforeEach
void setup() {
	this.driver = MockMvcHtmlUnitDriverBuilder.mockMvcSetup(this.mockMvc).build();
}