@Test
    void testVariantInReferencedAndParentWithOtherMatchingVariant() {
        QueryProfileRegistry registry = new QueryProfileRegistry();
        QueryProfile parent = new QueryProfile("parent");
        parent.setDimensions(new String[]{"x", "y"});
        parent.set("other", "otherValue", new String[]{"x1", "y1"}, registry);
        QueryProfile profile = new QueryProfile("test");
        profile.addInherited(parent);
        QueryProfile referenced = new QueryProfile("referenced");
        referenced.setDimensions(new String[]{"x", "y", "z"});
        registry.register(parent);
        registry.register(profile);
        registry.register(referenced);
        profile.set("a.b", referenced, registry);
        referenced.set("c", "default_value", registry);
        referenced.set("c", "variant_value", new String[]{"x1", null, "z1"}, registry);

        CompiledQueryProfileRegistry cRegistry = registry.compile();
        CompiledQueryProfile cTest = cRegistry.findQueryProfile("test");

        assertEquals("default_value", new Query("?", cTest).properties().get("a.b.c"));
        assertEquals("variant_value", new Query("?x=x1&y=y1&z=z1", cTest).properties().get("a.b.c"));

        {
            Map<String, ValueWithSource> values = cRegistry.findQueryProfile("test")
                    .listValuesWithSources(CompoundName.empty,
                            new HashMap<>(),
                            null);
            assertEquals(1, values.size());
            assertEquals("default_value", values.get("a.b.c").value());
            assertEquals("referenced", values.get("a.b.c").source());
            assertTrue(values.get("a.b.c").variant().isEmpty());
        }

        {
            Map<String, ValueWithSource> values = cRegistry.findQueryProfile("test")
                    .listValuesWithSources(CompoundName.empty,
                            toMap("x=x1", "y=y1", "z=z1"),
                            null);
            assertEquals(2, values.size());
            assertEquals("variant_value", values.get("a.b.c").value());
            assertEquals("referenced", values.get("a.b.c").source());
            assertEquals("[x1, *, z1]", values.get("a.b.c").variant().get().toString());

            assertEquals("otherValue", values.get("other").value());
            assertEquals("parent", values.get("other").source());
            assertEquals("[x1, y1]", values.get("other").variant().get().toString());
        }
    }
Tests referencing a variant which modifies the dimension set,
and also setting a value within that variants subspace.
container-search/src/test/java/com/yahoo/search/query/profile/test/QueryProfileVariantsTestCase.java