void () { Element root = new Element("root"); final Element configuration = new Element("configuration"); configuration.setAttribute("value", "some text$macro5$fdsjfhdskjfsd$MACRO$"); configuration.setAttribute("value2", "file://$root$/some/path/just$file$name.txt"); root.addContent(configuration); final Set<String> macros = PathMacrosCollector.getMacroNames(root, new PathMacroFilter() { @Override public boolean recursePathMacros(@NotNull Attribute attribute) { return "value".equals(attribute.getName()); } }, new PathMacrosImpl(false)); UsefulTestCase.assertSameElements(macros, "macro5", "MACRO", "root"); }