use of com.google.api.services.clouddebugger.v2.model.StatusMessage in project google-cloud-intellij by GoogleCloudPlatform.
the class CloudDebugProcessStateTest method createBreakpoint.
private static Breakpoint createBreakpoint(String id, Boolean isFinal, int finalTimeSeconds, String locationPath, Integer locationLine, Boolean isError, String statusMessage) {
Breakpoint result = new Breakpoint();
result.setId(id);
result.setIsFinalState(isFinal);
if (Boolean.TRUE.equals(isFinal)) {
Calendar calendar = // gets a calendar using the default time zone and locale.
Calendar.getInstance();
calendar.add(Calendar.SECOND, finalTimeSeconds);
DateTimeFormatter formatter = ISODateTimeFormat.dateTime();
result.setFinalTime(formatter.print(calendar.getTimeInMillis()));
}
SourceLocation location = new SourceLocation();
location.setPath(locationPath);
location.setLine(locationLine);
result.setLocation(location);
StatusMessage status = new StatusMessage();
status.setIsError(isError);
FormatMessage message = new FormatMessage();
message.setFormat(statusMessage);
status.setDescription(message);
result.setStatus(status);
return result;
}
use of com.google.api.services.clouddebugger.v2.model.StatusMessage 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