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); }*/ }