Add files via upload (#652)

add StringUtilTest JUnit test case
pull/655/head
liutao 2 years ago committed by GitHub
parent e0bde2605f
commit 4c7631999d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -17,5 +17,78 @@
package cn.hippo4j.common.toolkit;
import org.junit.Test;
import java.util.Objects;
public class StringUtilTest {
@Test
public void assertIsEmpty() {
String string = "";
Assert.isTrue(StringUtil.isEmpty(string));
}
@Test
public void assertIsNotEmpty() {
String string = "string";
Assert.isTrue(StringUtil.isNotEmpty(string));
}
@Test
public void emptyToNull() {
String string = "";
Assert.isNull(StringUtil.emptyToNull(string));
}
@Test
public void nullToEmpty() {
String string = "null";
Assert.notEmpty(StringUtil.nullToEmpty(string));
}
@Test
public void isNullOrEmpty() {
String string = "null";
Assert.isTrue(!StringUtil.isNullOrEmpty(string));
}
@Test
public void isBlank() {
String string = "";
Assert.isTrue(StringUtil.isBlank(string));
}
@Test
public void isNotBlank() {
String string = "null";
Assert.isTrue(StringUtil.isNotBlank(string));
}
@Test
public void isAllNotEmpty() {
String strings = "str";
Assert.isTrue(StringUtil.isAllNotEmpty(strings));
}
@Test
public void hasEmpty() {
String strings = "";
Assert.isTrue(StringUtil.hasEmpty(strings));
}
@Test
public void toUnderlineCase() {
String string = "str";
String s = StringUtil.toUnderlineCase(string);
Assert.isTrue(Objects.equals(s,"str"));
}
@Test
public void toSymbolCase() {
String string = "str";
String s = StringUtil.toSymbolCase(string,StringUtil.UNDERLINE);
Assert.isTrue(Objects.equals(s,"str"));
}
}

Loading…
Cancel
Save