### Question:
ExplorerMenu { public void onArchiveActiveRepository() { final Optional<Branch> defaultBranch = context.getActiveWorkspaceProject() .map(proj -> proj.getRepository()) .orElseThrow(() -> new IllegalStateException("Cannot check for default branch without an active project.")) .getDefaultBranch(); if (defaultBranch.isPresent()) { view.archive(defaultBranch.get().getPath()); } } ExplorerMenu(); @Inject  ExplorerMenu(final ExplorerMenuView view,
                        final ActiveContextOptions activeOptions,
                        final WorkspaceProjectContext projectContext); Menus asMenu(); void refresh(); void addRefreshCommand(Command refreshCommand); void addUpdateCommand(Command updateCommand); void onBusinessViewSelected(); void onTechViewSelected(); void onTreeExplorerSelected(); void onBreadCrumbExplorerSelected(); void onShowTagFilterSelected(); void onArchiveActiveProject(); void onArchiveActiveRepository(); void onRefresh();  }### Answer:
@Test public void testOnArchiveActiveRepo() throws Exception { final Path rootRepoPath = mock(Path.class); final Repository repository = mock(Repository.class); when(repository.getDefaultBranch()).thenReturn(Optional.of(new Branch("master", rootRepoPath))); final WorkspaceProject project = mock(WorkspaceProject.class); when(project.getRepository()).thenReturn(repository); when(context.getActiveWorkspaceProject()).thenReturn(Optional.of(project)); menu.onArchiveActiveRepository(); verify(view).archive(rootRepoPath); }