@NotNull @VisibleForTesting Set<RunProfile> getProfilesWithActiveDebugSession(Project project) { Set<RunProfile> debuggingProfiles = new HashSet<RunProfile>(); XDebuggerManager debugManager = XDebuggerManager.getInstance(project); for (XDebugSession session : debugManager.getDebugSessions()) { if (notStoppedAndHasRunProfile(session)) { debuggingProfiles.add(session.getRunProfile()); } } return debuggingProfiles; }
@Test public void testNotStoppedAndHasRunProfile_returnsFalseIfStoppedAndHasProfile() { XDebugSession session = createMockSession(true, mock(RunProfile.class)); assertFalse(new CloudDebugProcessStateCollector().notStoppedAndHasRunProfile(session)); }
@Test public void testNotStoppedAndHasRunProfile_returnsTrueIfNotStoppedAndHasProfile() { XDebugSession session = createMockSession(false, mock(RunProfile.class)); assertTrue(new CloudDebugProcessStateCollector().notStoppedAndHasRunProfile(session)); }
@Test public void testNotStoppedAndHasRunProfile_returnsFalseIfNotStoppedAndHasNoProfile() { XDebugSession session = createMockSession(false, null); assertFalse(new CloudDebugProcessStateCollector().notStoppedAndHasRunProfile(session)); }
@Test public void testNotStoppedAndHasRunProfile_returnsFalseIfStoppedAndHasNoProfile() { XDebugSession session = createMockSession(true, null); assertFalse(new CloudDebugProcessStateCollector().notStoppedAndHasRunProfile(session)); }