public CaseInsensitiveString getAncestorName() {
        if (cachedAncestorName == null) {
            String stringPath = path();
            if (stringPath == null) {
                return null;
            }
            int index = stringPath.indexOf(DELIMITER);
            cachedAncestorName = index == -1 ? path : new CaseInsensitiveString(stringPath.substring(0, index));
        }
        return cachedAncestorName;
    }
@Test
    public void shouldUnderstandAncestorName() {
        PathFromAncestor path = new PathFromAncestor(new CaseInsensitiveString("grand-parent/parent/child"));
        assertThat(path.getAncestorName(), is(new CaseInsensitiveString("grand-parent")));
    }