admin
2021-07-20 27bd1f81221b8c8e8047118a64c2beb7bc214bbb
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
package com.nostra13.universalimageloader.core.download;
 
import org.fest.assertions.api.Assertions;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.robolectric.RobolectricTestRunner;
 
import com.nostra13.universalimageloader.core.download.ImageDownloader.Scheme;
 
@RunWith(RobolectricTestRunner.class)
public class BaseImageDownloaderTest {
 
    @Test
    public void testSchemeHttp() throws Exception {
        String uri = "http://image.com/1.png";
        Scheme result = Scheme.ofUri(uri);
        Scheme expected = Scheme.HTTP;
        Assertions.assertThat(result).isEqualTo(expected);
    }
 
    @Test
    public void testSchemeHttps() throws Exception {
        String uri = "https://image.com/1.png";
        Scheme result = Scheme.ofUri(uri);
        Scheme expected = Scheme.HTTPS;
        Assertions.assertThat(result).isEqualTo(expected);
    }
 
    @Test
    public void testSchemeContent() throws Exception {
        String uri = "content://path/to/content";
        Scheme result = Scheme.ofUri(uri);
        Scheme expected = Scheme.CONTENT;
        Assertions.assertThat(result).isEqualTo(expected);
    }
 
    @Test
    public void testSchemeAssets() throws Exception {
        String uri = "assets://folder/1.png";
        Scheme result = Scheme.ofUri(uri);
        Scheme expected = Scheme.ASSETS;
        Assertions.assertThat(result).isEqualTo(expected);
    }
 
    @Test
    public void testSchemeDrawables() throws Exception {
        String uri = "drawable://123456890";
        Scheme result = Scheme.ofUri(uri);
        Scheme expected = Scheme.DRAWABLE;
        Assertions.assertThat(result).isEqualTo(expected);
    }
 
    @Test
    public void testSchemeFile() throws Exception {
        String uri = "file://path/on/the/device/1.png";
        Scheme result = Scheme.ofUri(uri);
        Scheme expected = Scheme.FILE;
        Assertions.assertThat(result).isEqualTo(expected);
    }
 
    @Test
    public void testSchemeUnknown() throws Exception {
        String uri = "other://image.com/1.png";
        Scheme result = Scheme.ofUri(uri);
        Scheme expected = Scheme.UNKNOWN;
        Assertions.assertThat(result).isEqualTo(expected);
    }
}