Search in sources :

Example 1 with RequestRefreshEventHandler

use of edu.stanford.bmir.protege.web.client.events.RequestRefreshEventHandler in project webprotege by protegeproject.

the class MetricsPresenterTestCase method setUp.

// @Before
public void setUp() {
    doAnswer(new Answer<Void>() {

        @Override
        public Void answer(InvocationOnMock invocationOnMock) throws Throwable {
            DispatchServiceCallback<GetMetricsResult> action = (DispatchServiceCallback<GetMetricsResult>) invocationOnMock.getArguments()[1];
            action.onSuccess(result);
            return null;
        }
    }).when(dispatchServiceManager).execute(any(GetMetricsAction.class), any(DispatchServiceCallback.class));
    doAnswer(new Answer<Void>() {

        @Override
        public Void answer(InvocationOnMock invocationOnMock) throws Throwable {
            handler = (RequestRefreshEventHandler) invocationOnMock.getArguments()[0];
            return null;
        }
    }).when(view).setRequestRefreshEventHandler(any(RequestRefreshEventHandler.class));
    when(result.getMetricValues()).thenReturn(metricValues);
    doAnswer(new Answer<Void>() {

        @Override
        public Void answer(InvocationOnMock invocationOnMock) throws Throwable {
            metricsChangedHandler = (MetricsChangedHandler) invocationOnMock.getArguments()[0];
            return null;
        }
    }).when(eventManager).addProjectEventHandler(eq(projectId), any(MetricsChangedEvent.getType().getClass()), any(MetricsChangedHandler.class));
    presenter = new MetricsPresenter(projectId, view, dispatchServiceManager);
    presenter.start();
}
Also used : DispatchServiceCallback(edu.stanford.bmir.protege.web.client.dispatch.DispatchServiceCallback) RequestRefreshEventHandler(edu.stanford.bmir.protege.web.client.events.RequestRefreshEventHandler) InvocationOnMock(org.mockito.invocation.InvocationOnMock) MetricsPresenter(edu.stanford.bmir.protege.web.client.metrics.MetricsPresenter)

Aggregations

DispatchServiceCallback (edu.stanford.bmir.protege.web.client.dispatch.DispatchServiceCallback)1 RequestRefreshEventHandler (edu.stanford.bmir.protege.web.client.events.RequestRefreshEventHandler)1 MetricsPresenter (edu.stanford.bmir.protege.web.client.metrics.MetricsPresenter)1 InvocationOnMock (org.mockito.invocation.InvocationOnMock)1