package test.at.gv.egovernment.moa.util; import java.net.URLEncoder; import at.gv.egovernment.moa.util.FileUtils; import at.gv.egovernment.moa.util.URLDecoder; import junit.framework.TestCase; /* * @author Paul Ivancsics * @version $Id$ */ public class URLDecoderTest extends TestCase { public void test() throws Exception { String s = "immerZUA0129<>%==$$%&/()@?{()=} \\\"äöüÄÖÜ?§"; String senc = URLEncoder.encode(s); String sdec = URLDecoder.decode(senc, "ISO-8859-1"); assertEquals(s, sdec); } public void testUTF8() throws Exception { String s = new String(FileUtils.readFile("data/test/xml/CreateXMLSignature/CreateXMLSignatureResponse.xml")); String senc = URLEncoder.encode(s); String sdec = URLDecoder.decode(senc, "UTF-8"); String sutf8 = FileUtils.readFile("data/test/xml/CreateXMLSignature/CreateXMLSignatureResponse.xml", "UTF-8"); assertEquals(sutf8, sdec); } }