diff options
author | Sven Gothel <[email protected]> | 2013-06-19 05:05:29 +0200 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2013-06-19 05:05:29 +0200 |
commit | b97666cf0a6d49c593d565d0eba8af92bcf5eb94 (patch) | |
tree | af11c5fe5aed37c6ef0bfb79927f206acda2f0bd /src | |
parent | 4376174ad35fdaf76f59430328582e913f468674 (diff) |
Fix URLCompositionTest for Bug 757: If file, replace '/' in expected result w/ OS specific File.separatorChar
Diffstat (limited to 'src')
-rw-r--r-- | src/junit/com/jogamp/common/net/URLCompositionTest.java | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/src/junit/com/jogamp/common/net/URLCompositionTest.java b/src/junit/com/jogamp/common/net/URLCompositionTest.java index 7ddd80c..4e92bc0 100644 --- a/src/junit/com/jogamp/common/net/URLCompositionTest.java +++ b/src/junit/com/jogamp/common/net/URLCompositionTest.java @@ -1,5 +1,6 @@ package com.jogamp.common.net; +import java.io.File; import java.io.IOException; import java.net.MalformedURLException; import java.net.URI; @@ -87,31 +88,31 @@ public class URLCompositionTest extends JunitTracer { @Test public void showURLComponents1() throws IOException, URISyntaxException { testURI2URL("jar:file:/usr/local/projects/JOGL/gluegen/build-x86_64%20%c3%b6%c3%a4%20lala/gluegen-rt.jar!/com/jogamp/common/os/Platform.class", - "jar:file:/usr/local/projects/JOGL/gluegen/build-x86_64 öä lala/gluegen-rt.jar!/com/jogamp/common/os/Platform.class"); + "jar:file:/usr/local/projects/JOGL/gluegen/build-x86_64 öä lala/gluegen-rt.jar!/com/jogamp/common/os/Platform.class", true); testURI2URL("jar:file:/usr/local/projects/JOGL/gluegen/build-x86_64%20%c3%b6%c3%a4%20lala/gluegen-rt.jar!/", - "jar:file:/usr/local/projects/JOGL/gluegen/build-x86_64 öä lala/gluegen-rt.jar!/"); + "jar:file:/usr/local/projects/JOGL/gluegen/build-x86_64 öä lala/gluegen-rt.jar!/", true); testURI2URL("file:/usr/local/projects/JOGL/gluegen/build-x86_64%20%c3%b6%c3%a4%20lala/gluegen-rt.jar", - "file:/usr/local/projects/JOGL/gluegen/build-x86_64 öä lala/gluegen-rt.jar"); + "file:/usr/local/projects/JOGL/gluegen/build-x86_64 öä lala/gluegen-rt.jar", true); testURI2URL("jar:http:/usr/local/projects/JOGL/gluegen/build-x86_64%20%c3%b6%c3%a4%20lala/gluegen-rt.jar!/com/jogamp/common/os/Platform.class", - "jar:http:/usr/local/projects/JOGL/gluegen/build-x86_64%20%c3%b6%c3%a4%20lala/gluegen-rt.jar!/com/jogamp/common/os/Platform.class"); + "jar:http:/usr/local/projects/JOGL/gluegen/build-x86_64%20%c3%b6%c3%a4%20lala/gluegen-rt.jar!/com/jogamp/common/os/Platform.class", false); testURI2URL("jar:http:/usr/local/projects/JOGL/gluegen/build-x86_64%20%c3%b6%c3%a4%20lala/gluegen-rt.jar!/", - "jar:http:/usr/local/projects/JOGL/gluegen/build-x86_64%20%c3%b6%c3%a4%20lala/gluegen-rt.jar!/"); + "jar:http:/usr/local/projects/JOGL/gluegen/build-x86_64%20%c3%b6%c3%a4%20lala/gluegen-rt.jar!/", false); testURI2URL("http:/usr/local/projects/JOGL/gluegen/build-x86_64%20%c3%b6%c3%a4%20lala/gluegen-rt.jar", - "http:/usr/local/projects/JOGL/gluegen/build-x86_64%20%c3%b6%c3%a4%20lala/gluegen-rt.jar"); + "http:/usr/local/projects/JOGL/gluegen/build-x86_64%20%c3%b6%c3%a4%20lala/gluegen-rt.jar", false); testURI2URL("jar:ftp:/usr/local/projects/JOGL/gluegen/build-x86_64%20%c3%b6%c3%a4%20lala/gluegen-rt.jar!/com/jogamp/common/os/Platform.class", - "jar:ftp:/usr/local/projects/JOGL/gluegen/build-x86_64%20%c3%b6%c3%a4%20lala/gluegen-rt.jar!/com/jogamp/common/os/Platform.class"); + "jar:ftp:/usr/local/projects/JOGL/gluegen/build-x86_64%20%c3%b6%c3%a4%20lala/gluegen-rt.jar!/com/jogamp/common/os/Platform.class", false); testURI2URL("ftp:/usr/local/projects/JOGL/gluegen/build-x86_64%20%c3%b6%c3%a4%20lala/gluegen-rt.jar", - "ftp:/usr/local/projects/JOGL/gluegen/build-x86_64%20%c3%b6%c3%a4%20lala/gluegen-rt.jar"); + "ftp:/usr/local/projects/JOGL/gluegen/build-x86_64%20%c3%b6%c3%a4%20lala/gluegen-rt.jar", false); } - void testURI2URL(String source, String expected) throws IOException, URISyntaxException { + void testURI2URL(String source, String expected, boolean usesFile) throws IOException, URISyntaxException { System.err.println("XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"); final URI uri0 = new URI(source); System.err.println("uri: "+uri0.toString()); @@ -119,7 +120,8 @@ public class URLCompositionTest extends JunitTracer { final URL url0 = IOUtil.toURL(uri0); final String actual = url0.toExternalForm(); System.err.println("url: "+actual); - Assert.assertEquals(expected, actual); + final String expectedOS = usesFile ? expected.replace('/', File.separatorChar) : expected; + Assert.assertEquals(expectedOS, actual); System.err.println("XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"); } |