public ResourceGroupId expandTemplate(VariableMap context)
    {
        ResourceGroupId id = null;
        for (ResourceGroupNameTemplate segment : segments) {
            String expanded = segment.expandTemplate(context);
            if (id == null) {
                id = new ResourceGroupId(expanded);
            }
            else {
                id = new ResourceGroupId(id, expanded);
            }
        }
        return id;
    }
@Test
    public void testSchemaExpansion()
    {
        ResourceGroupIdTemplate template = new ResourceGroupIdTemplate("test.${SCHEMA}");
        assertEquals(template.expandTemplate(new VariableMap(ImmutableMap.of("SCHEMA", "schema", "USER", "alice.smith", "SOURCE", "s"))), new ResourceGroupId(new ResourceGroupId("test"), "schema"));
    }