### Question:
KieMultipleDocumentEditor implements KieMultipleDocumentEditorPresenter<D> { @Override public void activateDocument(final D document, final Overview overview, final AsyncPackageDataModelOracle dmo, final Imports imports, final boolean isReadOnly) { PortablePreconditions.checkNotNull("document", document); PortablePreconditions.checkNotNull("overview", overview); PortablePreconditions.checkNotNull("dmo", document); PortablePreconditions.checkNotNull("imports", imports); if (!documents.contains(document)) { throw new IllegalArgumentException("Document has not been registered."); } activeDocument = document; registeredDocumentsMenuBuilder.activateDocument(document); initialiseVersionManager(document); initialiseKieEditorTabs(document, overview, dmo, imports, isReadOnly); } KieMultipleDocumentEditor();  KieMultipleDocumentEditor(final KieEditorView editorView); @Override void registerDocument(final D document); @Override void deregisterDocument(final D document); @Override void activateDocument(final D document,
                                 final Overview overview,
                                 final AsyncPackageDataModelOracle dmo,
                                 final Imports imports,
                                 final boolean isReadOnly); @Override D getActiveDocument(); @Override IsWidget getWidget(); @Override IsWidget getTitleWidget(final D document); @Override void getMenus(final Consumer<Menus> menusConsumer); @Override void onClose(); @Override void onSourceTabSelected(); @Override void updateSource(final String source); @Override void onEditTabSelected(); @Override void onEditTabUnselected(); @Override void onOverviewSelected(); @Override boolean mayClose(final Integer originalHashCode,
                            final Integer currentHashCode); @Override Promise<Void> makeMenuBar();  }### Answer:
@Test @SuppressWarnings("unchecked") public void testActivateDocument() { final TestDocument document = createTestDocument(); final ObservablePath path = document.getLatestPath(); final Overview overview = mock(Overview.class); final AsyncPackageDataModelOracle dmo = mock(AsyncPackageDataModelOracle.class); final Imports imports = mock(Imports.class); final boolean isReadOnly = false; registerDocument(document); editor.activateDocument(document, overview, dmo, imports, isReadOnly); assertEquals(document, editor.getActiveDocument()); verify(versionRecordManager, times(1)).init(eq(null), eq(path), any(Callback.class)); verify(kieEditorWrapperView, times(1)).clear(); verify(kieEditorWrapperView, times(1)).addMainEditorPage(eq(editorView)); verify(kieEditorWrapperView, times(1)).addOverviewPage(eq(overviewWidget), any(com.google.gwt.user.client.Command.class)); verify(kieEditorWrapperView, times(1)).addSourcePage(eq(editor.sourceWidget)); verify(kieEditorWrapperView, times(1)).addImportsTab(eq(importsWidget)); verify(overviewWidget, times(1)).setContent(eq(overview), eq(path)); verify(importsWidget, times(1)).setContent(eq(dmo), eq(imports), eq(isReadOnly)); }
@Test(expected = IllegalArgumentException.class) public void testActivateDocumentNotRegistered() { final TestDocument document = createTestDocument(); activateDocument(document); }