emiliosetiadarma commented on code in PR #6262:
URL: https://github.com/apache/nifi/pull/6262#discussion_r934793368


##########
nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-cluster/src/test/java/org/apache/nifi/cluster/coordination/http/replication/TestThreadPoolRequestReplicator.java:
##########
@@ -352,26 +353,20 @@ protected NodeResponse replicateRequest(final 
PreparedRequest request, final Nod
             }
         };
 
-        try {
-            // set the user
+        final Exception exception = assertThrows(Exception.class, () -> {
             final Authentication authentication = new 
NiFiAuthenticationToken(new NiFiUserDetails(StandardNiFiUser.ANONYMOUS));
             
SecurityContextHolder.getContext().setAuthentication(authentication);
 
             final AsyncClusterResponse clusterResponse = 
replicator.replicate(nodeIds, HttpMethod.POST,
                     new URI("http://localhost:80/processors/1";), new 
ProcessorEntity(), new HashMap<>(), true, true);
             clusterResponse.awaitMergedResponse();
-
-            Assert.fail("Expected to get an IllegalClusterStateException but 
did not");
-        } catch (final IllegalClusterStateException e) {
-            // Expected
-        } catch (final Exception e) {
-            Assert.fail(e.toString());
-        } finally {
-            replicator.shutdown();
-        }
+        });
+        assertTrue(exception instanceof IllegalClusterStateException);

Review Comment:
   Changing it to expect the IllegalClusterException



-- 
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: issues-unsubscr...@nifi.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to