diff --git a/classlib/src/main/java/org/teavm/classlib/java/lang/TString.java b/classlib/src/main/java/org/teavm/classlib/java/lang/TString.java index cfe1d6d7b..06c465e34 100644 --- a/classlib/src/main/java/org/teavm/classlib/java/lang/TString.java +++ b/classlib/src/main/java/org/teavm/classlib/java/lang/TString.java @@ -146,6 +146,16 @@ public class TString extends TObject implements TSerializable, TComparable srcEnd || srcEnd > length() || dstBegin < 0 diff --git a/tests/src/test/java/org/teavm/classlib/java/lang/StringTest.java b/tests/src/test/java/org/teavm/classlib/java/lang/StringTest.java index 30ab6049a..8a12ea7a2 100644 --- a/tests/src/test/java/org/teavm/classlib/java/lang/StringTest.java +++ b/tests/src/test/java/org/teavm/classlib/java/lang/StringTest.java @@ -17,6 +17,7 @@ package org.teavm.classlib.java.lang; import static org.junit.Assert.assertArrayEquals; import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertNotEquals; import static org.junit.Assert.assertSame; import static org.junit.Assert.assertTrue; @@ -311,4 +312,12 @@ public class StringTest { assertEquals(0, str.length()); assertEquals("", str); } + + @Test + public void testIsBlank() { + assertTrue(new String(new char[0]).isBlank()); + assertTrue(new String(new char[] { ' ', ' ' }).isBlank()); + assertFalse(new String(new char[] { ' ', 'x', ' ' }).isBlank()); + assertFalse(new String(new char[] { 'a', ' ' }).isBlank()); + } }