use of com.intellij.openapi.project.impl.ProjectImpl in project intellij-community by JetBrains.
the class ContextTest method testContextFileName.
public void testContextFileName() throws Exception {
ProjectImpl project = (ProjectImpl) getProject();
String name = project.getName();
try {
project.setProjectName("invalid | name");
getContextManager().saveContext("foo", "bar");
} finally {
project.setProjectName(name);
}
}
use of com.intellij.openapi.project.impl.ProjectImpl in project google-cloud-intellij by GoogleCloudPlatform.
the class CloudDebugProcessTest method testOnBreakpointListChangedSetsErrorMessageAndUpdatesBreakpointPresentation.
public void testOnBreakpointListChangedSetsErrorMessageAndUpdatesBreakpointPresentation() throws Exception {
// override the default XBreakpointManager implementation with mock to use Mockito.verify()
XBreakpointManager breakpointManager = mock(XBreakpointManager.class);
XDebuggerManager debuggerManager = mock(XDebuggerManager.class);
when(debuggerManager.getBreakpointManager()).thenReturn(breakpointManager);
((ProjectImpl) getProject()).registerComponentInstance(XDebuggerManager.class, debuggerManager);
ArrayList<Breakpoint> breakpoints = new ArrayList<Breakpoint>();
Breakpoint breakpoint = new Breakpoint();
breakpoint.setId("breakpointId").setIsFinalState(Boolean.TRUE).setStatus(new StatusMessage().setIsError(Boolean.TRUE));
breakpoints.add(breakpoint);
CloudDebugProcessState processState = mock(CloudDebugProcessState.class);
when(processState.getCurrentServerBreakpointList()).thenReturn(ContainerUtil.immutableList(breakpoints));
XLineBreakpointImpl xLineBreakpointImpl = mock(XLineBreakpointImpl.class);
CloudLineBreakpoint cloudLineBreakpoint = mockCloudLineBreakpoint("mock error message", xLineBreakpointImpl);
when(xLineBreakpointImpl.getUserData(com.intellij.debugger.ui.breakpoints.Breakpoint.DATA_KEY)).thenReturn(cloudLineBreakpoint);
CloudBreakpointHandler breakpointHandler = mock(CloudBreakpointHandler.class);
when(breakpointHandler.getEnabledXBreakpoint(breakpoint)).thenReturn(xLineBreakpointImpl);
process.setBreakpointHandler(breakpointHandler);
process.initialize(processState);
process.onBreakpointListChanged(mock(CloudDebugProcessState.class));
verify(cloudLineBreakpoint).setErrorMessage(eq("General error"));
verify(cloudLineBreakpoint).getXBreakpoint();
verify(cloudLineBreakpoint).getSetIcon(Matchers.anyBoolean());
verify(cloudLineBreakpoint).getErrorMessage();
verify(breakpointManager).updateBreakpointPresentation(same(xLineBreakpointImpl), any(Icon.class), eq("General error"));
process.getStateController().stopBackgroundListening();
}
Aggregations