comparison env/lib/python3.7/site-packages/schema_salad/java/test_utils/DefaultFetcherTest.java @ 0:26e78fe6e8c4 draft

"planemo upload commit c699937486c35866861690329de38ec1a5d9f783"
author shellac
date Sat, 02 May 2020 07:14:21 -0400
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:26e78fe6e8c4
1 package ${package}.utils;
2
3 import org.junit.Assert;
4 import org.junit.Test;
5
6 public class DefaultFetcherTest {
7 @Test
8 public void testUnderscoreJoin() {
9 final DefaultFetcher fetcher = new DefaultFetcher();
10 Assert.assertEquals(fetcher.urlJoin("http://googl.com/", "_:/moo"), "_:/moo");
11 }
12
13 @Test
14 public void testUnixJoin() {
15 final DefaultFetcher fetcher = new DefaultFetcher();
16 String url;
17
18 url = fetcher.urlJoin("file:///home/fred/foo.cwl", "soup.cwl");
19 Assert.assertEquals(url, "file:///home/fred/soup.cwl");
20
21 url = fetcher.urlJoin("file:///home/fred/foo.cwl", "../alice/soup.cwl");
22 Assert.assertEquals(url, "file:///home/alice/soup.cwl");
23 // relative from root
24 url = fetcher.urlJoin("file:///home/fred/foo.cwl", "/baz/soup.cwl");
25 Assert.assertEquals(url, "file:///baz/soup.cwl");
26
27 url = fetcher.urlJoin("file:///home/fred/foo.cwl", "http://example.com/bar/soup.cwl");
28 Assert.assertEquals(url, "http://example.com/bar/soup.cwl");
29
30 url = fetcher.urlJoin("http://example.com/fred/foo.cwl", "soup.cwl");
31 Assert.assertEquals(url, "http://example.com/fred/soup.cwl");
32
33 // Root-relative -- here relative to http host, not file:///
34 url = fetcher.urlJoin("http://example.com/fred/foo.cwl", "/bar/soup.cwl");
35 Assert.assertEquals(url, "http://example.com/bar/soup.cwl");
36 }
37 }