Module (@NotNull TemporaryDirectory tempDir, Project project) { Path tempPath = tempDir.newPath(".iml"); ModuleManager moduleManager = ModuleManager.getInstance(project); Module result = WriteAction.compute(() -> moduleManager.newModule(tempPath, StdModuleTypes.JAVA.getId())); PlatformTestUtil.saveProject(project); return result; }