in src/main/java/org/apache/sling/testing/resourceresolver/MockResourceResolver.java [522:540]
public Resource copy(String srcAbsPath, String destAbsPath) throws PersistenceException {
Resource source = getResource(srcAbsPath);
if (source == null) {
throw new PersistenceException("Copy source does not exist");
}
Resource destinationParent = getResource(destAbsPath);
if (destinationParent == null) {
throw new PersistenceException("Copy destination does not exist");
}
if (destinationParent.getChild(source.getName()) != null) {
throw new PersistenceException("A resource with the same name already exists at " + destAbsPath);
}
recursivelyCreate(source, destinationParent);
Resource destination = getResource(destAbsPath + "/" + source.getName());
if (destination == null) {
throw new PersistenceException("Something went wrong");
}
return destination;
}