mlbiscoc commented on code in PR #3362:
URL: https://github.com/apache/solr/pull/3362#discussion_r2103370398
##########
solr/solrj/src/test/org/apache/solr/client/solrj/impl/Http2SolrClientTest.java:
##########
@@ -69,7 +69,7 @@ public void testTimeout() throws Exception {
client.query(q, SolrRequest.METHOD.GET);
fail("No exception thrown.");
} catch (SolrServerException e) {
- assertTrue(e.getMessage().contains("timeout") ||
e.getMessage().contains("Timeout"));
+ assertTrue(isTimeout(e));
Review Comment:
For asserting on `Exceptions` could we `assertThrows` instead? Then assert
that it was a timeout after? I like that over asserting on a catch on all these
tests and the ones you updated below. Kinda of like this
```suggestion
SolrServerException exception = assertThrows("Expected an exception but no
expcetion thrown", SolrServerException.class, () -> {
// Run your logic to throw an excpetion
});
assertTrue("Expected a timeout exception but got: " +
exception.getMessage(), isTimeout(exception));
```
##########
solr/solrj/src/test/org/apache/solr/client/solrj/impl/Http2SolrClientTest.java:
##########
@@ -69,7 +69,7 @@ public void testTimeout() throws Exception {
client.query(q, SolrRequest.METHOD.GET);
fail("No exception thrown.");
} catch (SolrServerException e) {
- assertTrue(e.getMessage().contains("timeout") ||
e.getMessage().contains("Timeout"));
+ assertTrue(isTimeout(e));
Review Comment:
For asserting on `Exceptions` could we `assertThrows` instead? Then assert
that it was a timeout after? I like that over asserting on a catch on all these
tests and the ones you updated below. Kind of like this
```suggestion
SolrServerException exception = assertThrows("Expected an exception but no
expcetion thrown", SolrServerException.class, () -> {
// Run your logic to throw an excpetion
});
assertTrue("Expected a timeout exception but got: " +
exception.getMessage(), isTimeout(exception));
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]