X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=getdown%2Fsrc%2Fgetdown%2Fcore%2Fsrc%2Ftest%2Fjava%2Fcom%2Fthreerings%2Fgetdown%2Futil%2FStringUtilTest.java;fp=getdown%2Fsrc%2Fgetdown%2Fcore%2Fsrc%2Ftest%2Fjava%2Fcom%2Fthreerings%2Fgetdown%2Futil%2FStringUtilTest.java;h=f70bab9d12ea8e2883ba632ab0ed67ffc28a008e;hb=ca8504cf9d10874dce9f07cf7a9d933853fe0dd0;hp=0000000000000000000000000000000000000000;hpb=775e7bc104584e88dddcea73fbf02c66f5200c16;p=jalview.git diff --git a/getdown/src/getdown/core/src/test/java/com/threerings/getdown/util/StringUtilTest.java b/getdown/src/getdown/core/src/test/java/com/threerings/getdown/util/StringUtilTest.java new file mode 100644 index 0000000..f70bab9 --- /dev/null +++ b/getdown/src/getdown/core/src/test/java/com/threerings/getdown/util/StringUtilTest.java @@ -0,0 +1,28 @@ +// +// Getdown - application installer, patcher and launcher +// Copyright (C) 2004-2018 Getdown authors +// https://github.com/threerings/getdown/blob/master/LICENSE + +package com.threerings.getdown.util; + +import org.junit.Test; + +import static com.threerings.getdown.util.StringUtil.couldBeValidUrl; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; + +/** + * Tests {@link StringUtil}. + */ +public class StringUtilTest +{ + @Test public void testCouldBeValidUrl () + { + assertTrue(couldBeValidUrl("http://www.foo.com/")); + assertTrue(couldBeValidUrl("http://www.foo.com/A-B-C/1_2_3/~bar/q.jsp?x=u+i&y=2;3;4#baz%20baz")); + assertTrue(couldBeValidUrl("https://user:secret@www.foo.com/")); + + assertFalse(couldBeValidUrl("http://www.foo.com & echo hello")); + assertFalse(couldBeValidUrl("http://www.foo.com\"")); + } +}