@Test
    void testModelAmending() {
        ConfigModelRegistry amendingModelRepo = MapConfigModelRegistry.createFromList(new AdminModelAmenderBuilder(),
                new ContainerModelAmenderBuilder(),
                new ContentModelAmenderBuilder());
        String services =
                "<services version='1.0'>" +
                        "    <admin version='4.0'/>" +
                        "    <container id='test1' version='1.0'>" +
                        "        <search/>" +
                        "        <nodes count='2'/>" +
                        "    </container>" +
                        "    <container id='test2' version='1.0'>" +
                        "        <http><server id='server1' port='" + Defaults.getDefaults().vespaWebServicePort() + "'/></http>" +
                        "        <document-api/>" +
                        "        <nodes count='2'/>" +
                        "    </container>" +
                        "    <content id='test3' version='1.0'>" +
                        "        <redundancy>1</redundancy>" +
                        "        <documents>" +
                        "            <document mode='index' type='type1'/>" +
                        "        </documents>" +
                        "        <nodes count='2'/>" +
                        "    </content>" +
                        "    <content id='test4' version='1.0'>" +
                        "        <redundancy>1</redundancy>" +
                        "        <documents>" +
                        "            <document mode='index' type='type1'/>" +
                        "        </documents>" +
                        "        <nodes count='3'/>" +
                        "    </content>" +
                        "</services>";
        VespaModelTester tester = new VespaModelTester(amendingModelRepo);
        tester.addHosts(12);
        DeployState.Builder builder = new DeployState.Builder().endpoints(Set.of(new ContainerEndpoint("test1", ApplicationClusterEndpoint.Scope.zone, List.of("t1.example.com")),
                                                                                 new ContainerEndpoint("test2", ApplicationClusterEndpoint.Scope.zone, List.of("t2.example.com"))));
        VespaModel model = tester.createModel(Zone.defaultZone(), services, true, builder);

        // Check that all hosts are amended
        for (HostResource host : model.getAdmin().hostSystem().getHosts()) {
            assertFalse(host.getHost().getChildrenByTypeRecursive(AmendedService.class).isEmpty(), host + " is amended");
        }

        // Check that container clusters are amended
        assertEquals(2, model.getContainerClusters().size());
        assertNotNull(model.getContainerClusters().get("test1").getComponentsMap().get(new ComponentId("com.yahoo.MyAmendedComponent")));
        assertNotNull(model.getContainerClusters().get("test2").getComponentsMap().get(new ComponentId("com.yahoo.MyAmendedComponent")));
    }
Demonstrates how a model can be added at build time to amend another model.
This is useful is situations where the core Vespa config models needs to be
modified by third party code which follows the installed environment rather than
the application.

@author bratseth
config-model/src/test/java/com/yahoo/vespa/model/test/ModelAmendingTestCase.java