@Override
    public void filter(ContainerRequestContext requestContext) throws IOException {
        if (resourceInfo.getResourceMethod().isAnnotationPresent(SupportedSearchVersion.class) ||
                resourceInfo.getResourceMethod().isAnnotationPresent(SupportedSearchVersions.class)) {
            checkVersion(resourceInfo.getResourceMethod().getAnnotationsByType(SupportedSearchVersion.class));
        } else if (resourceInfo.getResourceClass().isAnnotationPresent(SupportedSearchVersion.class) ||
                resourceInfo.getResourceClass().isAnnotationPresent(SupportedSearchVersions.class)) {
            checkVersion(resourceInfo.getResourceClass().getAnnotationsByType(SupportedSearchVersion.class));
        }
    }
@Test
    public void testFilterWithMultipleDistributionsFail() throws Exception {
        final Method resourceMethod = TestResourceWithMultipleSupportedVersions.class.getMethod("methodWithAnnotation");
        when(resourceInfo.getResourceMethod()).thenReturn(resourceMethod);
        when(versionProvider.get()).thenReturn(elasticSearchV7);

        Exception exception = assertThrows(InternalServerErrorException.class, () -> {
            filter.filter(requestContext);
        });

        assertTrue(exception.getMessage().contains("Elasticsearch ^6") && exception.getMessage().contains("OpenSearch 1.0"));
        verify(versionProvider, times(1)).get();
    }