aboutsummaryrefslogtreecommitdiff
path: root/common/src/test/java/test/at/gv/egovernment/moa/util/URLEncoderTest.java
diff options
context:
space:
mode:
Diffstat (limited to 'common/src/test/java/test/at/gv/egovernment/moa/util/URLEncoderTest.java')
-rw-r--r--common/src/test/java/test/at/gv/egovernment/moa/util/URLEncoderTest.java67
1 files changed, 67 insertions, 0 deletions
diff --git a/common/src/test/java/test/at/gv/egovernment/moa/util/URLEncoderTest.java b/common/src/test/java/test/at/gv/egovernment/moa/util/URLEncoderTest.java
new file mode 100644
index 000000000..88c74f3ae
--- /dev/null
+++ b/common/src/test/java/test/at/gv/egovernment/moa/util/URLEncoderTest.java
@@ -0,0 +1,67 @@
+/*
+ * Copyright 2003 Federal Chancellery Austria
+ * MOA-ID has been developed in a cooperation between BRZ, the Federal
+ * Chancellery Austria - ICT staff unit, and Graz University of Technology.
+ *
+ * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by
+ * the European Commission - subsequent versions of the EUPL (the "Licence");
+ * You may not use this work except in compliance with the Licence.
+ * You may obtain a copy of the Licence at:
+ * http://www.osor.eu/eupl/
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the Licence is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the Licence for the specific language governing permissions and
+ * limitations under the Licence.
+ *
+ * This product combines work with different licenses. See the "NOTICE" text
+ * file for details on the various modules and licenses.
+ * The "NOTICE" text file is part of the distribution. Any derivative works
+ * that you distribute must include a readable copy of the "NOTICE" text file.
+ */
+
+
+package test.at.gv.egovernment.moa.util;
+
+import at.gv.egovernment.moa.util.FileUtils;
+import at.gv.egovernment.moa.util.URLDecoder;
+import at.gv.egovernment.moa.util.URLEncoder;
+import junit.framework.TestCase;
+
+/*
+ * @author Paul Ivancsics
+ * @version $Id$
+ */
+public class URLEncoderTest extends TestCase {
+
+ public void testUnchangedString() throws Exception {
+ String s = "AZaz0123456789.-*_";
+ String senc = URLEncoder.encode(s, "UTF-8");
+ assertEquals(s, senc);
+ }
+ public void testAumlUTF8() throws Exception {
+ String s = "ä";
+ String senc = URLEncoder.encode(s, "UTF-8");
+ assertEquals("%C3%A4", senc);
+ }
+ public void testEncodeDecode() throws Exception {
+ String s = "AZaz09.-*_ <>%=$%&/()@?{}[]\\\"'äöüÄÖÜߧ";
+ String senc = URLEncoder.encode(s, "UTF-8");
+ String sdec = URLDecoder.decode(senc, "UTF-8");
+ assertEquals(s, sdec);
+ }
+ public void testCertInfo() throws Exception {
+ String s = new String(FileUtils.readFile("data/test/xml/VerifyXMLSignature/CertInfoVerifyXMLSignatureRequest.xml", "UTF-8"));
+ String senc = URLEncoder.encode(s, "UTF-8");
+ String sdec = URLDecoder.decode(senc, "UTF-8");
+ assertEquals(s, sdec);
+ }
+ /*public void testJDK14() throws Exception {
+ String s = new String(FileUtils.readFile("data/test/xml/VerifyXMLSignature/CertInfoVerifyXMLSignatureRequest.xml", "UTF-8"));
+ String senc = URLEncoder.encode(s, "UTF-8");
+ String senc14 = java.net.URLEncoder.encode(s, "UTF-8");
+ assertEquals(senc, senc14);
+ }*/
+
+}