exceptionfactory commented on a change in pull request #5870:
URL: https://github.com/apache/nifi/pull/5870#discussion_r828497992



##########
File path: 
nifi-registry/nifi-registry-extensions/nifi-registry-ranger/nifi-registry-ranger-plugin/src/test/java/org/apache/nifi/registry/ranger/TestRangerAuthorizer.java
##########
@@ -220,26 +204,7 @@ public void testKerberosEnabledWithoutKeytabOrPrincipal() {
         
when(registryProperties.getKerberosServiceKeytabLocation()).thenReturn("");
         when(registryProperties.getKerberosServicePrincipal()).thenReturn("");
 
-        try {
-            setup(registryProperties, mock(UserGroupProvider.class), 
configurationContext);
-            Assert.fail("Should have thrown exception");
-        } catch (SecurityProviderCreationException e) {
-            // want to make sure this exception is from our authorizer code
-            verifyOnlyAuthorizeCreationExceptions(e);
-        }
-    }
-
-    private void 
verifyOnlyAuthorizeCreationExceptions(SecurityProviderCreationException e) {
-        boolean foundOtherException = false;
-        Throwable cause = e.getCause();
-        while (cause != null) {
-            if (!(cause instanceof SecurityProviderCreationException)) {
-                foundOtherException = true;
-                break;
-            }
-            cause = cause.getCause();
-        }
-        assertFalse(foundOtherException);
+        assertThrows(SecurityProviderCreationException.class, () -> 
setup(registryProperties, mock(UserGroupProvider.class), configurationContext));

Review comment:
       As mentioned in relation to the other Ranger test changes, this does 
make the exception checking looser, trading off some precision for general test 
execution on all platforms.




-- 
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]


Reply via email to