### Question:
CaseManagementDiagramEditor extends AbstractProjectDiagramEditor<CaseManagementDiagramResourceType> { protected void onSwitch(final Diagram diagram, final String defSetId, final String shapeDefId) { this.showLoadingViews(); caseManagementSwitchViewService.call(new RemoteCallback<Optional<ProjectDiagram>>() { @Override public void callback(Optional<ProjectDiagram> diagram) { diagram.ifPresent(d -> { CaseManagementDiagramEditor.this.reopenSession(d); CaseManagementDiagramEditor.this.hideLoadingViews(); }); } }).switchView(diagram, defSetId, shapeDefId); } @Inject  CaseManagementDiagramEditor(final AbstractProjectDiagramEditor.View view,
                                       final TextEditorView xmlEditorView,
                                       final ManagedInstance<SessionEditorPresenter<EditorSession>> editorSessionPresenterInstances,
                                       final ManagedInstance<SessionViewerPresenter<ViewerSession>> viewerSessionPresenterInstances,
                                       final Event<OnDiagramFocusEvent> onDiagramFocusEvent,
                                       final Event<OnDiagramLoseFocusEvent> onDiagramLostFocusEvent,
                                       final Event<NotificationEvent> notificationEvent,
                                       final ErrorPopupPresenter errorPopupPresenter,
                                       final DiagramClientErrorHandler diagramClientErrorHandler,
                                       final DocumentationView documentationView,
                                       final CaseManagementDiagramResourceType resourceType,
                                       final CaseManagementProjectEditorMenuSessionItems menuSessionItems,
                                       final ProjectMessagesListener projectMessagesListener,
                                       final ClientTranslationService translationService,
                                       final ClientProjectDiagramService projectDiagramServices,
                                       final Caller<ProjectDiagramResourceService> projectDiagramResourceServiceCaller,
                                       final Caller<CaseManagementSwitchViewService> caseManagementSwitchViewService,
                                       final UberfireDocks uberfireDocks,
                                       final StunnerDocksHandler stunnerDocksHandler); @Override void init(); @OnStartup void onStartup(final ObservablePath path,
                          final PlaceRequest place); @Override String getEditorIdentifier(); @OnOpen void onOpen(); @OnClose @Override void onClose(); @OnFocus void onFocus(); @OnLostFocus void onLostFocus(); @WorkbenchPartTitleDecoration IsWidget getTitle(); @WorkbenchPartTitle String getTitleText(); @WorkbenchMenu void getMenus(final Consumer<Menus> menusConsumer); @WorkbenchPartView IsWidget getWidget(); @OnMayClose boolean onMayClose(); @Override SessionEditorPresenter<EditorSession> newSessionEditorPresenter(); @Override void initialiseKieEditorForSession(ProjectDiagram diagram); static final String EDITOR_ID; }### Answer:
@Test public void testOnSwitch() { final Diagram diagram = mock(Diagram.class); final String defSetId = "defSetId"; final String shapeDefId = "shapeDefId"; tested.onSwitch(diagram, defSetId, shapeDefId); verify(view, times(1)).showLoading(); verify(view, times(1)).hideBusyIndicator(); verify(sessionEditorPresenter, times(1)).destroy(); verify(sessionEditorPresenter, times(1)).open(any(ProjectDiagram.class), any(SessionPresenter.SessionPresenterCallback.class)); }