### Question:
PreviewDiagramScreen { void showPreview(final ClientSession session) { if (Objects.isNull(session)) { return; } if (session instanceof AbstractSession) { if (Objects.nonNull(previewWidget)) { closePreview(); } previewWidget = sessionPreviews.get(); previewWidget.open((AbstractSession) session, PREVIEW_WIDTH, PREVIEW_HEIGHT, new SessionViewer.SessionViewerCallback<Diagram>() { @Override public void afterCanvasInitialized() { } @Override public void onSuccess() { view.setPreviewWidget(previewWidget.getView()); } @Override public void onError(final ClientRuntimeError error) { LOGGER.log(Level.SEVERE, error.getMessage()); } }); } } protected  PreviewDiagramScreen(); @Inject  PreviewDiagramScreen(final SessionManager clientSessionManager,
                                final @Any @DMNEditor ManagedInstance<SessionDiagramPreview<AbstractSession>> sessionPreviews,
                                final View view,
                                final DMNDiagramsSession session); @OnStartup @SuppressWarnings("unused") void onStartup(final PlaceRequest placeRequest); @OnOpen @SuppressWarnings("unused") void onOpen(); @OnClose @SuppressWarnings("unused") void onClose(); @WorkbenchPartTitle @SuppressWarnings("unused") String getTitle(); @WorkbenchPartView @SuppressWarnings("unused") IsWidget getWidget(); @WorkbenchContextId @SuppressWarnings("unused") String getMyContextRef(); static final String SCREEN_ID; }### Answer:
@Test @SuppressWarnings("unchecked") public void testShowPreview() { tested.showPreview(session); verify(sessionPreview).open(eq(session), anyInt(), anyInt(), sessionViewerCallbackArgumentCaptor.capture()); final SessionViewer.SessionViewerCallback sessionViewerCallback = sessionViewerCallbackArgumentCaptor.getValue(); sessionViewerCallback.onSuccess(); verify(sessionPreview, never()).clear(); verify(view).setPreviewWidget(previewWidget); }