blob: 08fd0d4869fdff84032edb09ae02126f6b4d00ca (
plain)
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
|
package instrumentationTest.de.test.antennapod.util;
import android.test.AndroidTestCase;
import de.danoeh.antennapod.util.URLChecker;
/**
* Test class for URLChecker
*/
public class URLCheckerTest extends AndroidTestCase {
public void testCorrectURLHttp() {
final String in = "http://example.com";
final String out = URLChecker.prepareURL(in);
assertEquals(in, out);
}
public void testCorrectURLHttps() {
final String in = "https://example.com";
final String out = URLChecker.prepareURL(in);
assertEquals(in, out);
}
public void testMissingProtocol() {
final String in = "example.com";
final String out = URLChecker.prepareURL(in);
assertEquals("http://example.com", out);
}
public void testFeedProtocol() {
final String in = "feed://example.com";
final String out = URLChecker.prepareURL(in);
assertEquals("http://example.com", out);
}
public void testPcastProtocol() {
final String in = "pcast://example.com";
final String out = URLChecker.prepareURL(in);
assertEquals("http://example.com", out);
}
public void testItpcProtocol() {
final String in = "itpc://example.com";
final String out = URLChecker.prepareURL(in);
assertEquals("http://example.com", out);
}
public void testWhiteSpaceUrlShouldNotAppend() {
final String in = "\n http://example.com \t";
final String out = URLChecker.prepareURL(in);
assertEquals("http://example.com", out);
}
public void testWhiteSpaceShouldAppend() {
final String in = "\n example.com \t";
final String out = URLChecker.prepareURL(in);
assertEquals("http://example.com", out);
}
}
|