diff --git a/x-pack/plugin/security/src/test/java/org/elasticsearch/xpack/security/authc/AuthenticationServiceTests.java b/x-pack/plugin/security/src/test/java/org/elasticsearch/xpack/security/authc/AuthenticationServiceTests.java index 4c2d0587ebdc5..74ab1e704201d 100644 --- a/x-pack/plugin/security/src/test/java/org/elasticsearch/xpack/security/authc/AuthenticationServiceTests.java +++ b/x-pack/plugin/security/src/test/java/org/elasticsearch/xpack/security/authc/AuthenticationServiceTests.java @@ -1980,6 +1980,11 @@ public void testInvalidToken() throws Exception { when(projectIndex.getUnavailableReason(any())).thenReturn(new ElasticsearchException(getTestName())); } else { when(projectIndex.isAvailable(any())).thenReturn(true); + doAnswer(invocationOnMock -> { + Runnable runnable = (Runnable) invocationOnMock.getArguments()[1]; + runnable.run(); + return null; + }).when(projectIndex).checkIndexVersionThenExecute(anyConsumer(), any(Runnable.class)); doAnswer(inv -> { final GetRequest request = inv.getArgument(0); final ActionListener listener = inv.getArgument(1);