mirror of
https://gitee.com/chinabugotech/hutool.git
synced 2025-07-21 15:09:48 +08:00
fix escape bug
This commit is contained in:
@@ -4,12 +4,12 @@ import org.junit.Assert;
|
||||
import org.junit.Test;
|
||||
|
||||
public class EscapeUtilTest {
|
||||
|
||||
|
||||
@Test
|
||||
public void escapeHtml4Test() {
|
||||
String escapeHtml4 = EscapeUtil.escapeHtml4("<a>你好</a>");
|
||||
Assert.assertEquals("<a>你好</a>", escapeHtml4);
|
||||
|
||||
|
||||
String result = EscapeUtil.unescapeHtml4("振荡器类型");
|
||||
Assert.assertEquals("振荡器类型", result);
|
||||
|
||||
@@ -39,9 +39,9 @@ public class EscapeUtilTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void escapeSinleQuotesTest(){
|
||||
public void escapeSingleQuotesTest(){
|
||||
String str = "'some text with single quotes'";
|
||||
final String s = EscapeUtil.escapeHtml4(str);
|
||||
Assert.assertEquals(str, s);
|
||||
Assert.assertEquals("'some text with single quotes'", s);
|
||||
}
|
||||
}
|
||||
|
@@ -287,4 +287,11 @@ public class XmlUtilTest {
|
||||
String format = XmlUtil.toStr(xml,"GBK",true);
|
||||
Console.log(format);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void escapeTest(){
|
||||
String a = "<>";
|
||||
final String escape = XmlUtil.escape(a);
|
||||
Console.log(escape);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user