Source:
public void testOpen() { final ProjectMetadata metadata = mock(ProjectMetadata.class); final Overview overview = mock(Overview.class); final ClientSessionFactory clientSessionFactory = mock(ClientSessionFactory.class); when(diagram.getMetadata()).thenReturn(metadata); when(metadata.getTitle()).thenReturn(TITLE); when(metadata.getOverview()).thenReturn(overview); when(sessionManager.getSessionFactory(eq(metadata), eq(ClientFullSession.class))).thenReturn(clientSessionFactory); when(sessionPresenterFactory.newPresenterEditor()).thenReturn(sessionPresenter); presenter.open(diagram); verify(view).showLoading(); verify(presenter).setOriginalHash(anyInt()); verify(clientSessionFactory).newSession(eq(metadata), clientSessionConsumerCaptor.capture()); final Consumer<ClientFullSession> clientSessionConsumer = clientSessionConsumerCaptor.getValue(); clientSessionConsumer.accept(clientFullSession); verify(view).setWidget(eq(sessionPresenterView)); verify(sessionPresenter).withToolbar(eq(false)); verify(sessionPresenter).withPalette(eq(true)); verify(sessionPresenter).open(eq(diagram), eq(clientFullSession), clientSessionPresenterCallbackCaptor.capture()); final SessionPresenter.SessionPresenterCallback clientSessionPresenterCallback = clientSessionPresenterCallbackCaptor.getValue(); clientSessionPresenterCallback.onSuccess(); verify(view).hideBusyIndicator(); verify(overviewWidget).setContent(eq(overview), eq(filePath)); verify(kieView).clear(); verify(kieView).addMainEditorPage(eq(view)); verify(kieView).addOverviewPage(eq(overviewWidget), any(com.google.gwt.user.client.Command.class)); verify(presenter).onDiagramLoad(); }

Target:
public void testOpen() { final ProjectMetadata metadata = mock(ProjectMetadata.class); final Overview overview = mock(Overview.class); final ClientSessionFactory clientSessionFactory = mock(ClientSessionFactory.class); when(diagram.getMetadata()).thenReturn(metadata); when(metadata.getTitle()).thenReturn(TITLE); when(metadata.getOverview()).thenReturn(overview); when(sessionManager.getSessionFactory(eq(metadata), eq(ClientFullSession.class))).thenReturn(clientSessionFactory); when(sessionPresenterFactory.newPresenterEditor()).thenReturn(sessionPresenter); presenter.open(diagram); verify(view).showLoading(); verify(presenter).setOriginalHash(anyInt()); verify(clientSessionFactory).newSession(eq(metadata), clientSessionConsumerCaptor.capture()); final Consumer<ClientFullSession> clientSessionConsumer = clientSessionConsumerCaptor.getValue(); clientSessionConsumer.accept(clientFullSession); verify(view).setWidget(eq(sessionPresenterView)); verify(sessionPresenter).withToolbar(eq(false)); verify(sessionPresenter).withPalette(eq(true)); verify(sessionPresenter).open(eq(diagram), eq(clientFullSession), clientSessionPresenterCallbackCaptor.capture()); final SessionPresenter.SessionPresenterCallback clientSessionPresenterCallback = clientSessionPresenterCallbackCaptor.getValue(); clientSessionPresenterCallback.onSuccess(); verify(view).hideBusyIndicator(); verify(overviewWidget).setContent(eq(overview), eq(filePath)); verify(kieView).clear(); verify(kieView).addMainEditorPage(eq(view)); verify(kieView).addOverviewPage(eq(overviewWidget), any(com.google.gwt.user.client.Command.class)); }