2 // Getdown - application installer, patcher and launcher
3 // Copyright (C) 2004-2018 Getdown authors
4 // https://github.com/threerings/getdown/blob/master/LICENSE
6 package com.threerings.getdown.util;
10 import static com.threerings.getdown.util.StringUtil.couldBeValidUrl;
11 import static org.junit.Assert.assertFalse;
12 import static org.junit.Assert.assertTrue;
15 * Tests {@link StringUtil}.
17 public class StringUtilTest
19 @Test public void testCouldBeValidUrl ()
21 assertTrue(couldBeValidUrl("http://www.foo.com/"));
22 assertTrue(couldBeValidUrl("http://www.foo.com/A-B-C/1_2_3/~bar/q.jsp?x=u+i&y=2;3;4#baz%20baz"));
23 assertTrue(couldBeValidUrl("https://user:secret@www.foo.com/"));
25 assertFalse(couldBeValidUrl("http://www.foo.com & echo hello"));
26 assertFalse(couldBeValidUrl("http://www.foo.com\""));