void () { VirtualFile file = createFile("file.txt", "a"); final Artifact a = addArtifact(root().dir("myArchive").file(file)); /// Because of some reason the old directory is not cleared, but I actually test the rename itself here //make(a); //assertOutput(a, fs().dir("myArchive").file("file.txt")); WriteAction.runAndWait(() -> { ModifiableArtifactModel model = getArtifactManager().createModifiableModel(); CompositePackagingElement<?> rootElement = model.getOrCreateModifiableArtifact(a).getRootElement(); DirectoryPackagingElement element = (DirectoryPackagingElement)rootElement.getChildren().get(0); element.rename("AnotherName"); model.commit(); }); make(a); assertOutput(a, fs().dir("AnotherName").file("file.txt")); }