@NonNls public static String applicationName() { return ApplicationNamesInfo.getInstance().getFullProductName(); }
@Before public void localSetup() { when(mockApplicationNamesInfo.getProductName()).thenReturn(IDEA_NAME); PowerMockito.mockStatic(Platform.class, WindowsStartup.class, MacStartup.class, ApplicationNamesInfo.class, AuthHelper.class); when(ApplicationNamesInfo.getInstance()).thenReturn(mockApplicationNamesInfo); VSTS_DIR.mkdir(); }
params.put("Java vm vendor", SystemInfo.JAVA_VENDOR); params.put("App Name", namesInfo.getProductName()); params.put("App Full Name", namesInfo.getFullProductName()); params.put("App Version name", appInfo.getVersionName()); params.put("Is EAP", Boolean.toString(appInfo.isEAP()));
@Before public void setUp() { MockitoAnnotations.initMocks(this); PowerMockito.mockStatic(ApplicationNamesInfo.class); when(ApplicationNamesInfo.getInstance()).thenReturn(mockApplicationNamesInfo); }
@VisibleForTesting static Map<String, String> buildKeyValuesMap( @NotNull ErrorBean error, @NotNull ApplicationNamesInfo intelliJAppNameInfo, @NotNull ApplicationInfoEx intelliJAppExtendedInfo, @NotNull Application application) { Map<String, String> params = ImmutableMap.<String, String>builder() // required parameters .put(ERROR_MESSAGE_KEY, nullToNone(error.getMessage())) .put(ERROR_STACKTRACE_KEY, nullToNone(error.getStackTrace())) // end or required parameters .put(ERROR_DESCRIPTION_KEY, nullToNone(error.getDescription())) .put(LAST_ACTION_KEY, nullToNone(error.getLastAction())) .put(OS_NAME_KEY, SystemProperties.getOsName()) .put(JAVA_VERSION_KEY, SystemProperties.getJavaVersion()) .put(JAVA_VM_VENDOR_KEY, SystemProperties.getJavaVmVendor()) .put(APP_NAME_KEY, intelliJAppNameInfo.getFullProductName()) .put(APP_CODE_KEY, intelliJAppExtendedInfo.getPackageCode()) .put(APP_NAME_VERSION_KEY, intelliJAppExtendedInfo.getVersionName()) .put(APP_EAP_KEY, Boolean.toString(intelliJAppExtendedInfo.isEAP())) .put(APP_INTERNAL_KEY, Boolean.toString(application.isInternal())) .put(APP_VERSION_MAJOR_KEY, intelliJAppExtendedInfo.getMajorVersion()) .put(APP_VERSION_MINOR_KEY, intelliJAppExtendedInfo.getMinorVersion()) .put( PLUGIN_VERSION, ServiceManager.getService(PluginInfoService.class).getPluginVersion()) .build(); return params; }
@Test public void testIsRider_True() { when(mockApplicationNamesInfo.getProductName()).thenReturn(IdeaHelper.RIDER_PRODUCT_NAME); assertTrue(IdeaHelper.isRider()); }
params.put("Java vm vendor", SystemInfo.JAVA_VENDOR); params.put("App Name", applicationNamesInfo.getProductName()); params.put("App Full Name", applicationNamesInfo.getFullProductName()); params.put("Is EAP", Boolean.toString(appInfo.isEAP())); params.put("App Build", appInfo.getBuild().asString());
ApplicationManager.getApplication(), (ApplicationInfoEx) ApplicationInfo.getInstance(), ApplicationNamesInfo.getInstance(), super.getPluginDescriptor() );
@Before public void setUp() { error = new ErrorBean(new Throwable(TEST_MESSAGE), LAST_ACTION); when(mockAppNameInfo.getFullProductName()).thenReturn(FULL_PRODUCT_NAME); when(mockAppInfoEx.getPackageCode()).thenReturn(PACKAGE_CODE); when(mockAppInfoEx.getVersionName()).thenReturn(VERSION_NAME); when(mockAppInfoEx.getMajorVersion()).thenReturn(MAJOR_VERSION); when(mockAppInfoEx.getMinorVersion()).thenReturn(MINOR_VERSION); when(pluginInfoService.getPluginVersion()).thenReturn(PLUGIN_VERSION); }
@Test public void testIsRider_False() { when(mockApplicationNamesInfo.getProductName()).thenReturn("IDEA"); assertFalse(IdeaHelper.isRider()); } }
@Test public void testProjectOpenedEvent_RiderNotVsts() { when(applicationNamesInfo.getProductName()).thenReturn(IdeaHelper.RIDER_PRODUCT_NAME); PowerMockito.mockStatic(ApplicationNamesInfo.class); when(ApplicationNamesInfo.getInstance()).thenReturn(applicationNamesInfo); when(VcsHelper.isVstsRepo(project)).thenReturn(false); when(statusBar.getWidget(anyString())).thenReturn(new BuildWidget()); StatusBarManager.setupStatusBar(); Map<String, Object> map = EventContextHelper.createContext(EventContextHelper.SENDER_PROJECT_OPENED); EventContextHelper.setProject(map, project); ServerEventManager.getInstance().triggerAllEvents(map); verify(statusBar, VerificationModeFactory.times(0)).addWidget(any(BuildWidget.class), Matchers.eq(project)); verify(statusBar, VerificationModeFactory.times(1)).removeWidget(any(String.class)); }
public DisablePluginWarningDialog( @NotNull PluginId pluginId, @NotNull Component parentComponent) { super(parentComponent, false); this.pluginId = pluginId; IdeaPluginDescriptor plugin = PluginManager.getPlugin(pluginId); isRestartCapable = ApplicationManager.getApplication().isRestartCapable(); promptLabel.setText( GoogleCloudCoreMessageBundle.message( "error.dialog.disable.plugin.prompt", plugin.getName())); restartLabel.setText( GoogleCloudCoreMessageBundle.message( isRestartCapable ? "error.dialog.disable.plugin.restart" : "error.dialog.disable.plugin.norestart", ApplicationNamesInfo.getInstance().getFullProductName())); setTitle(GoogleCloudCoreMessageBundle.message("error.dialog.disable.plugin.title")); init(); }
error.setMessage(event.getMessage()); ApplicationNamesInfo intelliJAppNameInfo = ApplicationNamesInfo.getInstance(); ApplicationInfoEx intelliJAppExtendedInfo = ApplicationInfoEx.getInstanceEx();
when(GitBranchUtil.getDisplayableBranchText(any(GitRepository.class))).thenReturn("branch"); when(applicationNamesInfo.getProductName()).thenReturn("IDEA"); PowerMockito.mockStatic(ApplicationNamesInfo.class); when(ApplicationNamesInfo.getInstance()).thenReturn(applicationNamesInfo);
ApplicationManager.getApplication(), (ApplicationInfoEx) ApplicationInfo.getInstance(), ApplicationNamesInfo.getInstance());
@Test public void testProjectOpenedEvent_RiderVsts() { when(applicationNamesInfo.getProductName()).thenReturn(IdeaHelper.RIDER_PRODUCT_NAME); PowerMockito.mockStatic(ApplicationNamesInfo.class); when(ApplicationNamesInfo.getInstance()).thenReturn(applicationNamesInfo); when(VcsHelper.isVstsRepo(project)).thenReturn(true); StatusBarManager.setupStatusBar(); Map<String, Object> map = EventContextHelper.createContext(EventContextHelper.SENDER_PROJECT_OPENED); EventContextHelper.setProject(map, project); ServerEventManager.getInstance().triggerAllEvents(map); verify(statusBar, VerificationModeFactory.times(1)).addWidget(any(BuildWidget.class), Matchers.eq(project)); buildStatusLookupOperation.onLookupStarted(); buildStatusLookupOperation.onLookupResults(new BuildStatusLookupOperation.BuildStatusResults( new ServerContextBuilder().uri("https://test.visualstudio.com/").type(ServerContext.Type.VSO).build(), new ArrayList<BuildStatusLookupOperation.BuildStatusRecord>())); verify(statusBar, VerificationModeFactory.times(1)).updateWidget(anyString()); }