@Test
  @Parameters(method = "getRegionTypeAndOperation")
  @TestCaseName("[{index}] {method}(RegionType:{0};Operation:{1})")
  public void indexesShouldBeMarkedAsInvalidDuringMappingRemovalOrAdditionAfterRegionOperationOnServerWhenMethodAuthorizerIsChangedAndIndexExpressionContainsMethodsNotAllowedByTheNewAuthorizer(
      RegionShortcut regionShortcut, Operation operation) {
    String regionName = testName.getMethodName();
    createAndPopulateRegion(regionName, regionShortcut);

    server.invoke(() -> {
      InternalCache internalCache = ClusterStartupRule.getCache();
      assertThat(internalCache).isNotNull();
      Region<Integer, QueryObject> region = internalCache.getRegion(regionName);

      // Index is valid.
      QueryService queryService = internalCache.getQueryService();
      queryService.createIndex(ID_INDEX_IDENTIFIER, "e." + QueryObject.GET_ID_METHOD,
          SEPARATOR + regionName + " e");
      Index index = queryService.getIndex(internalCache.getRegion(regionName), ID_INDEX_IDENTIFIER);
      assertThat(index.isValid()).isTrue();

      // Operation to invoke.
      ThrowableAssert.ThrowingCallable operationCallable =
          getRegionOperation(operation, region);

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

      // Execute operation, should succeed but index modification should fail, marking it as
      // invalid.
      assertThatCode(operationCallable).doesNotThrowAnyException();
      Index indexInvalid =
          queryService.getIndex(internalCache.getRegion(regionName), ID_INDEX_IDENTIFIER);
      assertThat(indexInvalid.isValid()).isFalse();

      // Assert operation result.
      assertRegionOperationResult(operation, region);
    });

    // Assert index modification failure was logged.
    LogFileAssert.assertThat(logFile)
        .contains(RestrictedMethodAuthorizer.UNAUTHORIZED_STRING + QueryObject.GET_ID_METHOD);
  }
The test creates an index with a method invocation as part of the expression, changes
the {@link MethodInvocationAuthorizer} to the default one (denies everything) and executes a
region operation on the server that would cause an index mapping removal/addition.
The operation should succeed, the index should be marked as invalid and the error should be
logged.
geode-core/src/distributedTest/java/org/apache/geode/cache/query/internal/QueryConfigurationServiceConstraintsDistributedTest.java