mirror of
https://gitee.com/chinabugotech/hutool.git
synced 2025-07-21 15:09:48 +08:00
add test
This commit is contained in:
@@ -46,4 +46,10 @@ public class UnicodeUtilTest {
|
|||||||
String res = UnicodeUtil.toString(str);
|
String res = UnicodeUtil.toString(str);
|
||||||
Assert.assertEquals("{\"code\":403,\"enmsg\":\"Product not found\",\"cnmsg\":\"产品不存在,或已删除\",\"data\":null}", res);
|
Assert.assertEquals("{\"code\":403,\"enmsg\":\"Product not found\",\"cnmsg\":\"产品不存在,或已删除\",\"data\":null}", res);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void issueI50MI6Test(){
|
||||||
|
String s = UnicodeUtil.toUnicode("烟", true);
|
||||||
|
Assert.assertEquals("\\u70df", s);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@@ -3,6 +3,8 @@ package cn.hutool.core.util;
|
|||||||
import org.junit.Assert;
|
import org.junit.Assert;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
|
import java.nio.charset.StandardCharsets;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* HexUtil单元测试
|
* HexUtil单元测试
|
||||||
* @author Looly
|
* @author Looly
|
||||||
@@ -20,6 +22,12 @@ public class HexUtilTest {
|
|||||||
Assert.assertEquals(str, decodedStr);
|
Assert.assertEquals(str, decodedStr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void issueI50MI6Test(){
|
||||||
|
String s = HexUtil.encodeHexStr("烟".getBytes(StandardCharsets.UTF_16BE));
|
||||||
|
Assert.assertEquals("70df", s);
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void toUnicodeHexTest() {
|
public void toUnicodeHexTest() {
|
||||||
String unicodeHex = HexUtil.toUnicodeHex('\u2001');
|
String unicodeHex = HexUtil.toUnicodeHex('\u2001');
|
||||||
|
Reference in New Issue
Block a user