@Test
  @Parameters(named = "parameters")
  @TestCaseName("{method}(regionShortcut={0}, operation={1}, executeWithInitialResults={2})")
  public void cqsShouldFailDuringEventProcessingAfterRegionOperationWhenMethodAuthorizerIsChangedAndQueryContainsMethodsNotAllowedByTheNewAuthorizer(
      RegionShortcut regionShortcut, Operation operation, boolean executeWithInitialResults) {
    serverVM.invoke(() -> {
      createRegion(regionShortcut);
      populateRegion();
    });

    clientVM.invoke(() -> createClientCq(queryString, executeWithInitialResults));

    serverVM.invoke(() -> {
      InternalCache internalCache = (InternalCache) serverLauncher.getCache();
      assertThat(internalCache.getCqService().getAllCqs()).hasSize(1);

      // Make Sure Cq is running before continuing.
      internalCache.getCqService().getAllCqs()
          .forEach(cq -> await().untilAsserted(() -> assertThat(cq.isRunning()).isTrue()));

      // Change the authorizer (deny everything not allowed by default).
      internalCache.getService(QueryConfigurationService.class).updateMethodAuthorizer(
          internalCache, true, RestrictedMethodAuthorizer.class.getName(), Collections.emptySet());

      // Execute operations that would cause the CQ to process the event.
      doOperations(operation);

      validateRegionValues();
    });

    clientVM.invoke(() -> {
      await().untilAsserted(
          () -> assertThat(cqListener.getErrorCount()).isEqualTo(Operation.values().length));
      assertThat(cqListener.getEventCount()).isEqualTo(0);
    });

    // No errors logged on server side.
    File logFile = new File(new File(temporaryFolder.getRoot(), "server"), "server.log");
    LogFileAssert
        .assertThat(logFile)
        .contains(RestrictedMethodAuthorizer.UNAUTHORIZED_STRING);
  }
The test creates a CQ with a method invocation as part of the expression, changes
the {@link MethodInvocationAuthorizer} to the default one (denies everything) and executes
all region operations that would fire the CQ.
The operations should succeed, the CQ should fire 'onError' and the issues should be logged.
geode-cq/src/distributedTest/java/org/apache/geode/cache/query/internal/QueryConfigurationServiceConstraintsDistributedTest.java