@Test public void testOnBreakpointListChanged() throws InterruptedException { CloudDebugHistoricalSnapshots snapshots = new CloudDebugHistoricalSnapshots(handler); Breakpoint bp1 = new Breakpoint(); bp1.setId("an ID"); bp1.setFinalTime("2015-08-22T05:23:34.123Z"); bp1.setIsFinalState(true); SourceLocation location = new SourceLocation(); location.setPath("foo/bar/baz"); location.setLine(12); bp1.setLocation(location); List<Breakpoint> breakpoints = new ArrayList<Breakpoint>(); breakpoints.add(bp1); Mockito.when(mockProcess.getCurrentBreakpointList()).thenReturn(breakpoints); Mockito.when(mockProcess.getCurrentSnapshot()).thenReturn(bp1); CloudBreakpointHandler breakpointHandler = Mockito.mock(CloudBreakpointHandler.class); Mockito.when(mockProcess.getBreakpointHandler()).thenReturn(breakpointHandler); runModelSetter(snapshots); Assert.assertEquals(0, snapshots.myTable.getSelectedRow()); }
@Before public void setUp() { MockApplication application = new MyMockApplicationEx(parent); ActionManagerEx manager = Mockito.mock(ActionManagerEx.class); ActionToolbar actionToolbar = Mockito.mock(ActionToolbar.class); Mockito.when(actionToolbar.getComponent()).thenReturn(new JComponent() {}); Mockito.when( manager.createActionToolbar( Mockito.anyString(), Mockito.any(ActionGroup.class), Mockito.anyBoolean())) .thenReturn(actionToolbar); Mockito.when( manager.createActionToolbar( Mockito.anyString(), Mockito.any(ActionGroup.class), Mockito.anyBoolean(), Mockito.anyBoolean())) .thenReturn(actionToolbar); application.addComponent(ActionManager.class, manager); ApplicationManager.setApplication(application, parent); XDebugSession session = Mockito.mock(XDebugSession.class); Mockito.when(handler.getProcess()).thenReturn(mockProcess); Mockito.when(mockProcess.getXDebugSession()).thenReturn(session); }
private void runModelSetter(CloudDebugHistoricalSnapshots snapshots) { (snapshots.new ModelSetter(mockProcess.getCurrentBreakpointList(), snapshots.getSelection())) .run(); }