void () { PsiClass psiClass = findClass(getModule1(), CLASS_NAME); PsiMethod psiMethod = psiClass.findMethodsByName("main", false)[0]; ApplicationConfiguration configuration = createConfiguration(psiMethod); RunnerAndConfigurationSettingsImpl settings = new RunnerAndConfigurationSettingsImpl(RunManagerImpl.getInstanceImpl(myProject), configuration); ExecutionEnvironment e = ExecutionEnvironmentBuilder.createOrNull(DefaultRunExecutor.getRunExecutorInstance(), settings).build(); MapDataContext dataContext = new MapDataContext(); dataContext.put(ExecutionDataKeys.EXECUTION_ENVIRONMENT, e); AnActionEvent event = TestActionEvent.createTestEvent(dataContext); new CreateAction().update(event); assertTrue(event.getPresentation().isEnabledAndVisible()); }