### Question:
URIHelper { public static List<URI> getParents(final URI uri) { checkNotNull(uri,"URI cannot be null"); Set<URI> parents = Sets.newLinkedHashSet(); parents.add(uri); if(uri.isAbsolute() && !uri.isOpaque()) { URI base=current(uri); while(!isRoot(base)) { parents.add(base); base=parent(base); } parents.add(base); } return Lists.newArrayList(parents); } private  URIHelper(); static List<URI> getParents(final URI uri);  }### Answer:
@Test public void testGetParents$hashURI() throws Exception { URI base=uri("http: List<URI> parents = URIHelper.getParents(base); assertThat(parents,notNullValue()); assertThat(parents,contains(base,this.p1,this.p2,this.p3)); }
@Test public void testGetParents$slashURI_open() throws Exception { URI base=uri("http: List<URI> parents = URIHelper.getParents(base); assertThat(parents,notNullValue()); assertThat(parents,contains(base,this.p0,this.p1,this.p2,this.p3)); }
@Test public void testGetParents$slashURI_close() throws Exception { URI base=uri("http: List<URI> parents = URIHelper.getParents(base); assertThat(parents,notNullValue()); assertThat(parents,contains(base,this.p0,this.p1,this.p2,this.p3)); }
@Test public void testGetParents$mixedURI() throws Exception { URI base=uri("http: List<URI> parents = URIHelper.getParents(base); assertThat(parents,notNullValue()); assertThat(parents,contains(base,this.p0,this.p1,this.p2,this.p3)); }