Skip to content

Commit fa2f537

Browse files
committed
Be more lenient for exception messages to allow for JDK 25
1 parent 619daa1 commit fa2f537

File tree

2 files changed

+16
-9
lines changed

2 files changed

+16
-9
lines changed

extensions/vertx-http/deployment/src/test/java/io/quarkus/vertx/http/security/FluentApiMTLSAuthenticationRequiredDevModeTest.java

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package io.quarkus.vertx.http.security;
22

3+
import static org.assertj.core.api.Assertions.assertThat;
34
import static org.hamcrest.Matchers.is;
45
import static org.junit.jupiter.api.Assertions.assertTrue;
56

@@ -65,8 +66,9 @@ void testCustomCertificateToRolesMapper(RepetitionInfo info) {
6566
.get(url);
6667
Assertions.fail("SSL handshake failure not detected");
6768
} catch (Exception e) {
68-
var sslHandshakeFailed = e.getMessage().contains("Received fatal alert: bad_certificate");
69-
assertTrue(sslHandshakeFailed, () -> "Expected SSL handshake failure, but got: " + e.getMessage());
69+
assertThat(e.getMessage())
70+
.containsAnyOf("Received fatal alert: bad_certificate", "Received fatal alert: certificate_required")
71+
.describedAs("Expected SSL handshake failure, but got: " + e);
7072
}
7173
}
7274

@@ -80,15 +82,17 @@ void testPublicPathRequiresClientAuth() {
8082
.get(url);
8183
Assertions.fail("SSL handshake failure not detected");
8284
} catch (Exception e) {
83-
var sslHandshakeFailed = e.getMessage().contains("Received fatal alert: bad_certificate");
84-
assertTrue(sslHandshakeFailed, () -> "Expected SSL handshake failure, but got: " + e.getMessage());
85+
assertThat(e.getMessage())
86+
.containsAnyOf("Received fatal alert: bad_certificate", "Received fatal alert: certificate_required")
87+
.describedAs("Expected SSL handshake failure, but got: " + e);
8588
}
8689
}
8790

8891
@Test
8992
void testInsecureRequestsDenied() {
9093
try {
91-
RestAssured.given().get(publicPath);
94+
URL url = correctPortIfNecessary(publicPath);
95+
RestAssured.given().get(url);
9296
Assertions.fail("Connection should be refused");
9397
} catch (Exception e) {
9498
var sslHandshakeFailed = e.getMessage().contains("Connection refused");

extensions/vertx-http/deployment/src/test/java/io/quarkus/vertx/http/security/FluentApiMTLSAuthenticationRequiredTest.java

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package io.quarkus.vertx.http.security;
22

3+
import static org.assertj.core.api.Assertions.assertThat;
34
import static org.hamcrest.Matchers.is;
45
import static org.junit.jupiter.api.Assertions.assertTrue;
56

@@ -60,8 +61,9 @@ void testCustomCertificateToRolesMapper() {
6061
.get(adminRoleTlsPath);
6162
Assertions.fail("SSL handshake failure not detected");
6263
} catch (Exception e) {
63-
var sslHandshakeFailed = e.getMessage().contains("Received fatal alert: bad_certificate");
64-
assertTrue(sslHandshakeFailed, () -> "Expected SSL handshake failure, but got: " + e.getMessage());
64+
assertThat(e.getMessage())
65+
.containsAnyOf("Received fatal alert: bad_certificate", "Received fatal alert: certificate_required")
66+
.describedAs("Expected SSL handshake failure, but got: " + e);
6567
}
6668
}
6769

@@ -74,8 +76,9 @@ void testPublicPathRequiresClientAuth() {
7476
.get(publicTlsPath);
7577
Assertions.fail("SSL handshake failure not detected");
7678
} catch (Exception e) {
77-
var sslHandshakeFailed = e.getMessage().contains("Received fatal alert: bad_certificate");
78-
assertTrue(sslHandshakeFailed, () -> "Expected SSL handshake failure, but got: " + e.getMessage());
79+
assertThat(e.getMessage())
80+
.containsAnyOf("Received fatal alert: bad_certificate", "Received fatal alert: certificate_required")
81+
.describedAs("Expected SSL handshake failure, but got: " + e);
7982
}
8083
}
8184

0 commit comments

Comments
 (0)