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());
@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(); }
@Test public void testIsRider_True() { when(mockApplicationNamesInfo.getProductName()).thenReturn(IdeaHelper.RIDER_PRODUCT_NAME); assertTrue(IdeaHelper.isRider()); }
@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)); }
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()));
when(GitBranchUtil.getDisplayableBranchText(any(GitRepository.class))).thenReturn("branch"); when(applicationNamesInfo.getProductName()).thenReturn("IDEA"); PowerMockito.mockStatic(ApplicationNamesInfo.class); when(ApplicationNamesInfo.getInstance()).thenReturn(applicationNamesInfo);
@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()); }