### Question:
SolutionProcessor extends RunnableBase { public void process(final TaskAssigningSolution solution) { checkNotNull("solution", solution); if (!status.compareAndSet(STOPPED, STARTING)) { throw new IllegalStateException("SolutionProcessor process method can only be invoked when the status is STOPPED"); } this.solution = solution; solutionResource.release(); } SolutionProcessor(final TaskAssigningRuntimeDelegate delegate,
                             final Consumer<Result> resultConsumer,
                             final String targetUserId,
                             final int publishWindowSize); boolean isProcessing(); void process(final TaskAssigningSolution solution); @Override void destroy(); @Override void run();  }### Answer:
@Test(timeout = TEST_TIMEOUT) public void process() throws Exception { CompletableFuture future = startRunnableBase(); doReturn(result).when(delegate).executePlanning(generatedPlan, TARGET_USER_ID); TaskAssigningSolution solution = new TaskAssigningSolution(-1, new ArrayList<>(), new ArrayList<>()); runnableBase.process(solution); processingFinished.await(); verify(delegate).executePlanning(generatedPlan, TARGET_USER_ID); assertEquals(result, capturedResult.getExecutionResult()); runnableBase.destroy(); future.get(); assertTrue(runnableBase.isDestroyed()); }
@Test public void processWithInvalidStatusFailure() { TaskAssigningSolution solution = new TaskAssigningSolution(-1, new ArrayList<>(), new ArrayList<>()); runnableBase.process(solution); Assertions.assertThatThrownBy(() -> runnableBase.process(solution)) .hasMessage("SolutionProcessor process method can only be invoked when the status is STOPPED"); }