diff options
author | ByteHamster <info@bytehamster.com> | 2019-12-17 17:15:31 +0100 |
---|---|---|
committer | ByteHamster <info@bytehamster.com> | 2020-01-20 15:39:00 +0100 |
commit | ac0cb04154ae09cb7868de5f99c5138eff4012e9 (patch) | |
tree | 790652b364158e53c33fa1e0143c9116ffd9700d /app | |
parent | 72520d7ac431532a412328977a86a03e38f674f3 (diff) | |
download | AntennaPod-ac0cb04154ae09cb7868de5f99c5138eff4012e9.zip |
More forgiving duplicate detection
Diffstat (limited to 'app')
-rw-r--r-- | app/src/androidTest/java/de/test/antennapod/util/URLCheckerTest.java | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/app/src/androidTest/java/de/test/antennapod/util/URLCheckerTest.java b/app/src/androidTest/java/de/test/antennapod/util/URLCheckerTest.java index 5bc2f7bd8..4893d7d82 100644 --- a/app/src/androidTest/java/de/test/antennapod/util/URLCheckerTest.java +++ b/app/src/androidTest/java/de/test/antennapod/util/URLCheckerTest.java @@ -5,6 +5,8 @@ import de.danoeh.antennapod.core.util.URLChecker; import org.junit.Test; import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; /** * Test class for URLChecker @@ -119,4 +121,30 @@ public class URLCheckerTest { final String out = URLChecker.prepareURL(in, null); assertEquals("http://example.com", out); } + + @Test + public void testUrlEqualsSame() { + assertTrue(URLChecker.urlEquals("https://www.example.com/test", "https://www.example.com/test")); + assertTrue(URLChecker.urlEquals("https://www.example.com/test", "https://www.example.com/test/")); + assertTrue(URLChecker.urlEquals("https://www.example.com/test", "https://www.example.com//test")); + assertTrue(URLChecker.urlEquals("https://www.example.com", "https://www.example.com/")); + assertTrue(URLChecker.urlEquals("https://www.example.com", "http://www.example.com")); + assertTrue(URLChecker.urlEquals("http://www.example.com/", "https://www.example.com/")); + assertTrue(URLChecker.urlEquals("https://www.example.com/?id=42", "https://www.example.com/?id=42")); + assertTrue(URLChecker.urlEquals("https://example.com/podcast%20test", "https://example.com/podcast test")); + assertTrue(URLChecker.urlEquals("https://example.com/?a=podcast%20test", "https://example.com/?a=podcast test")); + assertTrue(URLChecker.urlEquals("https://example.com/?", "https://example.com/")); + assertTrue(URLChecker.urlEquals("https://example.com/?", "https://example.com")); + assertTrue(URLChecker.urlEquals("https://Example.com", "https://example.com")); + assertTrue(URLChecker.urlEquals("https://example.com/test", "https://example.com/Test")); + } + + @Test + public void testUrlEqualsDifferent() { + assertFalse(URLChecker.urlEquals("https://www.example.com/test", "https://www.example2.com/test")); + assertFalse(URLChecker.urlEquals("https://www.example.com/test", "https://www.example.de/test")); + assertFalse(URLChecker.urlEquals("https://example.com/", "https://otherpodcast.example.com/")); + assertFalse(URLChecker.urlEquals("https://www.example.com/?id=42&a=b", "https://www.example.com/?id=43&a=b")); + assertFalse(URLChecker.urlEquals("https://example.com/podcast%25test", "https://example.com/podcast test")); + } } |