Artifact (Project project, String artifactName) { final ArtifactManager manager = ArtifactManager.getInstance(project); final Artifact artifact = ApplicationManager.getApplication().isReadAccessAllowed() ? manager.findArtifact(artifactName) : ReadAction.compute(() -> manager.findArtifact(artifactName)); assertNotNull("'" + artifactName + "' artifact not found", artifact); return artifact; }