@Test
public void testNamedBy_privileges() {

    List<PrivilegeDefinition> defs = JsonCnd.getPrivilegesFromJson(obj()
            .key("jcr:canDo", obj())
            .key("jcr:willDo", obj()
                    .key(JsonCnd.PRIVILEGE_KEY_ABSTRACT, false))
            .key("jcr:wouldDoBut", obj()
                    .key(JsonCnd.PRIVILEGE_KEY_ABSTRACT, true))
            .key("jcr:none", obj()
                    .key(JsonCnd.PRIVILEGE_KEY_CONTAINS, arr()))
            .key("jcr:rw", obj()
                    .key(JsonCnd.PRIVILEGE_KEY_CONTAINS,
                            arr("jcr:read", "jcr:write", "jcr:addChildNodes")))
            .key("jcr:mightRw", obj()
                    .key(JsonCnd.PRIVILEGE_KEY_ABSTRACT, true)
                    .key(JsonCnd.PRIVILEGE_KEY_CONTAINS,
                            arr("jcr:read", "jcr:write", "jcr:removeNode")))
            .get(), getMapping());
    final List<String> jcrNames = Arrays.asList("jcr:canDo", "jcr:willDo", "jcr:wouldDoBut", "jcr:none", "jcr:rw",
            "jcr:mightRw", "jcr:read", "jcr:write", "jcr:addChildNodes", "jcr:removeNode");
    final Set<Name> expectNamedBy = jcrNames.stream().map(uncheck1(resolver::getQName)).collect(Collectors.toSet());
    final Set<Name> actualNamedBy = defs.stream().flatMap(JsonCnd::namedBy).collect(Collectors.toSet());
    assertEquals("expect namedBy", expectNamedBy, actualNamedBy);
}