add slash for path

This commit is contained in:
Looly
2021-04-23 10:59:44 +08:00
parent 588933a733
commit 63b93e02f9
7 changed files with 166 additions and 104 deletions

View File

@@ -0,0 +1,27 @@
package cn.hutool.core.text;
import org.junit.Assert;
import org.junit.Test;
public class CharSequenceUtilTest {
@Test
public void addPrefixIfNotTest(){
String str = "hutool";
String result = CharSequenceUtil.addPrefixIfNot(str, "hu");
Assert.assertEquals(str, result);
result = CharSequenceUtil.addPrefixIfNot(str, "Good");
Assert.assertEquals("Good" + str, result);
}
@Test
public void addSuffixIfNotTest(){
String str = "hutool";
String result = CharSequenceUtil.addSuffixIfNot(str, "tool");
Assert.assertEquals(str, result);
result = CharSequenceUtil.addSuffixIfNot(str, " is Good");
Assert.assertEquals( str + " is Good", result);
}
}