diff options
| author | luccioman <luccioman@users.noreply.github.com> | 2017-11-20 15:23:33 +0100 |
|---|---|---|
| committer | luccioman <luccioman@users.noreply.github.com> | 2017-11-20 15:23:33 +0100 |
| commit | 398c66f06c9d2db6a2bbd1e873316baebd04a914 (patch) | |
| tree | 7170b1b8df99bd9f2cfefa7d88f6ea0f92709e2b /test | |
| parent | 9531b835988f971986b466dbb3e095a4355ec896 (diff) | |
Do locale neutral case conversions in MultiProtocolURL
For any relevant URL parts : host name, URL scheme, session ids or
technical parts (see https://url.spec.whatwg.org/#url-writing and
https://tools.ietf.org/html/rfc3986 for current standard references).
Remaining locale sensitive conversion used for detection of URL word
components in urlComps() makes sense but using detected language would
be preferable than using the default system locale.
Diffstat (limited to 'test')
| -rw-r--r-- | test/java/net/yacy/cora/document/id/MultiProtocolURLTest.java | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/test/java/net/yacy/cora/document/id/MultiProtocolURLTest.java b/test/java/net/yacy/cora/document/id/MultiProtocolURLTest.java index 482ccc2c7..2e18ac578 100644 --- a/test/java/net/yacy/cora/document/id/MultiProtocolURLTest.java +++ b/test/java/net/yacy/cora/document/id/MultiProtocolURLTest.java @@ -14,10 +14,12 @@ import java.util.Map; import java.util.TreeSet; import org.junit.Test; -//import junit.framework.TestCase; +/** + * Automated unit tests for the {@link MultiProtocolURL} class. + */ public class MultiProtocolURLTest { - + @Test public void testSessionIdRemoval() throws MalformedURLException { String[][] testURIs = new String[][]{ @@ -169,11 +171,19 @@ public class MultiProtocolURLTest { Map<String, String> testurls = new HashMap<String, String>(); // ( 1. parameter = urlstring to test, 2. parameter = expected protocol) testurls.put("http://host.com", "http"); + testurls.put("HTTP://EXAMPLE.COM", "http"); + testurls.put("https://host.com", "https"); testurls.put("HTTPS://host.com", "https"); + testurls.put("Ftp://example.org", "ftp"); + testurls.put("FTP://EXAMPLE.ORG", "ftp"); testurls.put("Ftp://host.com", "ftp"); + testurls.put("smb://host.com", "smb"); testurls.put("SMB://host.com", "smb"); testurls.put("/file.com", "file"); testurls.put("file://host.com/file.com", "file"); + testurls.put("file:///file1.txt", "file"); + testurls.put("FILE:///file2.txt", "file"); + testurls.put("MAILTO:Abc@host.com", "mailto"); testurls.put("MailTo:Abc@host.com", "mailto"); for (String txt : testurls.keySet()) { @@ -258,10 +268,12 @@ public class MultiProtocolURLTest { Map<String, String> testurls = new HashMap<String, String>(); // key=testurl, value=result testurls.put("path/file.xml","xml"); // easiest + testurls.put("/FILE.GIF","gif"); // easy upper case testurls.put("path/file?h.pdf",""); // file w/o extension testurls.put("file.html?param=h.pdf","html"); // dot in query part testurls.put("url?param=h.pdf",""); // dot in query part testurls.put("file.html?param", "html"); + testurls.put("FILE.GIF?param", "gif"); testurls.put("/path/",""); for (String s : testurls.keySet()) { System.out.println("test getFileExtension: " + s + " -> " + testurls.get(s)); |
