--- /dev/null
+/*******************************************************************************\r
+ * Copyright (c) 2007, 2010 Association for Decentralized Information Management\r
+ * in Industry THTH ry.\r
+ * All rights reserved. This program and the accompanying materials\r
+ * are made available under the terms of the Eclipse Public License v1.0\r
+ * which accompanies this distribution, and is available at\r
+ * http://www.eclipse.org/legal/epl-v10.html\r
+ *\r
+ * Contributors:\r
+ * VTT Technical Research Centre of Finland - initial API and implementation\r
+ *******************************************************************************/\r
+package org.simantics.databoard.tests;\r
+\r
+import junit.framework.TestCase;\r
+\r
+import org.junit.Test;\r
+import org.simantics.databoard.util.URIUtil;\r
+\r
+public class TestURIUtil extends TestCase {\r
+\r
+ public static final String URI1 = "first/second%third fourth_fifth";\r
+ public static final String URI2 = "3first/second%third fourth_fifth";\r
+ public static final String URI3 = "#3first/second%third fourth_fifth";\r
+\r
+ @Test\r
+ public void testEncode() {\r
+ assertEquals("first$2fsecond$25third_fourth$5ffifth", URIUtil.encodeIdentifier(URI1));\r
+ assertEquals("first%2fsecond%25third_fourth%5ffifth", URIUtil.encodeURI(URI1));\r
+ assertEquals("_3first$2fsecond$25third_fourth$5ffifth", URIUtil.encodeIdentifier(URI2));\r
+ assertEquals("3first%2fsecond%25third_fourth%5ffifth", URIUtil.encodeURI(URI2));\r
+ assertEquals("3first/second%third fourth_fifth", URIUtil.decodeIdentifier(URIUtil.encodeIdentifier(URI2)));\r
+ assertEquals("3first/second%third fourth_fifth", URIUtil.decodeURI(URIUtil.encodeURI(URI2)));\r
+ assertEquals("%233first%2fsecond%25third_fourth%5ffifth", URIUtil.encodeURI(URI3));\r
+ assertEquals("#3first/second%third fourth_fifth", URIUtil.decodeURI(URIUtil.encodeURI(URI3)));\r
+ }\r
+\r
+ @Test\r
+ public void testDecode() {\r
+ }\r
+\r
+}\r