Search in sources :

Example 1 with WorkbenchListener

use of nl.tudelft.watchdog.eclipse.logic.ui.listeners.WorkbenchListener in project watchdog by TestRoots.

the class MarkupModelListenerTest method setup.

@Before
public void setup() throws Exception {
    WatchDogEventType.intervalManager = Mockito.mock(IntervalManager.class);
    WatchDogEventType.editorSpecificImplementation = Mockito.mock(WatchDogEventEditorSpecificImplementation.class);
    this.transferManager = Mockito.mock(TransferManager.class);
    this.trackingEventManager = Mockito.mock(TrackingEventManager.class);
    this.generatedEvents = new ArrayList<>();
    Mockito.doAnswer(new Answer<Object>() {

        @SuppressWarnings("unchecked")
        @Override
        public Object answer(InvocationOnMock invocation) throws Throwable {
            Stream<StaticAnalysisWarningEvent> stream = (Stream<StaticAnalysisWarningEvent>) invocation.getArguments()[0];
            stream.map(StaticAnalysisWarningEvent::getType).forEach(generatedEvents::add);
            return null;
        }
    }).when(this.trackingEventManager).addEvents(Mockito.any());
    this.setUpTestingProject();
    this.workbenchListener = new WorkbenchListener(trackingEventManager, transferManager);
    this.workbenchListener.attachListeners();
}
Also used : TransferManager(nl.tudelft.watchdog.eclipse.logic.network.TransferManager) WorkbenchListener(nl.tudelft.watchdog.eclipse.logic.ui.listeners.WorkbenchListener) TrackingEventManager(nl.tudelft.watchdog.core.logic.event.TrackingEventManager) InvocationOnMock(org.mockito.invocation.InvocationOnMock) StaticAnalysisWarningEvent(nl.tudelft.watchdog.core.logic.event.eventtypes.staticanalysis.StaticAnalysisWarningEvent) ByteArrayInputStream(java.io.ByteArrayInputStream) Stream(java.util.stream.Stream) InputStream(java.io.InputStream) IntervalManager(nl.tudelft.watchdog.eclipse.logic.interval.IntervalManager) WatchDogEventEditorSpecificImplementation(nl.tudelft.watchdog.core.logic.ui.events.WatchDogEventType.WatchDogEventEditorSpecificImplementation) Before(org.junit.Before)

Aggregations

ByteArrayInputStream (java.io.ByteArrayInputStream)1 InputStream (java.io.InputStream)1 Stream (java.util.stream.Stream)1 TrackingEventManager (nl.tudelft.watchdog.core.logic.event.TrackingEventManager)1 StaticAnalysisWarningEvent (nl.tudelft.watchdog.core.logic.event.eventtypes.staticanalysis.StaticAnalysisWarningEvent)1 WatchDogEventEditorSpecificImplementation (nl.tudelft.watchdog.core.logic.ui.events.WatchDogEventType.WatchDogEventEditorSpecificImplementation)1 IntervalManager (nl.tudelft.watchdog.eclipse.logic.interval.IntervalManager)1 TransferManager (nl.tudelft.watchdog.eclipse.logic.network.TransferManager)1 WorkbenchListener (nl.tudelft.watchdog.eclipse.logic.ui.listeners.WorkbenchListener)1 Before (org.junit.Before)1 InvocationOnMock (org.mockito.invocation.InvocationOnMock)1