/*Harleigh108:
* Rather than mocking a view, we create one with dummy-content, this is because adding a mocked container to a container
* will cause a NPE. See testMouseDragIncremental in MarqueSelectionListenerTest.java
*/
view = new MockManifestation(mockComponent, new ViewInfo(MockManifestation.class, "", ViewType.OBJECT)) {
/*
* Originally, in 'testLockedState()' we had Mockito.verify(view, Mockito.times(1)).exitLockedState(), that is we verified
* that the method 'exitLockedState()' is called exactly once during the test 'testLockedState()'. Since we can not use
* mock-types (see comments in 'testLockedState()') we implemented the following instead:
*/
private int NumberCalls = 0; //Number of calls to method exitLockedState
@Override
public void exitLockedState() {
NumberCalls= NumberCalls +1;
super.exitLockedState();
}
@Override
public int getNumberCallsToExitLockedState() {
return NumberCalls;
}
};//--end class
MCTViewManifestationInfoImpl info = new MCTViewManifestationInfoImpl();
view.putClientProperty(CanvasManifestation.MANIFEST_INFO, info);
Mockito.when(mockComponent.getViewInfos(ViewType.TITLE)).thenReturn(Collections.singleton(new ViewInfo(MockTitleManifestation.class,"", ViewType.TITLE)));
Mockito.when(mockComponent.getDisplayName()).thenReturn("test comp");
Mockito.when(mockComponent.getComponents()).thenReturn(Collections.<AbstractComponent> emptyList());
AbstractComponent ac = Mockito.mock(AbstractComponent.class);
ViewInfo vi = Mockito.mock(ViewInfo.class);
panelInspector = new PanelInspector(ac, vi) {
@Override
protected JComponent getViewControls() {
return new JPanel();
}