@Test
public void testExpandQname() {

    // match no path because the list of the allowed paths is empty
    {
        final List<SchemaPath> paths = new ArrayList<>();
        final Pattern regexPattern = Pattern.compile(".*"); // match everything
        final List<SchemaPath> matchingPaths = Util.expandQname(paths, regexPattern);
        assertTrue(matchingPaths.isEmpty());
    }
    // match no path because of regex pattern
    {
        final List<SchemaPath> paths = createSchemaPathList();
        final Pattern regexPattern = Pattern.compile("^@.*");
        final List<SchemaPath> matchingPaths = Util.expandQname(paths, regexPattern);
        assertTrue(matchingPaths.isEmpty());
    }
    // match all paths
    {
        final List<SchemaPath> paths = createSchemaPathList();
        final Pattern regexPattern = Pattern.compile(".*");
        final List<SchemaPath> matchingPaths = Util.expandQname(paths, regexPattern);
        assertTrue(matchingPaths.contains(paths.get(0)));
        assertTrue(matchingPaths.contains(paths.get(1)));
        assertEquals(paths.size(), matchingPaths.size());
    }
    // match one path only
    {
        final List<SchemaPath> paths = createSchemaPathList();
        final Pattern regexPattern = Pattern.compile(".*yyy$");
        final List<SchemaPath> matchingPaths = Util.expandQname(paths, regexPattern);
        assertTrue(matchingPaths.contains(paths.get(1)));
        assertEquals(1, matchingPaths.size());
    }
}