Skip to content

Commit 17ca042

Browse files
snicollwilkinsona
authored andcommitted
Upgrade to HtmlUnit 4.2.0 and Selenium HtmlUnit 4.20
Closes gh-41178 Closes gh-41179
1 parent 6d99770 commit 17ca042

File tree

18 files changed

+57
-57
lines changed

18 files changed

+57
-57
lines changed

spring-boot-project/spring-boot-dependencies/build.gradle

+4-4
Original file line numberDiff line numberDiff line change
@@ -563,8 +563,8 @@ bom {
563563
]
564564
}
565565
}
566-
library("HtmlUnit", "2.70.0") {
567-
group("net.sourceforge.htmlunit") {
566+
library("HtmlUnit", "4.2.0") {
567+
group("org.htmlunit") {
568568
modules = [
569569
"htmlunit" {
570570
exclude group: "commons-logging", module: "commons-logging"
@@ -1826,10 +1826,10 @@ bom {
18261826
releaseNotes("https://github.com/SeleniumHQ/selenium/releases/tag/selenium-{version}")
18271827
}
18281828
}
1829-
library("Selenium HtmlUnit", "4.13.0") {
1829+
library("Selenium HtmlUnit", "4.20.0") {
18301830
group("org.seleniumhq.selenium") {
18311831
modules = [
1832-
"htmlunit-driver"
1832+
"htmlunit3-driver"
18331833
]
18341834
}
18351835
links {

spring-boot-project/spring-boot-docs/build.gradle

+4-4
Original file line numberDiff line numberDiff line change
@@ -80,10 +80,6 @@ dependencies {
8080
implementation("jakarta.persistence:jakarta.persistence-api")
8181
implementation("jakarta.servlet:jakarta.servlet-api")
8282
implementation("jakarta.validation:jakarta.validation-api")
83-
implementation("net.sourceforge.htmlunit:htmlunit") {
84-
exclude group: "commons-logging", module: "commons-logging"
85-
exclude group: "xml-apis", module: "xml-apis"
86-
}
8783
implementation("org.apache.httpcomponents.client5:httpclient5")
8884
implementation("org.apache.commons:commons-dbcp2") {
8985
exclude group: "commons-logging", module: "commons-logging"
@@ -102,6 +98,10 @@ dependencies {
10298
exclude group: "javax.xml.bind", module: "jaxb-api"
10399
exclude group: "org.jboss.spec.javax.transaction", module: "jboss-transaction-api_1.2_spec"
104100
}
101+
implementation("org.htmlunit:htmlunit") {
102+
exclude group: "commons-logging", module: "commons-logging"
103+
exclude group: "xml-apis", module: "xml-apis"
104+
}
105105
implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk8")
106106
implementation("org.jooq:jooq") {
107107
exclude group: "javax.xml.bind", module: "jaxb-api"

spring-boot-project/spring-boot-docs/src/main/java/org/springframework/boot/docs/testing/springbootapplications/springmvctests/MyHtmlUnitTests.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@
1616

1717
package org.springframework.boot.docs.testing.springbootapplications.springmvctests;
1818

19-
import com.gargoylesoftware.htmlunit.WebClient;
20-
import com.gargoylesoftware.htmlunit.html.HtmlPage;
19+
import org.htmlunit.WebClient;
20+
import org.htmlunit.html.HtmlPage;
2121
import org.junit.jupiter.api.Test;
2222

2323
import org.springframework.beans.factory.annotation.Autowired;

spring-boot-project/spring-boot-docs/src/main/kotlin/org/springframework/boot/docs/features/testing/springbootapplications/springmvctests/MyHtmlUnitTests.kt

+2-2
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@
1616

1717
package org.springframework.boot.docs.features.testing.springbootapplications.springmvctests
1818

19-
import com.gargoylesoftware.htmlunit.WebClient
20-
import com.gargoylesoftware.htmlunit.html.HtmlPage
2119
import org.assertj.core.api.Assertions.assertThat
20+
import org.htmlunit.WebClient
21+
import org.htmlunit.html.HtmlPage
2222
import org.junit.jupiter.api.Test
2323
import org.mockito.BDDMockito.given
2424
import org.springframework.beans.factory.annotation.Autowired

spring-boot-project/spring-boot-test-autoconfigure/build.gradle

+3-3
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,12 @@ dependencies {
2020
optional("com.google.code.gson:gson")
2121
optional("com.jayway.jsonpath:json-path")
2222
optional("com.sun.xml.messaging.saaj:saaj-impl")
23-
optional("net.sourceforge.htmlunit:htmlunit") {
23+
optional("org.hibernate.orm:hibernate-core")
24+
optional("org.htmlunit:htmlunit") {
2425
exclude group: "commons-logging", module: "commons-logging"
2526
}
26-
optional("org.hibernate.orm:hibernate-core")
2727
optional("org.junit.jupiter:junit-jupiter-api")
28-
optional("org.seleniumhq.selenium:htmlunit-driver") {
28+
optional("org.seleniumhq.selenium:htmlunit3-driver") {
2929
exclude(group: "commons-logging", module: "commons-logging")
3030
exclude(group: "com.sun.activation", module: "jakarta.activation")
3131
}

spring-boot-project/spring-boot-test-autoconfigure/src/main/java/org/springframework/boot/test/autoconfigure/web/servlet/AutoConfigureMockMvc.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2019 the original author or authors.
2+
* Copyright 2012-2024 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -23,7 +23,7 @@
2323
import java.lang.annotation.RetentionPolicy;
2424
import java.lang.annotation.Target;
2525

26-
import com.gargoylesoftware.htmlunit.WebClient;
26+
import org.htmlunit.WebClient;
2727
import org.openqa.selenium.WebDriver;
2828

2929
import org.springframework.boot.autoconfigure.ImportAutoConfiguration;

spring-boot-project/spring-boot-test-autoconfigure/src/main/java/org/springframework/boot/test/autoconfigure/web/servlet/MockMvcWebClientAutoConfiguration.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2022 the original author or authors.
2+
* Copyright 2012-2024 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -16,7 +16,7 @@
1616

1717
package org.springframework.boot.test.autoconfigure.web.servlet;
1818

19-
import com.gargoylesoftware.htmlunit.WebClient;
19+
import org.htmlunit.WebClient;
2020

2121
import org.springframework.boot.autoconfigure.AutoConfiguration;
2222
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;

spring-boot-project/spring-boot-test-autoconfigure/src/main/java/org/springframework/boot/test/autoconfigure/web/servlet/MockMvcWebDriverAutoConfiguration.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2023 the original author or authors.
2+
* Copyright 2012-2024 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -18,7 +18,7 @@
1818

1919
import java.util.concurrent.Executors;
2020

21-
import com.gargoylesoftware.htmlunit.BrowserVersion;
21+
import org.htmlunit.BrowserVersion;
2222
import org.openqa.selenium.WebDriver;
2323
import org.openqa.selenium.htmlunit.HtmlUnitDriver;
2424

spring-boot-project/spring-boot-test-autoconfigure/src/test/java/org/springframework/boot/test/autoconfigure/web/servlet/mockmvc/WebMvcTestWebClientIntegrationTests.java

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2019 the original author or authors.
2+
* Copyright 2012-2024 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -16,8 +16,8 @@
1616

1717
package org.springframework.boot.test.autoconfigure.web.servlet.mockmvc;
1818

19-
import com.gargoylesoftware.htmlunit.WebClient;
20-
import com.gargoylesoftware.htmlunit.html.HtmlPage;
19+
import org.htmlunit.WebClient;
20+
import org.htmlunit.html.HtmlPage;
2121
import org.junit.jupiter.api.Test;
2222

2323
import org.springframework.beans.factory.annotation.Autowired;

spring-boot-project/spring-boot-test-autoconfigure/src/test/java/org/springframework/boot/test/autoconfigure/web/servlet/mockmvc/WebMvcTestWebDriverIntegrationTests.java

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2022 the original author or authors.
2+
* Copyright 2012-2024 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -20,7 +20,7 @@
2020
import org.junit.jupiter.api.Test;
2121
import org.junit.jupiter.api.TestMethodOrder;
2222
import org.openqa.selenium.By;
23-
import org.openqa.selenium.NoSuchWindowException;
23+
import org.openqa.selenium.NoSuchSessionException;
2424
import org.openqa.selenium.WebDriver;
2525
import org.openqa.selenium.WebElement;
2626

@@ -59,7 +59,7 @@ void shouldBeADifferentWebClient() {
5959
this.webDriver.get("/html");
6060
WebElement element = this.webDriver.findElement(By.tagName("body"));
6161
assertThat(element.getText()).isEqualTo("Hello");
62-
assertThatExceptionOfType(NoSuchWindowException.class).isThrownBy(previousWebDriver::getWindowHandle);
62+
assertThatExceptionOfType(NoSuchSessionException.class).isThrownBy(previousWebDriver::getWindowHandle);
6363
assertThat(previousWebDriver).isNotNull().isNotSameAs(this.webDriver);
6464
}
6565

spring-boot-project/spring-boot-test-autoconfigure/src/test/java/org/springframework/boot/test/autoconfigure/web/servlet/mockmvc/WebMvcTestWithAutoConfigureMockMvcIntegrationTests.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2023 the original author or authors.
2+
* Copyright 2012-2024 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -16,7 +16,7 @@
1616

1717
package org.springframework.boot.test.autoconfigure.web.servlet.mockmvc;
1818

19-
import com.gargoylesoftware.htmlunit.WebClient;
19+
import org.htmlunit.WebClient;
2020
import org.junit.jupiter.api.Test;
2121
import org.openqa.selenium.WebDriver;
2222

spring-boot-project/spring-boot-test/build.gradle

+4-4
Original file line numberDiff line numberDiff line change
@@ -23,22 +23,22 @@ dependencies {
2323
optional("org.assertj:assertj-core")
2424
optional("org.hamcrest:hamcrest-core")
2525
optional("org.hamcrest:hamcrest-library")
26+
optional("org.htmlunit:htmlunit") {
27+
exclude(group: "commons-logging", module: "commons-logging")
28+
}
2629
optional("org.jetbrains.kotlin:kotlin-stdlib")
2730
optional("org.jetbrains.kotlin:kotlin-reflect")
2831
optional("org.junit.jupiter:junit-jupiter-api")
2932
optional("org.mockito:mockito-core")
3033
optional("org.skyscreamer:jsonassert")
31-
optional("org.seleniumhq.selenium:htmlunit-driver") {
34+
optional("org.seleniumhq.selenium:htmlunit3-driver") {
3235
exclude(group: "commons-logging", module: "commons-logging")
3336
exclude(group: "com.sun.activation", module: "jakarta.activation")
3437
}
3538
optional("org.seleniumhq.selenium:selenium-api")
3639
optional("org.springframework:spring-web")
3740
optional("org.springframework:spring-webflux")
3841
optional("org.springframework.graphql:spring-graphql-test")
39-
optional("net.sourceforge.htmlunit:htmlunit") {
40-
exclude(group: "commons-logging", module: "commons-logging")
41-
}
4242

4343
testImplementation(project(":spring-boot-project:spring-boot-tools:spring-boot-test-support"))
4444
testImplementation("io.mockk:mockk")

spring-boot-project/spring-boot-test/src/main/java/org/springframework/boot/test/web/htmlunit/LocalHostWebClient.java

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2019 the original author or authors.
2+
* Copyright 2012-2024 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -18,9 +18,9 @@
1818

1919
import java.io.IOException;
2020

21-
import com.gargoylesoftware.htmlunit.FailingHttpStatusCodeException;
22-
import com.gargoylesoftware.htmlunit.Page;
23-
import com.gargoylesoftware.htmlunit.WebClient;
21+
import org.htmlunit.FailingHttpStatusCodeException;
22+
import org.htmlunit.Page;
23+
import org.htmlunit.WebClient;
2424

2525
import org.springframework.core.env.Environment;
2626
import org.springframework.util.Assert;

spring-boot-project/spring-boot-test/src/main/java/org/springframework/boot/test/web/htmlunit/webdriver/LocalHostWebConnectionHtmlUnitDriver.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2019 the original author or authors.
2+
* Copyright 2012-2024 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -16,7 +16,7 @@
1616

1717
package org.springframework.boot.test.web.htmlunit.webdriver;
1818

19-
import com.gargoylesoftware.htmlunit.BrowserVersion;
19+
import org.htmlunit.BrowserVersion;
2020
import org.openqa.selenium.Capabilities;
2121

2222
import org.springframework.core.env.Environment;

spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/web/htmlunit/LocalHostWebClientTests.java

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2023 the original author or authors.
2+
* Copyright 2012-2024 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -19,10 +19,10 @@
1919
import java.io.IOException;
2020
import java.net.URL;
2121

22-
import com.gargoylesoftware.htmlunit.StringWebResponse;
23-
import com.gargoylesoftware.htmlunit.WebClient;
24-
import com.gargoylesoftware.htmlunit.WebConnection;
25-
import com.gargoylesoftware.htmlunit.WebResponse;
22+
import org.htmlunit.StringWebResponse;
23+
import org.htmlunit.WebClient;
24+
import org.htmlunit.WebConnection;
25+
import org.htmlunit.WebResponse;
2626
import org.junit.jupiter.api.Test;
2727
import org.junit.jupiter.api.extension.ExtendWith;
2828
import org.mockito.junit.jupiter.MockitoExtension;

spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/web/htmlunit/webdriver/LocalHostWebConnectionHtmlUnitDriverTests.java

+8-8
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2023 the original author or authors.
2+
* Copyright 2012-2024 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -18,13 +18,13 @@
1818

1919
import java.net.URL;
2020

21-
import com.gargoylesoftware.htmlunit.BrowserVersion;
22-
import com.gargoylesoftware.htmlunit.TopLevelWindow;
23-
import com.gargoylesoftware.htmlunit.WebClient;
24-
import com.gargoylesoftware.htmlunit.WebClientOptions;
25-
import com.gargoylesoftware.htmlunit.WebConsole;
26-
import com.gargoylesoftware.htmlunit.WebRequest;
27-
import com.gargoylesoftware.htmlunit.WebWindow;
21+
import org.htmlunit.BrowserVersion;
22+
import org.htmlunit.TopLevelWindow;
23+
import org.htmlunit.WebClient;
24+
import org.htmlunit.WebClientOptions;
25+
import org.htmlunit.WebConsole;
26+
import org.htmlunit.WebRequest;
27+
import org.htmlunit.WebWindow;
2828
import org.junit.jupiter.api.Test;
2929
import org.junit.jupiter.api.extension.ExtendWith;
3030
import org.mockito.ArgumentMatcher;

spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-test/build.gradle

+2-2
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,12 @@ dependencies {
1212
runtimeOnly("com.h2database:h2")
1313

1414
testImplementation(project(":spring-boot-project:spring-boot-starters:spring-boot-starter-test"))
15-
testImplementation("net.sourceforge.htmlunit:htmlunit") {
15+
testImplementation("org.htmlunit:htmlunit") {
1616
exclude group: "commons-logging", module: "commons-logging"
1717
}
1818
testImplementation("org.mockito:mockito-junit-jupiter")
1919
testImplementation("org.seleniumhq.selenium:selenium-api")
20-
testImplementation("org.seleniumhq.selenium:htmlunit-driver") {
20+
testImplementation("org.seleniumhq.selenium:htmlunit3-driver") {
2121
exclude group: "commons-logging", module: "commons-logging"
2222
exclude(group: "com.sun.activation", module: "jakarta.activation")
2323
}

spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-test/src/test/java/smoketest/test/web/UserVehicleControllerHtmlUnitTests.java

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2019 the original author or authors.
2+
* Copyright 2012-2024 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -16,8 +16,8 @@
1616

1717
package smoketest.test.web;
1818

19-
import com.gargoylesoftware.htmlunit.WebClient;
20-
import com.gargoylesoftware.htmlunit.html.HtmlPage;
19+
import org.htmlunit.WebClient;
20+
import org.htmlunit.html.HtmlPage;
2121
import org.junit.jupiter.api.Test;
2222
import smoketest.test.service.VehicleDetails;
2323

0 commit comments

Comments
 (0)