File: DefaultFetcherTest.java

package info (click to toggle)
python-schema-salad 8.9.20251102115403-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 6,060 kB
  • sloc: python: 19,247; cpp: 2,631; cs: 1,869; java: 1,341; makefile: 187; xml: 184; sh: 103; javascript: 46
file content (37 lines) | stat: -rw-r--r-- 1,347 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
package ${package}.utils;

import org.junit.Assert;
import org.junit.Test;

public class DefaultFetcherTest {
  @Test
  public void testUnderscoreJoin() {
    final DefaultFetcher fetcher = new DefaultFetcher();
    Assert.assertEquals(fetcher.urlJoin("http://googl.com/", "_:/moo"), "_:/moo");
  }

  @Test
  public void testUnixJoin() {
    final DefaultFetcher fetcher = new DefaultFetcher();
    String url;

    url = fetcher.urlJoin("file:///home/fred/foo.cwl", "soup.cwl");
    Assert.assertEquals(url, "file:///home/fred/soup.cwl");

    url = fetcher.urlJoin("file:///home/fred/foo.cwl", "../alice/soup.cwl");
    Assert.assertEquals(url, "file:///home/alice/soup.cwl");
    // relative from root
    url = fetcher.urlJoin("file:///home/fred/foo.cwl", "/baz/soup.cwl");
    Assert.assertEquals(url, "file:///baz/soup.cwl");

    url = fetcher.urlJoin("file:///home/fred/foo.cwl", "http://example.com/bar/soup.cwl");
    Assert.assertEquals(url, "http://example.com/bar/soup.cwl");

    url = fetcher.urlJoin("http://example.com/fred/foo.cwl", "soup.cwl");
    Assert.assertEquals(url, "http://example.com/fred/soup.cwl");

    // Root-relative -- here relative to http host, not file:///
    url = fetcher.urlJoin("http://example.com/fred/foo.cwl", "/bar/soup.cwl");
    Assert.assertEquals(url, "http://example.com/bar/soup.cwl");
  }
}