private void doTest(@NotNull GoTestFunctionType type, @NotNull String beforeText, @NotNull String afterText) { myFixture.configureByText("test_test.go", beforeText); myFixture.testAction(new GotestGenerateAction(type)); myFixture.checkResult(afterText); } }
public void testHideIgnoredFilesActionInvocation() { final HideIgnoredFilesAction action = new HideIgnoredFilesAction(); Presentation presentation; presentation = myFixture.testAction(action); Assert.assertEquals(IgnoreBundle.message("action.hideIgnoredVisibility"), presentation.getText()); } }
protected void doTest(@NotNull String codeBefore, @NotNull String expectedCodeAfter, @NotNull String surrounderDescription, boolean apply) { PsiFile file = myFixture.configureByText("a.go", normalizeCode(codeBefore)); List<AnAction> applicable = SurroundWithHandler.buildSurroundActions(myFixture.getProject(), myFixture.getEditor(), file, null); if (applicable == null) { assertFalse(apply); return; } String suffix = ". " + surrounderDescription; for (AnAction action : applicable) { String actionPresentation = action.getTemplatePresentation().getText(); if (actionPresentation != null && StringUtil.endsWith(actionPresentation, suffix)) { assertTrue(apply); myFixture.testAction(action); return; } } if (apply) { myFixture.checkResult(normalizeCode(expectedCodeAfter), true); } } }
public void testAddTemplateActionInvocation() { final AddTemplateAction action = new AddTemplateAction(); Presentation presentation; presentation = myFixture.testAction(action); Assert.assertEquals(IgnoreBundle.message("action.addTemplate"), presentation.getText()); Assert.assertEquals(IgnoreBundle.message("action.addTemplate.description"), presentation.getDescription()); Assert.assertFalse("Action is not visible if there is no Ignore file context", presentation.isEnabledAndVisible()); myFixture.configureByText(IgnoreFileType.INSTANCE, "foo"); presentation = myFixture.testAction(action); Assert.assertTrue("Action is visible if there is Ignore file context", presentation.isEnabledAndVisible()); } }
public void testCloseIgnoredEditorsActionInvocation() { final CloseIgnoredEditorsAction action = new CloseIgnoredEditorsAction(); Presentation presentation; presentation = myFixture.testAction(action); assertEquals("Close Ignored", presentation.getText()); assertNull(presentation.getDescription()); assertFalse("Action is not visible if there is no Ignore file context", presentation.isEnabledAndVisible()); } }
public void testAddTemplateActionInvocation() { IgnoreFileAction action = new IgnoreFileAction(); Presentation presentation; presentation = myFixture.testAction(action); Assert.assertEquals(IgnoreBundle.message("action.addToIgnore", "null"), presentation.getText()); Assert.assertEquals(IgnoreBundle.message("action.addToIgnore.description", "null"), presentation.getDescription()); Assert.assertFalse("Action is not visible if there is no Ignore file context", presentation.isEnabledAndVisible()); } }
@Test(timeout = 60000) public void testConfigureProxyAction_update() throws Exception { final String serverUri = "http://server:8080/tfs/collection1"; mockRepositoryContextForProject(serverUri); final ProxySettingsDialog dialog = Mockito.mock(ProxySettingsDialog.class); PowerMockito.whenNew(ProxySettingsDialog.class).withAnyArguments().thenReturn(dialog); Mockito.when(dialog.showAndGet()).thenReturn(true); Mockito.when(dialog.getProxyUri()).thenReturn("http://proxy:8888"); // Make sure proxy is not set for the server Assert.assertNull(WorkspaceHelper.getProxyServer(serverUri)); // Run the action and verify that the proxy was set final ConfigureProxyAction action = new ConfigureProxyAction(); myCodeInsightFixture.testAction(action); Mockito.verify(dialog).getProxyUri(); Assert.assertEquals("http://proxy:8888", WorkspaceHelper.getProxyServer(serverUri)); // Remove proxy for any other tests WorkspaceHelper.setProxyServer(serverUri, null); } }
@Test @Ignore("Failing with 162.x for yet unknown reasons") public void _testReplInvocation() throws Exception { AddReplAction action = new AddReplAction(); Presentation presentation = myFixture.testAction(action); Assert.assertTrue("The action must be enabled and visible", presentation.isEnabledAndVisible()); Assert.assertNotNull(action.getConsoleRunner()); //work around IntelliJ's memory warnings action.getConsoleRunner().getConsoleView().dispose(); } }