add method and test

This commit is contained in:
Looly 2020-05-12 00:37:42 +08:00
parent fa936f4742
commit 0a9b9a6fce
4 changed files with 42 additions and 0 deletions

View File

@ -8,6 +8,7 @@
### 新特性
* 【core 】 增加CollUtil.map方法
* 【extra 】 增加Sftp.lsEntries方法Ftp和Sftp增加recursiveDownloadFolderpr#121@Gitee
* 【system 】 OshiUtil增加getNetworkIFs方法
### Bug修复
-------------------------------------------------------------------------------------------------------------

View File

@ -346,6 +346,9 @@ public class StrUtilTest {
String str1 = "TableTestOfDay";
String result1 = StrUtil.toCamelCase(str1);
Assert.assertEquals("TableTestOfDay", result1);
String abc1d = StrUtil.toCamelCase("abc_1d");
Assert.assertEquals("abc1d", abc1d);
}
@Test

View File

@ -0,0 +1,26 @@
package cn.hutool.json;
import cn.hutool.core.annotation.Alias;
import lombok.Data;
import org.junit.Assert;
import org.junit.Test;
public class Issue867Test {
@Test
public void toBeanTest(){
String json = "{\"abc_1d\":\"123\",\"abc_d\":\"456\",\"abc_de\":\"789\"}";
Test02 bean = JSONUtil.toBean(JSONUtil.parseObj(json),Test02.class);
Assert.assertEquals("123", bean.getAbc1d());
Assert.assertEquals("456", bean.getAbcD());
Assert.assertEquals("789", bean.getAbcDe());
}
@Data
static class Test02 {
@Alias("abc_1d")
private String abc1d;
private String abcD;
private String abcDe;
}
}

View File

@ -6,6 +6,7 @@ import oshi.hardware.ComputerSystem;
import oshi.hardware.GlobalMemory;
import oshi.hardware.HWDiskStore;
import oshi.hardware.HardwareAbstractionLayer;
import oshi.hardware.NetworkIF;
import oshi.hardware.Sensors;
import oshi.software.os.OperatingSystem;
@ -98,4 +99,15 @@ public class OshiUtil {
public static HWDiskStore[] getDiskStores() {
return hardware.getDiskStores();
}
/**
* 获取网络相关信息可能多块网卡
* @return 网络相关信息
* @since 5.3.5
*/
public static NetworkIF[] getNetworkIFs(){
return hardware.getNetworkIFs();
}
}