JAL-3130 adapted getdown src. attempt 2. first attempt failed due to cp'ed .git files
[jalview.git] / getdown / src / getdown / core / src / test / java / com / threerings / getdown / util / StringUtilTest.java
1 //
2 // Getdown - application installer, patcher and launcher
3 // Copyright (C) 2004-2018 Getdown authors
4 // https://github.com/threerings/getdown/blob/master/LICENSE
5
6 package com.threerings.getdown.util;
7
8 import org.junit.Test;
9
10 import static com.threerings.getdown.util.StringUtil.couldBeValidUrl;
11 import static org.junit.Assert.assertFalse;
12 import static org.junit.Assert.assertTrue;
13
14 /**
15  * Tests {@link StringUtil}.
16  */
17 public class StringUtilTest
18 {
19     @Test public void testCouldBeValidUrl ()
20     {
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/"));
24
25         assertFalse(couldBeValidUrl("http://www.foo.com & echo hello"));
26         assertFalse(couldBeValidUrl("http://www.foo.com\""));
27     }
28 }