@Override
    public void configure(final String name, final Collection<String> healthCheckUrlPaths,
                          final HealthResponseProvider healthResponseProvider,
                          final HealthEnvironment health, final JerseyEnvironment jersey,
                          final ServletEnvironment servlets, final ObjectMapper mapper) {
        final ServletHealthResponder servlet = new ServletHealthResponder(healthResponseProvider, cacheControlEnabled,
            cacheControlValue);
        servlets
            .addServlet(name + SERVLET_SUFFIX, servlet)
            .addMapping(healthCheckUrlPaths.toArray(new String[0]));
    }
@Test
    void testBuildHealthServlet() throws Exception {
        // given
        HealthResponderFactory factory = configFactory.build(new ResourceConfigurationSourceProvider(), "/yml/servlet-responder-factory-caching.yml");
        setupServletStubbing();

        // when
        // succeed first, fail second
        when(healthResponseProvider.healthResponse(Collections.emptyMap())).thenReturn(SUCCESS, FAIL);
        factory.configure(NAME, Collections.singletonList(HEALTH_CHECK_URI), healthResponseProvider, health, jersey,
            servlets, mapper);
        servletTester.addServlet(new ServletHolder(servletCaptor.getValue()), HEALTH_CHECK_URI);
        servletTester.start();
        HttpTester.Response healthyResponse = executeRequest(request);
        HttpTester.Response unhealthyResponse = executeRequest(request);

        // then
        assertThat(healthyResponse.getStatus()).isEqualTo(Response.SC_OK);
        assertThat(unhealthyResponse.getStatus()).isEqualTo(Response.SC_SERVICE_UNAVAILABLE);
    }