FileExplorerPresenter implements GuvnorStructureContextChangeHandler,
                   GuvnorStructureContextBranchChangeHandler { @OnStartup public void reset() { view.reset(); guvnorStructureContext.getRepositories(new Callback<Collection<Repository>>() { @Override public void callback(final Collection<Repository> response) { for (final Repository root : response) { if (repositories.containsKey(root.getAlias())) { view.removeRepository(root); } view.addNewRepository(root, guvnorStructureContext.getCurrentBranch(root.getAlias())); repositories.put(root.getAlias(), root); } } }); } FileExplorerPresenter(); @Inject  FileExplorerPresenter(final FileExplorerView view,
                                 final GuvnorStructureContext guvnorStructureContext); @OnStartup void reset(); @OnShutdown void onShutdown(); void loadDirectoryContent(final FileExplorerItem item,
                                     final Path path); @WorkbenchPartView IsWidget getWidget(); @WorkbenchPartTitle String getTitle(); @DefaultPosition Position getDefaultPosition(); void redirect(final Path path); void redirectRepositoryList(); void redirect(final Repository repo); @Override void onNewRepositoryAdded(final Repository repository); @Override void onRepositoryDeleted(final Repository repository); @Override void onBranchChange(final String alias,
                               final String branch); @Override void onNewBranchAdded(String repositoryAlias,
                                 String branchName,
                                 Path branchPath); void onResourceAdded(@Observes final ResourceAddedEvent event); void onResourceDeleted(@Observes final ResourceDeletedEvent event); void onResourceCopied(@Observes final ResourceCopiedEvent event); void onResourceRenamed(@Observes final ResourceRenamedEvent event); void onBatchResourceChange(@Observes final ResourceBatchChangesEvent event); void onSystemRepositoryChanged(@Observes SystemRepositoryChangedEvent event);  }
@Test public void testOnStartUp() throws Exception { myRepoBranch = "dev"; presenter.reset(); verify(view, times(2)).addNewRepository(any(Repository.class), anyString()); verify(view).addNewRepository(myRepo, "dev"); verify(view).addNewRepository(yourRepo, "master"); }