in src/main/org/apache/ant/antunit/ResourceExists.java [88:108]
private Resource expandRefId() {
if (getProject() == null) {
throw new BuildException("Cannot retrieve refid; project unset");
}
Object o = getProject().getReference(refid);
if (!(o instanceof Resource)) {
if (o instanceof ResourceCollection) {
ResourceCollection rc = (ResourceCollection) o;
if (rc.size() == 1) {
o = rc.iterator().next();
} else {
throw new BuildException("Referred resource collection must"
+ " contain exactly one resource.");
}
} else {
throw new BuildException("'" + refid + "' is not a resource but "
+ String.valueOf(o));
}
}
return (Resource) o;
}