fix split null bug

This commit is contained in:
looly
2022-01-06 07:39:46 +08:00
parent 0ef4be6b0e
commit da0d737cd0
5 changed files with 34 additions and 30 deletions

View File

@@ -60,6 +60,15 @@ public class StrSpliterTest {
String str = "";
final String[] split = str.split(",");
final String[] strings = StrSplitter.splitToArray(str, ",", -1, false, false);
Assert.assertNotNull(strings);
Assert.assertArrayEquals(split, strings);
}
@Test
public void splitNullTest(){
String str = null;
final String[] strings = StrSplitter.splitToArray(str, ",", -1, false, false);
Assert.assertNotNull(strings);
Assert.assertEquals(0, strings.length);
}
}