mirror of
https://gitee.com/chinabugotech/hutool.git
synced 2025-07-21 15:09:48 +08:00
add methods
This commit is contained in:
@@ -1,11 +1,10 @@
|
||||
package cn.hutool.core.convert;
|
||||
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import cn.hutool.core.util.CharsetUtil;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Test;
|
||||
|
||||
import cn.hutool.core.util.CharsetUtil;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
/**
|
||||
* 其它转换
|
||||
@@ -58,21 +57,6 @@ public class ConvertOtherTest {
|
||||
Assert.assertEquals(75, minutes);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void digitToChineseTest() {
|
||||
double a = 67556.32;
|
||||
String digitUppercase = Convert.digitToChinese(a);
|
||||
Assert.assertEquals("陆万柒仟伍佰伍拾陆元叁角贰分", digitUppercase);
|
||||
|
||||
a = 1024.00;
|
||||
digitUppercase = Convert.digitToChinese(a);
|
||||
Assert.assertEquals("壹仟零贰拾肆元整", digitUppercase);
|
||||
|
||||
a = 1024;
|
||||
digitUppercase = Convert.digitToChinese(a);
|
||||
Assert.assertEquals("壹仟零贰拾肆元整", digitUppercase);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void wrapUnwrapTest() {
|
||||
// 去包装
|
||||
|
@@ -83,6 +83,31 @@ public class NumberChineseFormatterTest {
|
||||
Assert.assertEquals("贰仟肆佰贰拾壹元零贰分", digitToChinese3);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void digitToChineseTest2() {
|
||||
double a = 67556.32;
|
||||
String digitUppercase = Convert.digitToChinese(a);
|
||||
Assert.assertEquals("陆万柒仟伍佰伍拾陆元叁角贰分", digitUppercase);
|
||||
|
||||
a = 1024.00;
|
||||
digitUppercase = Convert.digitToChinese(a);
|
||||
Assert.assertEquals("壹仟零贰拾肆元整", digitUppercase);
|
||||
|
||||
a = 1024;
|
||||
digitUppercase = Convert.digitToChinese(a);
|
||||
Assert.assertEquals("壹仟零贰拾肆元整", digitUppercase);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void digitToChineseTest3() {
|
||||
String digitToChinese = Convert.digitToChinese(2_0000_0000.00);
|
||||
Assert.assertEquals("贰亿元整", digitToChinese);
|
||||
digitToChinese = Convert.digitToChinese(2_0000.00);
|
||||
Assert.assertEquals("贰万元整", digitToChinese);
|
||||
digitToChinese = Convert.digitToChinese(2_0000_0000_0000.00);
|
||||
Assert.assertEquals("贰万亿元整", digitToChinese);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void numberCharToChineseTest(){
|
||||
String s = NumberChineseFormatter.numberCharToChinese('1', false);
|
||||
|
@@ -44,6 +44,18 @@ public class PathUtilTest {
|
||||
PathUtil.move(Paths.get("d:/lombok.jar"), Paths.get("d:/test/"), false);
|
||||
}
|
||||
|
||||
@Test
|
||||
@Ignore
|
||||
public void moveDirTest(){
|
||||
PathUtil.move(Paths.get("c:\\aaa"), Paths.get("d:/test/looly"), false);
|
||||
}
|
||||
|
||||
@Test
|
||||
@Ignore
|
||||
public void delDirTest(){
|
||||
PathUtil.del(Paths.get("d:/test/looly"));
|
||||
}
|
||||
|
||||
@Test
|
||||
@Ignore
|
||||
public void getMimeTypeTest(){
|
||||
|
@@ -1,5 +1,6 @@
|
||||
package cn.hutool.core.net;
|
||||
|
||||
import cn.hutool.core.lang.Console;
|
||||
import cn.hutool.core.lang.PatternPool;
|
||||
import cn.hutool.core.util.ReUtil;
|
||||
import org.junit.Assert;
|
||||
@@ -13,7 +14,7 @@ import java.util.List;
|
||||
|
||||
/**
|
||||
* NetUtil单元测试
|
||||
*
|
||||
*
|
||||
* @author Looly
|
||||
*
|
||||
*/
|
||||
@@ -93,4 +94,11 @@ public class NetUtilTest {
|
||||
Assert.assertTrue(NetUtil.isOpen(address, 200));
|
||||
}
|
||||
|
||||
@Test
|
||||
@Ignore
|
||||
public void getDnsInfoTest(){
|
||||
final List<String> txt = NetUtil.getDnsInfo("hutool.cn", "TXT");
|
||||
Console.log(txt);
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -5,6 +5,7 @@ import cn.hutool.core.lang.Console;
|
||||
import org.junit.Ignore;
|
||||
import org.junit.Test;
|
||||
|
||||
import javax.naming.NamingException;
|
||||
import javax.naming.directory.Attribute;
|
||||
import javax.naming.directory.Attributes;
|
||||
|
||||
@@ -12,10 +13,10 @@ public class JNDIUtilTest {
|
||||
|
||||
@Test
|
||||
@Ignore
|
||||
public void getDnsTest(){
|
||||
final Attributes attributes = JNDIUtil.getAttributes("dns:hutool.cn", "TXT");
|
||||
public void getDnsTest() throws NamingException {
|
||||
final Attributes attributes = JNDIUtil.getAttributes("dns:paypal.com", "TXT");
|
||||
for (Attribute attribute: new EnumerationIter<>(attributes.getAll())){
|
||||
Console.log(attribute);
|
||||
Console.log(attribute.get());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user