mirror of
https://gitee.com/dromara/hutool.git
synced 2025-05-03 04:13:49 +08:00
add test
This commit is contained in:
parent
06cc38734c
commit
496d07c8d7
@ -33,6 +33,7 @@
|
||||
* 【core 】 修复FileResource构造fileName参数无效问题(issue#1942@Github)
|
||||
* 【cache 】 修复WeakCache键值强关联导致的无法回收问题(issue#1953@Github)
|
||||
* 【core 】 修复ZipUtil相对路径父路径获取null问题(issue#1961@Github)
|
||||
* 【http 】 修复HttpUtil.normalizeParams未判空导致的问题(issue#1975@Github)
|
||||
|
||||
-------------------------------------------------------------------------------------------------------------
|
||||
|
||||
|
@ -182,6 +182,12 @@ public class ArrayUtilTest {
|
||||
Assert.assertEquals(9, range[9]);
|
||||
}
|
||||
|
||||
@Test(expected = NegativeArraySizeException.class)
|
||||
public void rangeMinTest() {
|
||||
//noinspection ResultOfMethodCallIgnored
|
||||
ArrayUtil.range(0, Integer.MIN_VALUE);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void maxTest() {
|
||||
int max = ArrayUtil.max(1, 2, 13, 4, 5);
|
||||
|
@ -539,6 +539,9 @@ public class HttpUtil {
|
||||
* @since 4.5.2
|
||||
*/
|
||||
public static String normalizeParams(String paramPart, Charset charset) {
|
||||
if(StrUtil.isEmpty(paramPart)){
|
||||
return paramPart;
|
||||
}
|
||||
final StrBuilder builder = StrBuilder.create(paramPart.length() + 16);
|
||||
final int len = paramPart.length();
|
||||
String name = null;
|
||||
|
@ -302,6 +302,12 @@ public class HttpUtilTest {
|
||||
Assert.assertEquals("%E5%8F%82%E6%95%B0", encodeResult);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void normalizeBlankParamsTest() {
|
||||
String encodeResult = HttpUtil.normalizeParams("", CharsetUtil.CHARSET_UTF_8);
|
||||
Assert.assertEquals("", encodeResult);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void getMimeTypeTest() {
|
||||
String mimeType = HttpUtil.getMimeType("aaa.aaa");
|
||||
|
Loading…
Reference in New Issue
Block a user