Github user gerlowskija commented on a diff in the pull request: https://github.com/apache/lucene-solr/pull/425#discussion_r204600183 --- Diff: solr/core/src/test/org/apache/solr/cloud/TestAuthenticationFramework.java --- @@ -78,17 +79,11 @@ public void testBasics() throws Exception { MockAuthenticationPlugin.expectedPassword = "s0lrRocks"; // Should fail with 401 - try { - collectionCreateSearchDeleteTwice(); - fail("Should've returned a 401 error"); - } catch (Exception ex) { - if (!ex.getMessage().contains("Error 401")) { - fail("Should've returned a 401 error"); - } - } finally { - MockAuthenticationPlugin.expectedUsername = null; - MockAuthenticationPlugin.expectedPassword = null; - } + HttpSolrClient.RemoteSolrException e = expectThrows(HttpSolrClient.RemoteSolrException.class, + this::collectionCreateSearchDeleteTwice); + assertTrue("Should've returned a 401 error", e.getMessage().contains("Error 401")); + MockAuthenticationPlugin.expectedUsername = null; --- End diff -- [-1] I think we need to keep the `MockAuthenticationPlugin` calls within a "finally"-block. See the related comment in SolrXmlInZkTest.java above.
--- --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@lucene.apache.org For additional commands, e-mail: dev-h...@lucene.apache.org