void (Runnable setupExisting) { myFixture.addClass("package junit.framework; public class TestCase {}"); myFixture.configureByText("MainTest.java", """ public class <caret>MainTest extends junit.framework.TestCase { public static void main(String[] args) { } public void testFoo() { } }"""); if (setupExisting != null) { setupExisting.run(); } List<GutterMark> marks = myFixture.findGuttersAtCaret(); assertEquals(1, marks.size()); GutterIconRenderer mark = (GutterIconRenderer)marks.get(0); ActionGroup group = mark.getPopupMenuActions(); assertNotNull(group); AnActionEvent event = TestActionEvent.createTestEvent(); List<AnAction> list = ContainerUtil.findAll(group.getChildren(event), action -> { AnActionEvent actionEvent = TestActionEvent.createTestEvent(); action.update(actionEvent); String text = actionEvent.getPresentation().getText(); return text != null && text.startsWith("Run '") && text.endsWith("'"); }); assertEquals(list.toString(), 2, list.size()); list.get(0).update(event); assertEquals("Run 'MainTest.main()'", event.getPresentation().getText()); list.get(1).update(event); assertEquals("Run 'MainTest'", event.getPresentation().getText()); myFixture.testAction(list.get(1)); NonBlockingReadActionImpl.waitForAsyncTaskCompletion(); RunnerAndConfigurationSettings selectedConfiguration = RunManager.getInstance(getProject()).getSelectedConfiguration(); myTempSettings.add(selectedConfiguration); assertEquals("MainTest", selectedConfiguration.getName()); }