mirror of
https://gitee.com/chinabugotech/hutool.git
synced 2025-07-21 15:09:48 +08:00
fix NumberUtil
This commit is contained in:
@@ -1,10 +1,12 @@
|
||||
package cn.hutool.core.util;
|
||||
|
||||
import cn.hutool.core.convert.Convert;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Test;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.math.RoundingMode;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* {@link NumberUtil} 单元测试类
|
||||
@@ -269,4 +271,12 @@ public class NumberUtilTest {
|
||||
Assert.assertTrue(NumberUtil.isPowerOfTwo(1));
|
||||
Assert.assertFalse(NumberUtil.isPowerOfTwo(17));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void generateRandomNumberTest(){
|
||||
final int[] ints = NumberUtil.generateRandomNumber(10, 20, 5);
|
||||
Assert.assertEquals(5, ints.length);
|
||||
final Set<?> set = Convert.convert(Set.class, ints);
|
||||
Assert.assertEquals(5, set.size());
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user