The inspection reports apiVersion() method calls of MockMvcTester and WebTestClient when ApiVersionInserter isn't configured for a test.

For example:


@WebMvcTest(MyController.class)
public class MvcTest {

    @Test
    void testEndpoint(@Autowired MockMvcTester tester) {
        tester.get().uri("/hello")
                .apiVersion(1.1)
                .assertThat()
                .hasStatusOk();
    }
}

In this case a test configuration should be added for the test:


@WebMvcTest(MyController.class)
public class MvcTest {

    // ... tests

    @TestConfiguration
    static class MvcTestConfig implements MockMvcBuilderCustomizer {
        @Override
        public void customize(ConfigurableMockMvcBuilder builder) {
            builder.apiVersionInserter(ApiVersionInserter.useHeader("Api-Version"));
        }
    }
}