Skip to content

Commit e5c4803

Browse files
committed
Support multiple exception messages
1 parent 6ec4e2c commit e5c4803

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

aws-crt-kotlin/common/test/aws/sdk/kotlin/crt/http/HttpClientConnectionTest.kt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -71,8 +71,8 @@ class HttpClientConnectionTest : CrtTest() {
7171
// bad ssl
7272
// assertConnect("https://rsa2048.badssl.com/")
7373
assertConnect("http://http.badssl.com/")
74-
assertConnectFails("https://expired.badssl.com/", "TLS (SSL) negotiation failed")
75-
assertConnectFails("https://self-signed.badssl.com/", "TLS (SSL) negotiation failed")
74+
assertConnectFails("https://expired.badssl.com/", listOf("TLS (SSL) negotiation failed", "Certificate has expired"))
75+
assertConnectFails("https://self-signed.badssl.com/", listOf("TLS (SSL) negotiation failed", "Certificate has expired"))
7676
}
7777

7878
/**
@@ -90,9 +90,9 @@ class HttpClientConnectionTest : CrtTest() {
9090
/**
9191
* Assert that an attempt to connect to the given [url] fails with the given [exceptionMessage]
9292
*/
93-
private suspend fun assertConnectFails(url: String, exceptionMessage: String) {
93+
private suspend fun assertConnectFails(url: String, exceptionMessages: List<String>) {
9494
val ex = assertFails { connectAllCiphers(url) }
95-
assertTrue(ex.message!!.contains(exceptionMessage))
95+
assertTrue(exceptionMessages.any { ex.message!!.contains(it) }, "Expected one of ${exceptionMessages.joinToString(", ")} in exception message, but got: ${ex.message}")
9696
}
9797

9898
/**

0 commit comments

Comments
 (0)