public static Map<String,String> toMap(QueryProfile profile, String[] dimensionValues) {
        Map<String, String> context = new HashMap<>();
        List<String> dimensions;
        if (profile.getVariants() != null)
            dimensions = profile.getVariants().getDimensions();
        else
            dimensions = ((BackedOverridableQueryProfile)profile).getBacking().getVariants().getDimensions();

        for (int i = 0; i < dimensionValues.length; i++)
            context.put(dimensions.get(i), dimensionValues[i]); // Lookup dim. names to ease test...
        return context;
    }
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