### Question:
SolverHandler { public void destroy() { solverExecutor.destroy(); solutionSynchronizer.destroy(); solutionProcessor.destroy(); executorService.shutdown(); try { executorService.awaitTermination(EXECUTOR_TERMINATION_TIMEOUT, TimeUnit.SECONDS); LOGGER.debug("ExecutorService was successfully shutted down."); } catch (InterruptedException e) { Thread.currentThread().interrupt(); LOGGER.debug("An exception was thrown during executionService graceful termination.", e); executorService.shutdownNow(); } } SolverHandler(final SolverDef solverDef,
                         final KieServerRegistry registry,
                         final TaskAssigningRuntimeDelegate delegate,
                         final UserSystemService userSystemService,
                         final ScheduledExecutorService executorService,
                         final SolverHandlerConfig config); void start(); void destroy();  }### Answer:
@Test public void destroy() throws Exception { prepareStart(); handler.destroy(); verifyDestroyCommonActions(); }
@Test(timeout = 5000) public void destroyWithTerminationError() throws Exception { ExecutorService executor = Executors.newSingleThreadExecutor(); executor.submit(() -> { try { prepareStart(); doThrow(new InterruptedException("Test Generated Error")).when(executorService.awaitTermination(anyInt(), any())); handler.destroy(); verifyDestroyCommonActions(); verify(executorService).shutdownNow(); } catch (Exception e) { } }).get(); executor.shutdown(); }