TestURIBuilder.java (httpcomponents-client-4.5.6-src) | : | TestURIBuilder.java (httpcomponents-client-4.5.7-src) | ||
---|---|---|---|---|
skipping to change at line 39 | skipping to change at line 39 | |||
import java.net.URI; | import java.net.URI; | |||
import java.net.URLEncoder; | import java.net.URLEncoder; | |||
import java.nio.charset.Charset; | import java.nio.charset.Charset; | |||
import java.util.ArrayList; | import java.util.ArrayList; | |||
import java.util.Arrays; | import java.util.Arrays; | |||
import java.util.List; | import java.util.List; | |||
import org.apache.http.Consts; | import org.apache.http.Consts; | |||
import org.apache.http.NameValuePair; | import org.apache.http.NameValuePair; | |||
import org.apache.http.message.BasicNameValuePair; | import org.apache.http.message.BasicNameValuePair; | |||
import org.hamcrest.CoreMatchers; | ||||
import org.junit.Assert; | import org.junit.Assert; | |||
import org.junit.Test; | import org.junit.Test; | |||
public class TestURIBuilder { | public class TestURIBuilder { | |||
@Test | @Test | |||
public void testHierarchicalUri() throws Exception { | public void testHierarchicalUri() throws Exception { | |||
final URI uri = new URI("http", "stuff", "localhost", 80, "/some stuff", "param=stuff", "fragment"); | final URI uri = new URI("http", "stuff", "localhost", 80, "/some stuff", "param=stuff", "fragment"); | |||
final URIBuilder uribuilder = new URIBuilder(uri); | final URIBuilder uribuilder = new URIBuilder(uri); | |||
final URI result = uribuilder.build(); | final URI result = uribuilder.build(); | |||
skipping to change at line 331 | skipping to change at line 332 | |||
final URI uri = new URIBuilder("./mypath").build(); | final URI uri = new URIBuilder("./mypath").build(); | |||
Assert.assertEquals(new URI("./mypath"), uri); | Assert.assertEquals(new URI("./mypath"), uri); | |||
} | } | |||
@Test | @Test | |||
public void testRelativePathWithAuthority() throws Exception { | public void testRelativePathWithAuthority() throws Exception { | |||
final URI uri = new URIBuilder("./mypath").setHost("somehost").setScheme ("http").build(); | final URI uri = new URIBuilder("./mypath").setHost("somehost").setScheme ("http").build(); | |||
Assert.assertEquals(new URI("http://somehost/./mypath"), uri); | Assert.assertEquals(new URI("http://somehost/./mypath"), uri); | |||
} | } | |||
@Test | ||||
public void testMultipleLeadingPathSlashes() throws Exception { | ||||
final URI uri = new URIBuilder() | ||||
.setScheme("ftp") | ||||
.setHost("somehost") | ||||
.setPath("//blah//blah") | ||||
.build(); | ||||
Assert.assertThat(uri, CoreMatchers.equalTo(URI.create("ftp://somehost// | ||||
blah//blah"))); | ||||
} | ||||
@Test | ||||
public void testPathNoLeadingSlash() throws Exception { | ||||
final URI uri = new URIBuilder() | ||||
.setScheme("ftp") | ||||
.setPath("blah") | ||||
.build(); | ||||
Assert.assertThat(uri, CoreMatchers.equalTo(URI.create("ftp:/blah"))); | ||||
} | ||||
} | } | |||
End of changes. 2 change blocks. | ||||
0 lines changed or deleted | 21 lines changed or added |