SpacesAPIImpl implements SpacesAPI { @Override public Optional<Space> resolveSpace(String uri) { return Optional .ofNullable(PATH_REGEX.matcher(uri)) .filter(matcher -> matcher.matches()) .map(matcher -> matcher.group(1)) .map(name -> trimName(name)) .map(this::getSpace); }  @Override Space getSpace(String name); @Override Optional<Space> resolveSpace(String uri); URI resolveFileSystemURI(Scheme scheme,
                                    Space space,
                                    String fsName);  }
@Test public void resolveSpaceNameTest() throws Exception { Optional<Space> space = spaces.resolveSpace("default: assertTrue(space.isPresent()); assertEquals("myteam", space.get().getName()); }
@Test public void resolveSpaceNameWhenBranchNameHasSlashesTest() throws Exception { Optional<Space> space = spaces.resolveSpace("default: assertTrue(space.isPresent()); assertEquals("myteam", space.get().getName()); }