mirror of
https://gitee.com/chinabugotech/hutool.git
synced 2025-08-18 20:38:02 +08:00
add methods
This commit is contained in:
@@ -78,4 +78,25 @@ public class StrJoinerTest {
|
||||
.append("3");
|
||||
Assert.assertEquals("[1],[2],[3]", append.toString());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void lengthTest(){
|
||||
StrJoiner joiner = StrJoiner.of(",", "[", "]");
|
||||
Assert.assertEquals(joiner.toString().length(), joiner.length());
|
||||
|
||||
joiner.append("123");
|
||||
Assert.assertEquals(joiner.toString().length(), joiner.length());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void mergeTest(){
|
||||
StrJoiner joiner1 = StrJoiner.of(",", "[", "]");
|
||||
joiner1.append("123");
|
||||
StrJoiner joiner2 = StrJoiner.of(",", "[", "]");
|
||||
joiner1.append("456");
|
||||
joiner1.append("789");
|
||||
|
||||
final StrJoiner merge = joiner1.merge(joiner2);
|
||||
Assert.assertEquals("[123,456,789]", merge.toString());
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user