### Question:
RegisteredDocumentsMenuBuilder implements MenuFactory.CustomMenuBuilder,
                                                       RegisteredDocumentsMenuView.Presenter { @Override public void registerDocument(final KieDocument document) { final DocumentMenuItem documentMenuItem = makeDocumentMenuItem(document); registeredDocuments.put(document, documentMenuItem); view.addDocument(documentMenuItem); } @Inject  RegisteredDocumentsMenuBuilder(final RegisteredDocumentsMenuView view,
                                          final ManagedInstance<DocumentMenuItem> documentMenuItemProvider); @Override void setReadOnly(final boolean isReadOnly); @Override @PreDestroy void dispose(); @Override void push(final MenuFactory.CustomMenuBuilder element); @Override MenuItem build(); @Override void onOpenDocument(); @Override void onNewDocument(); @Override void registerDocument(final KieDocument document); @Override void deregisterDocument(final KieDocument document); @Override void onActivateDocument(final KieDocument document); @Override void onRemoveDocument(final KieDocument document); @Override void setNewDocumentCommand(final Command newDocumentCommand); @Override void setOpenDocumentCommand(final Command openDocumentCommand); @Override void setActivateDocumentCommand(final ParameterizedCommand<KieDocument> activateDocumentCommand); @Override void setRemoveDocumentCommand(final ParameterizedCommand<KieDocument> removeDocumentCommand); @Override void activateDocument(final KieDocument document);  }### Answer:
@Test public void testRegisterDocument() { final KieDocument document = makeKieDocument(); builder.registerDocument( document ); verify( documentMenuItem, times( 1 ) ).setName( "filename" ); verify( documentMenuItem, times( 1 ) ).setRemoveDocumentCommand( removeDocumentCommandCaptor.capture() ); verify( documentMenuItem, times( 1 ) ).setActivateDocumentCommand( activateDocumentCommandCaptor.capture() ); verify( view, times( 1 ) ).addDocument( eq( documentMenuItem ) ); final Command removeDocumentCommand = removeDocumentCommandCaptor.getValue(); assertNotNull( removeDocumentCommand ); removeDocumentCommand.execute(); verify( builder, times( 1 ) ).onRemoveDocument( document ); final Command activateDocumentCommand = activateDocumentCommandCaptor.getValue(); assertNotNull( activateDocumentCommand ); activateDocumentCommand.execute(); verify( builder, times( 1 ) ).onActivateDocument( document ); }