From 4d35974c6b87692bc1c3f6e6b7bb674a7a478053 Mon Sep 17 00:00:00 2001 From: Sven Gothel Date: Wed, 19 Jun 2013 05:19:17 +0200 Subject: Fix URLCompositionTest for Bug 757 (2): If file, replace '/' in expected result w/ OS specific File.separatorChar The JAR entry shall stay untouched, i.e. separator is platform independent '/'. --- src/junit/com/jogamp/common/net/URLCompositionTest.java | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/junit/com/jogamp/common/net/URLCompositionTest.java b/src/junit/com/jogamp/common/net/URLCompositionTest.java index 4e92bc0..9380d79 100644 --- a/src/junit/com/jogamp/common/net/URLCompositionTest.java +++ b/src/junit/com/jogamp/common/net/URLCompositionTest.java @@ -120,7 +120,17 @@ public class URLCompositionTest extends JunitTracer { final URL url0 = IOUtil.toURL(uri0); final String actual = url0.toExternalForm(); System.err.println("url: "+actual); - final String expectedOS = usesFile ? expected.replace('/', File.separatorChar) : expected; + final String expectedOS; + if( usesFile ) { + final int jarSepI = expected.lastIndexOf("!"); + final int replB = 0 <= jarSepI ? jarSepI : expected.length(); + final String partA = expected.substring(0, replB).replace('/', File.separatorChar); + final String partB = expected.substring(replB); + expectedOS = partA+partB; + } else { + expectedOS = expected; + } + System.err.println("expected: "+expected+", "+expectedOS); Assert.assertEquals(expectedOS, actual); System.err.println("XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"); } -- cgit v1.2.3