@Test
    void providers_are_destroyed() {
        writeBootstrapConfigs("id1", DestructableProvider.class);

        ComponentDeconstructor deconstructor = (generation, components, bundles) -> {
            components.forEach(component -> {
                if (component instanceof AbstractComponent) {
                    ((AbstractComponent) component).deconstruct();
                } else if (component instanceof Provider) {
                    ((Provider<?>) component).deconstruct();
                }
            });
            if (!bundles.isEmpty()) throw new IllegalArgumentException("This test should not use bundles");
        };

        Container container = newContainer(dirConfigSource, deconstructor);

        ComponentGraph oldGraph = getNewComponentGraph(container);
        DestructableEntity destructableEntity = oldGraph.getInstance(DestructableEntity.class);

        writeBootstrapConfigs("id2", DestructableProvider.class);
        container.reloadConfig(2);
        ComponentGraph graph = getNewComponentGraph(container, oldGraph);

        assertTrue(destructableEntity.deconstructed);

        container.shutdownConfigRetriever();
        container.shutdown(graph);
    }
@author Tony Vaagenes
@author gjoranv
@author ollivir
container-core/src/test/java/com/yahoo/container/di/ContainerTest.java