summaryrefslogtreecommitdiffstats
path: root/src/test/java/com/gitblit/tests/StringUtilsTest.java
diff options
context:
space:
mode:
authorFlorian Zschocke <f.zschocke+git@gmail.com>2020-04-05 13:07:25 +0200
committerFlorian Zschocke <f.zschocke+git@gmail.com>2020-04-05 13:07:25 +0200
commita93cd37bc60b4f311692e0e9c6b0ddf320eb5c29 (patch)
treef48a9a963233f1f23d4e77e9ba9e908ea5bb6472 /src/test/java/com/gitblit/tests/StringUtilsTest.java
parent08666d065be34a227a9b5bb16810280d8ee39178 (diff)
parent34e77ddf09e58ea0a817d31ed74a6bce574bff97 (diff)
downloadgitblit-r1.9.1.tar.gz
gitblit-r1.9.1.zip
Merge branch 'master' into releaser1.9.1
Diffstat (limited to 'src/test/java/com/gitblit/tests/StringUtilsTest.java')
-rw-r--r--src/test/java/com/gitblit/tests/StringUtilsTest.java15
1 files changed, 14 insertions, 1 deletions
diff --git a/src/test/java/com/gitblit/tests/StringUtilsTest.java b/src/test/java/com/gitblit/tests/StringUtilsTest.java
index 7176b88c..3dae66f4 100644
--- a/src/test/java/com/gitblit/tests/StringUtilsTest.java
+++ b/src/test/java/com/gitblit/tests/StringUtilsTest.java
@@ -26,13 +26,26 @@ public class StringUtilsTest extends GitblitUnitTest {
@Test
public void testIsEmpty() throws Exception {
- assertTrue(StringUtils.isEmpty(null));
+ assertTrue(StringUtils.isEmpty((String)null));
assertTrue(StringUtils.isEmpty(""));
assertTrue(StringUtils.isEmpty(" "));
assertFalse(StringUtils.isEmpty("A"));
}
@Test
+ public void testIsEmptyCharArray() throws Exception {
+ assertTrue(StringUtils.isEmpty((char[])null));
+ assertTrue(StringUtils.isEmpty(new char[0]));
+ assertTrue(StringUtils.isEmpty(new char[]{ ' ' }));
+ assertTrue(StringUtils.isEmpty(new char[]{ ' '}));
+ assertTrue(StringUtils.isEmpty(new char[]{ ' ', ' ' }));
+ assertTrue(StringUtils.isEmpty(new char[]{ ' ', ' ', ' ' }));
+ assertFalse(StringUtils.isEmpty(new char[]{ '\u0020', 'f' }));
+ assertFalse(StringUtils.isEmpty(new char[]{ '\u0148', '\u0020' }));
+ assertFalse(StringUtils.isEmpty(new char[]{ 'A' }));
+ }
+
+ @Test
public void testBreakLinesForHtml() throws Exception {
String input = "this\nis\r\na\rtest\r\n\r\nof\n\nline\r\rbreaking";
String output = "this<br/>is<br/>a<br/>test<br/><br/>of<br/><br/>line<br/><br/>breaking";