diff options
Diffstat (limited to 'bundles/org.eclipse.equinox.p2.tests.discovery/src/org/eclipse/equinox/p2/discovery/tests/core/util/TransportUtilTest.java')
-rw-r--r-- | bundles/org.eclipse.equinox.p2.tests.discovery/src/org/eclipse/equinox/p2/discovery/tests/core/util/TransportUtilTest.java | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/bundles/org.eclipse.equinox.p2.tests.discovery/src/org/eclipse/equinox/p2/discovery/tests/core/util/TransportUtilTest.java b/bundles/org.eclipse.equinox.p2.tests.discovery/src/org/eclipse/equinox/p2/discovery/tests/core/util/TransportUtilTest.java index 725581720..4ab526e8d 100644 --- a/bundles/org.eclipse.equinox.p2.tests.discovery/src/org/eclipse/equinox/p2/discovery/tests/core/util/TransportUtilTest.java +++ b/bundles/org.eclipse.equinox.p2.tests.discovery/src/org/eclipse/equinox/p2/discovery/tests/core/util/TransportUtilTest.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2013 Tasktop Technologies and others. + * Copyright (c) 2013, 2018 Tasktop Technologies and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -10,27 +10,35 @@ *******************************************************************************/ package org.eclipse.equinox.p2.discovery.tests.core.util; -import junit.framework.TestCase; -import org.eclipse.equinox.internal.p2.discovery.compatibility.util.TransportUtil; +import static org.junit.Assert.assertEquals; -public class TransportUtilTest extends TestCase { +import org.eclipse.equinox.internal.p2.discovery.compatibility.util.TransportUtil; +import org.junit.Test; +public class TransportUtilTest { + @Test public void testGetFileNameForJar() throws Exception { assertEquals("lib_1.0.jar", TransportUtil.getFileNameFor("lib-1.0.jar")); //$NON-NLS-1$ //$NON-NLS-2$ } + @Test public void testGetFileNameForUrl() throws Exception { - assertEquals("lib_1.0.jar", TransportUtil.getFileNameFor("http://www.eclipse.org/downloads/download.php?file=/discovery/lib-1.0.jar")); //$NON-NLS-1$ //$NON-NLS-2$ + assertEquals("lib_1.0.jar", TransportUtil //$NON-NLS-1$ + .getFileNameFor("http://www.eclipse.org/downloads/download.php?file=/discovery/lib-1.0.jar")); //$NON-NLS-1$ } + @Test public void testGetFileNameForUrlWithQuery() throws Exception { - assertEquals("lib_1.0.jar_r_1_protocol_http", TransportUtil.getFileNameFor("http://www.eclipse.org/downloads/download.php?file=/discovery/lib-1.0.jar&r=1&protocol=http")); //$NON-NLS-1$ //$NON-NLS-2$ + assertEquals("lib_1.0.jar_r_1_protocol_http", TransportUtil.getFileNameFor( //$NON-NLS-1$ + "http://www.eclipse.org/downloads/download.php?file=/discovery/lib-1.0.jar&r=1&protocol=http")); //$NON-NLS-1$ } + @Test public void testGetFileNameForUrlEndingWithSlash() throws Exception { assertEquals("a.jar", TransportUtil.getFileNameFor("a.jar/")); //$NON-NLS-1$ //$NON-NLS-2$ } + @Test public void testGetFileNameForUrlWithFilesystemReservedCharacters() throws Exception { assertEquals("1_2_3_4_5_6_7_8_9_", TransportUtil.getFileNameFor("1<2>3:4\"5\\6|7?8*9+")); //$NON-NLS-1$ //$NON-NLS-2$ } |