Mercurial > hg > monetdb-java
comparison tests/TLSTester.java @ 851:157dcb2d6516 monetdbs
relax wording of expected exception
author | Joeri van Ruth <joeri.van.ruth@monetdbsolutions.com> |
---|---|
date | Fri, 05 Jan 2024 11:56:03 +0100 (15 months ago) |
parents | 5aa19bbed0d6 |
children | 839d76eeb4ae |
comparison
equal
deleted
inserted
replaced
850:9f200daffa35 | 851:157dcb2d6516 |
---|---|
199 attempt.withFile(Parameter.CERT, "/ca1.crt").expectFailure(""); | 199 attempt.withFile(Parameter.CERT, "/ca1.crt").expectFailure(""); |
200 | 200 |
201 } | 201 } |
202 | 202 |
203 private void test_fail_plain_to_tls() throws IOException, SQLException { | 203 private void test_fail_plain_to_tls() throws IOException, SQLException { |
204 attempt("fail_plain_to_tls", "server1").with(Parameter.TLS, false).expectFailure("Cannot connect"); | 204 attempt("fail_plain_to_tls", "server1").with(Parameter.TLS, false).expectFailure("Cannot connect", "Could not connect"); |
205 } | 205 } |
206 | 206 |
207 private void test_connect_server_name() throws IOException, SQLException { | 207 private void test_connect_server_name() throws IOException, SQLException { |
208 Attempt attempt = attempt("connect_server_name", "sni"); | 208 Attempt attempt = attempt("connect_server_name", "sni"); |
209 attempt.withFile(Parameter.CERT, "/ca1.crt").expectSuccess(); | 209 attempt.withFile(Parameter.CERT, "/ca1.crt").expectSuccess(); |
303 } catch (SQLException e) { | 303 } catch (SQLException e) { |
304 for (String expected : expectedMessages) | 304 for (String expected : expectedMessages) |
305 if (e.getMessage().contains(expected)) | 305 if (e.getMessage().contains(expected)) |
306 return; | 306 return; |
307 String message = "Test " + testName + " threw the wrong exception: " + e.getMessage() + '\n' + "Expected:\n <" + String.join(">\n <", expectedMessages) + ">"; | 307 String message = "Test " + testName + " threw the wrong exception: " + e.getMessage() + '\n' + "Expected:\n <" + String.join(">\n <", expectedMessages) + ">"; |
308 throw new RuntimeException(message); | 308 throw new RuntimeException(message, e); |
309 | 309 |
310 } | 310 } |
311 } | 311 } |
312 | 312 |
313 } | 313 } |