mirror of
https://gitee.com/chinabugotech/hutool.git
synced 2025-05-09 23:51:34 +08:00
add test
This commit is contained in:
parent
18dd6da22b
commit
aa403cbe98
@ -575,11 +575,11 @@ public class RandomUtil {
|
|||||||
if (StrUtil.isEmpty(baseString)) {
|
if (StrUtil.isEmpty(baseString)) {
|
||||||
return StrUtil.EMPTY;
|
return StrUtil.EMPTY;
|
||||||
}
|
}
|
||||||
final StringBuilder sb = new StringBuilder(length);
|
if(length < 1){
|
||||||
|
|
||||||
if (length < 1) {
|
|
||||||
length = 1;
|
length = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
final StringBuilder sb = new StringBuilder(length);
|
||||||
final int baseLength = baseString.length();
|
final int baseLength = baseString.length();
|
||||||
for (int i = 0; i < length; i++) {
|
for (int i = 0; i < length; i++) {
|
||||||
final int number = randomInt(baseLength);
|
final int number = randomInt(baseLength);
|
||||||
|
@ -75,6 +75,12 @@ public class RandomUtilTest {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void randomStringOfLengthTest(){
|
||||||
|
final String s = RandomUtil.randomString("123", -1);
|
||||||
|
Assert.assertNotNull(s);
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void generateRandomNumberTest(){
|
public void generateRandomNumberTest(){
|
||||||
final int[] ints = RandomUtil.randomPickInts(5, NumberUtil.range(5, 20));
|
final int[] ints = RandomUtil.randomPickInts(5, NumberUtil.range(5, 20));
|
||||||
|
@ -195,4 +195,10 @@ public class CRUDTest {
|
|||||||
MapUtil.of("ids", new int[]{1, 2, 3}));
|
MapUtil.of("ids", new int[]{1, 2, 3}));
|
||||||
Assert.assertEquals(2, results.size());
|
Assert.assertEquals(2, results.size());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@Ignore
|
||||||
|
public void findWithDotTest(){
|
||||||
|
db.find(Entity.of("user").set("WTUR.Other.Rg.S.WTName", "value"));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
17
hutool-json/src/test/java/cn/hutool/json/Issue2507Test.java
Executable file
17
hutool-json/src/test/java/cn/hutool/json/Issue2507Test.java
Executable file
@ -0,0 +1,17 @@
|
|||||||
|
package cn.hutool.json;
|
||||||
|
|
||||||
|
import cn.hutool.core.lang.Console;
|
||||||
|
import org.junit.Ignore;
|
||||||
|
import org.junit.Test;
|
||||||
|
|
||||||
|
public class Issue2507Test {
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@Ignore
|
||||||
|
public void xmlToJsonTest(){
|
||||||
|
String xml = "<MsgInfo> <Msg> <![CDATA[<msg><body><row action=\"select\"><DIET>低盐饮食[嘱托]]><![CDATA[]</DIET></row></body></msg>]]> </Msg> <Msg> <![CDATA[<msg><body><row action=\"select\"><DIET>流质饮食</DIET></row></body></msg>]]> </Msg> </MsgInfo>";
|
||||||
|
JSONObject jsonObject = JSONUtil.xmlToJson(xml);
|
||||||
|
|
||||||
|
Console.log(jsonObject.toStringPretty());
|
||||||
|
}
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user