OperationManager implements AutoCloseable { public <A extends ClusterManagementOperation<V>, V extends OperationResult> OperationState<A, V> submit( A op) { OperationPerformer<A, V> performer = getPerformer(op); if (performer == null) { throw new IllegalArgumentException(String.format("%s is not supported.", op.getClass().getSimpleName())); } String opId = historyManager.recordStart(op, cache.getMyId().toString()); OperationState<A, V> operationState = historyManager.get(opId); CompletableFuture.supplyAsync(() -> performer.perform(cache, op), executor) .whenComplete((result, exception) -> { Throwable cause = exception == null ? null : exception.getCause(); historyManager.recordEnd(opId, result, cause); }); return operationState; } OperationManager(InternalCache cache, OperationHistoryManager historyManager); void registerOperation(
      Class<A> operationClass,
      OperationPerformer<A, V> performer); OperationState<A, V> submit(
      A op); OperationState<A, V> get(
      String opId); List<OperationState<A, V>> list(
      A opType); @Override void close();  }
@Test public void submitRogueOperation() { ClusterManagementOperation<?> operation = mock(ClusterManagementOperation.class); assertThatThrownBy(() -> executorManager.submit(operation)) .isInstanceOf(IllegalArgumentException.class) .hasMessageContaining(" is not supported."); }