From fc36f997c76474ba8ae2d6ba81cce4d50f24b81f Mon Sep 17 00:00:00 2001 From: "Mars.Ma" Date: Mon, 9 Sep 2019 14:22:03 +0800 Subject: [PATCH] =?UTF-8?q?KERNEL-1198=20=E6=96=B0=E6=B7=BB=E5=8A=A0?= =?UTF-8?q?=E6=96=B9=E6=B3=95=E7=9A=84=E5=8D=95=E5=85=83=E6=B5=8B=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/fanruan/api/util/CodeKitTest.java | 14 +++++++ .../java/com/fanruan/api/xml/XmlKitTest.java | 38 +++++++++++++++++++ 2 files changed, 52 insertions(+) create mode 100644 src/test/java/com/fanruan/api/xml/XmlKitTest.java diff --git a/src/test/java/com/fanruan/api/util/CodeKitTest.java b/src/test/java/com/fanruan/api/util/CodeKitTest.java index 10853e6..5224324 100644 --- a/src/test/java/com/fanruan/api/util/CodeKitTest.java +++ b/src/test/java/com/fanruan/api/util/CodeKitTest.java @@ -1,5 +1,6 @@ package com.fanruan.api.util; +import com.fr.stable.CodeUtils; import com.fr.stable.CommonCodeUtils; import org.junit.Assert; import org.junit.Test; @@ -9,4 +10,17 @@ public class CodeKitTest { public void passwordDecode(String passwordText) { Assert.assertEquals(CodeKit.passwordDecode(passwordText), 123); } + + @Test + public void cjkDecode() { + String s = "中文 한글 日本語"; + String encode = CodeUtils.cjkEncode(s); + + try { + String decode = CodeKit.cjkDecode(encode); + Assert.assertTrue(s.equals(decode)); + } catch (Exception e) { + + } + } } diff --git a/src/test/java/com/fanruan/api/xml/XmlKitTest.java b/src/test/java/com/fanruan/api/xml/XmlKitTest.java new file mode 100644 index 0000000..2c33d4d --- /dev/null +++ b/src/test/java/com/fanruan/api/xml/XmlKitTest.java @@ -0,0 +1,38 @@ +package com.fanruan.api.xml; + +import com.fr.base.Parameter; +import com.fr.base.TableData; +import com.fr.plugin.db.json.core.JSONTableData; +import com.fr.stable.ParameterProvider; +import com.fr.stable.bridge.StableFactory; +import com.fr.stable.xml.StableXMLUtils; +import com.fr.stable.xml.XMLPrintWriter; +import com.fr.stable.xml.XMLUtils; +import com.fr.stable.xml.XMLableReader; +import com.fr.third.javax.xml.stream.XMLStreamException; +import org.junit.Assert; +import org.junit.Test; + +import static org.junit.Assert.*; + +public class XmlKitTest { + + @Test + public void readParameter() { + try { + XMLableReader xml = XMLableReader.createXMLableReader("\n" + + "\n" + + "Tove\n" + + "Jani\n" + + "Reminder\n" + + "Don't forget me this weekend!\n" + + ""); + Parameter parameter = new Parameter("test", 1); + StableFactory.registerXMLDescription("Parameter",parameter); + Parameter p = (Parameter)XmlKit.readParameter(xml); + Assert.assertTrue(p.getName().equals("test")); + } catch (XMLStreamException e) { + e.printStackTrace(); + } + } +} \ No newline at end of file