mirror of
https://gitee.com/chinabugotech/hutool.git
synced 2025-05-09 23:51:34 +08:00
add test
This commit is contained in:
parent
aa403cbe98
commit
47fe31cf41
@ -532,12 +532,7 @@ public final class UrlBuilder implements Builder<String> {
|
||||
*/
|
||||
public URI toURI() {
|
||||
try {
|
||||
return new URI(
|
||||
getSchemeWithDefault(),
|
||||
getAuthority(),
|
||||
getPathStr(),
|
||||
getQueryStr(),
|
||||
getFragmentEncoded());
|
||||
return toURL().toURI();
|
||||
} catch (final URISyntaxException e) {
|
||||
return null;
|
||||
}
|
||||
|
@ -445,4 +445,29 @@ public class UrlBuilderTest {
|
||||
final UrlBuilder of = UrlBuilder.of(url, null);
|
||||
Assert.assertEquals(url.replace("&", "&"), of.toString());
|
||||
}
|
||||
|
||||
@SuppressWarnings("ConstantConditions")
|
||||
@Test
|
||||
public void issues2503Test() throws URISyntaxException {
|
||||
String duplicate = UrlBuilder.ofHttp("127.0.0.1:8080")
|
||||
.addQuery("param[0].field", "编码")
|
||||
.toURI()
|
||||
.toString();
|
||||
Assert.assertEquals("http://127.0.0.1:8080?param%5B0%5D.field=%E7%BC%96%E7%A0%81", duplicate);
|
||||
|
||||
String normal = UrlBuilder.ofHttp("127.0.0.1:8080")
|
||||
.addQuery("param[0].field", "编码")
|
||||
.toURL()
|
||||
.toURI()
|
||||
.toString();
|
||||
Assert.assertEquals(duplicate, normal);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void getAuthorityTest(){
|
||||
final UrlBuilder builder = UrlBuilder.ofHttp("127.0.0.1:8080")
|
||||
.addQuery("param[0].field", "编码");
|
||||
|
||||
Assert.assertEquals("127.0.0.1:8080", builder.getAuthority());
|
||||
}
|
||||
}
|
||||
|
@ -21,7 +21,7 @@
|
||||
<c3p0.version>0.9.5.5</c3p0.version>
|
||||
<dbcp2.version>2.9.0</dbcp2.version>
|
||||
<tomcat-jdbc.version>10.0.20</tomcat-jdbc.version>
|
||||
<druid.version>1.2.9</druid.version>
|
||||
<druid.version>1.2.11</druid.version>
|
||||
<hikariCP.version>4.0.3</hikariCP.version>
|
||||
<sqlite.version>3.36.0.3</sqlite.version>
|
||||
<!-- 此处固定2.5.x,支持到JDK8 -->
|
||||
@ -123,7 +123,7 @@
|
||||
<dependency>
|
||||
<groupId>org.postgresql</groupId>
|
||||
<artifactId>postgresql</artifactId>
|
||||
<version>42.3.4</version>
|
||||
<version>42.4.1</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
|
@ -133,4 +133,11 @@ public class DbTest {
|
||||
return ps;
|
||||
}), new EntityListHandler());
|
||||
}
|
||||
|
||||
@Test
|
||||
@Ignore
|
||||
public void findWithDotTest() {
|
||||
// 当字段带有点时,导致被拆分分别wrap了,因此此时关闭自动包装即可
|
||||
Db.of().disableWrapper().find(Entity.of("user").set("a.b", "1"));
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user