WorkspaceProjectContext { public Optional<Path> getActiveRepositoryRoot() { return getActiveWorkspaceProject().map(proj -> proj.getBranch()).map(branch -> branch.getPath()); } WorkspaceProjectContext(); @Inject  WorkspaceProjectContext(final Event<WorkspaceProjectContextChangeEvent> contextChangeEvent); void onOrganizationalUnitUpdated(@Observes final UpdatedOrganizationalUnitEvent event); void onModuleUpdated(@Observes final ModuleUpdatedEvent moduleUpdatedEvent); void onProjectContextChanged(@Observes final WorkspaceProjectContextChangeEvent event); Optional<Path> getActiveRepositoryRoot(); Optional<OrganizationalUnit> getActiveOrganizationalUnit(); Optional<WorkspaceProject> getActiveWorkspaceProject(); Optional<Module> getActiveModule(); Optional<Package> getActivePackage(); ProjectContextChangeHandle addChangeHandler(final WorkspaceProjectContextChangeHandler changeHandler); void removeChangeHandler(final ProjectContextChangeHandle projectContextChangeHandle); void updateProjectModule(final Module module);  }
@Test public void testGetActiveRepositoryRoot() throws Exception { final Path devRoot = mock(Path.class); context.setActiveWorkspaceProject(new WorkspaceProject(mock(OrganizationalUnit.class), mock(Repository.class), new Branch("dev", devRoot), mock(Module.class))); assertEquals(Optional.of(devRoot), context.getActiveRepositoryRoot()); }