anshuksi282-ksolves commented on code in PR #11941:
URL: https://github.com/apache/nifi/pull/11941#discussion_r4612671675


##########
nifi-bootstrap/src/test/java/org/apache/nifi/bootstrap/command/StopBootstrapCommandTest.java:
##########
@@ -84,4 +84,19 @@ void testRunDestroyFailed() {
 
         assertEquals(CommandStatus.ERROR, commandStatus);
     }
+
+    @Test
+    void testRunDestroyForciblyCompleted() {
+        
when(processHandleProvider.findApplicationProcessHandle()).thenReturn(Optional.of(applicationProcessHandle));
+        when(applicationProcessHandle.destroy()).thenReturn(true);
+        when(applicationProcessHandle.destroyForcibly()).thenReturn(true);

Review Comment:
   @arvindKandpal-ksolves, Thanks for checking this. 
   With Mockito 5, unstubbed methods returning `Duration` return 
`Duration.ZERO` instead of `null`, so `getGracefulShutdownTimeout()` does not 
cause a `NullPointerException` here. In this test, `onExit().get()` on the 
failed future throws an `ExecutionException`, which follows the same path as a 
graceful shutdown timeout and leads to `destroyForcibly()`. Stubbing the 
timeout would not change the behavior, and the existing `testRunDestroyFailed` 
uses the same approach, so I kept the test as it is.



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