Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,8 @@ Therefore, we have a total of 17 profiles:
| integration-jdk24 | JDK24 projects | *IntegrationTest |
| default-jdk25 | JDK25 projects | *UnitTest |
| integration-jdk25 | JDK25 projects | *IntegrationTest |
| default-jdk26 | JDK26 projects | *UnitTest |
| integration-jdk26 | JDK26 projects | *IntegrationTest |
| default-heavy | Heavy/long running projects | *UnitTest |
| integration-heavy | Heavy/long running projects | *IntegrationTest |
| default-jdk8 | JDK8 projects | *UnitTest |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ public void shouldNotFollowRedirectWhenSetToDefaultNever() throws IOException, I
HttpRequest request = HttpRequest.newBuilder()
.uri(new URI("http://stackoverflow.com"))
.version(HttpClient.Version.HTTP_1_1)
.header("User-Agent", "Mozilla/5.0")
.GET()
.build();
HttpResponse<String> response = HttpClient.newBuilder()
Expand All @@ -70,7 +71,7 @@ public void shouldNotFollowRedirectWhenSetToDefaultNever() throws IOException, I
@Test
public void shouldFollowRedirectWhenSetToAlways() throws IOException, InterruptedException, URISyntaxException {
HttpRequest request = HttpRequest.newBuilder()
.uri(new URI("http://stackoverflow.com"))
.uri(new URI("https://postman-echo.com/redirect-to?url=https://postman-echo.com/get"))
.version(HttpClient.Version.HTTP_1_1)
.GET()
.build();
Expand All @@ -82,7 +83,7 @@ public void shouldFollowRedirectWhenSetToAlways() throws IOException, Interrupte
assertThat(response.statusCode(), equalTo(HttpURLConnection.HTTP_OK));
assertThat(response.request()
.uri()
.toString(), equalTo("https://stackoverflow.com/questions"));
.toString(), equalTo("https://postman-echo.com/get"));
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public void shouldReturnStatusOKWhenSendGetRequest() throws IOException, Interru
@Test
public void shouldUseHttp2WhenWebsiteUsesHttp2() throws IOException, InterruptedException, URISyntaxException {
HttpRequest request = HttpRequest.newBuilder()
.uri(new URI("https://stackoverflow.com/questions"))
.uri(new URI("https://www.baeldung.com"))
.version(HttpClient.Version.HTTP_2)
.GET()
.build();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public void shouldReturnStatusOKWhenSendGetRequest() throws IOException, Interru
@Test
public void shouldResponseURIDifferentThanRequestURIWhenRedirect() throws IOException, InterruptedException, URISyntaxException {
HttpRequest request = HttpRequest.newBuilder()
.uri(new URI("http://stackoverflow.com"))
.uri(new URI("http://postman-echo.com/redirect-to?url=https://postman-echo.com/get"))
.version(HttpClient.Version.HTTP_2)
.GET()
.build();
Expand All @@ -46,9 +46,9 @@ public void shouldResponseURIDifferentThanRequestURIWhenRedirect() throws IOExce
.send(request, HttpResponse.BodyHandlers.ofString());

assertThat(request.uri()
.toString(), equalTo("http://stackoverflow.com"));
.toString(), equalTo("http://postman-echo.com/redirect-to?url=https://postman-echo.com/get"));
assertThat(response.uri()
.toString(), equalTo("https://stackoverflow.com/questions"));
.toString(), equalTo("https://postman-echo.com/get"));
}

}
79 changes: 79 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1018,6 +1018,48 @@

</profile>

<profile>
<id>default-jdk26</id>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<forkCount>3</forkCount>
<reuseForks>true</reuseForks>
<includes>
<include>SpringContextTest</include>
<include>**/*UnitTest</include>
</includes>
<excludes>
<exclude>**/*IntegrationTest.java</exclude>
<exclude>**/*IntTest.java</exclude>
<exclude>**/*LongRunningUnitTest.java</exclude>
<exclude>**/*ManualTest.java</exclude>
<exclude>**/JdbcTest.java</exclude>
<exclude>**/*LiveTest.java</exclude>
</excludes>
</configuration>
</plugin>
</plugins>
</build>

<modules>

</modules>

<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<java.version>26</java.version>
<maven.compiler.source>26</maven.compiler.source>
<maven.compiler.target>26</maven.compiler.target>
<maven-pmd-plugin.version>3.26.0</maven-pmd-plugin.version>
</properties>

</profile>


<profile>
<id>integration-jdk17</id>
<build>
Expand Down Expand Up @@ -1478,6 +1520,43 @@

</profile>

<profile>
<id>integration-jdk26</id>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>${maven-surefire-plugin.version}</version>
<configuration>
<excludes>
<exclude>**/*ManualTest.java</exclude>
<exclude>**/*LiveTest.java</exclude>
</excludes>
<includes>
<include>**/*IntegrationTest.java</include>
<include>**/*IntTest.java</include>
</includes>
</configuration>
</plugin>
</plugins>
</build>

<modules>

</modules>

<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<java.version>26</java.version>
<maven.compiler.source>26</maven.compiler.source>
<maven.compiler.target>26</maven.compiler.target>
<maven-pmd-plugin.version>3.26.0</maven-pmd-plugin.version>
</properties>

</profile>


<profile>
<id>live-all</id>
<build>
Expand Down