mirror of
https://gitee.com/chinabugotech/hutool.git
synced 2025-07-21 15:09:48 +08:00
单元测试由Junit4变更为Junit5
This commit is contained in:
@@ -2,14 +2,14 @@ package cn.hutool.system;
|
||||
|
||||
import cn.hutool.core.lang.Console;
|
||||
import cn.hutool.system.oshi.OshiUtil;
|
||||
import org.junit.Ignore;
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.Disabled;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
@Ignore
|
||||
@Disabled
|
||||
public class OshiPrintTest {
|
||||
|
||||
@Test
|
||||
@Ignore
|
||||
@Disabled
|
||||
public void printCpuInfo(){
|
||||
Console.log(OshiUtil.getCpuInfo());
|
||||
}
|
||||
|
@@ -3,9 +3,9 @@ package cn.hutool.system;
|
||||
import cn.hutool.core.lang.Console;
|
||||
import cn.hutool.system.oshi.CpuInfo;
|
||||
import cn.hutool.system.oshi.OshiUtil;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Ignore;
|
||||
import org.junit.Test;
|
||||
import static org.junit.jupiter.api.Assertions.*;
|
||||
import org.junit.jupiter.api.Disabled;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import oshi.software.os.OSProcess;
|
||||
|
||||
/**
|
||||
@@ -16,23 +16,23 @@ public class OshiTest {
|
||||
@Test
|
||||
public void getMemoryTest() {
|
||||
long total = OshiUtil.getMemory().getTotal();
|
||||
Assert.assertTrue(total > 0);
|
||||
assertTrue(total > 0);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void getCupInfo() {
|
||||
CpuInfo cpuInfo = OshiUtil.getCpuInfo();
|
||||
Assert.assertNotNull(cpuInfo);
|
||||
assertNotNull(cpuInfo);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void getCurrentProcessTest() {
|
||||
final OSProcess currentProcess = OshiUtil.getCurrentProcess();
|
||||
Assert.assertEquals("java", currentProcess.getName());
|
||||
assertEquals("java", currentProcess.getName());
|
||||
}
|
||||
|
||||
@Test
|
||||
@Ignore
|
||||
@Disabled
|
||||
public void getUsedTest(){
|
||||
while (true){
|
||||
Console.log(OshiUtil.getCpuInfo().getUsed());
|
||||
|
@@ -1,16 +1,16 @@
|
||||
package cn.hutool.system;
|
||||
|
||||
import cn.hutool.core.lang.Console;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Ignore;
|
||||
import org.junit.Test;
|
||||
import static org.junit.jupiter.api.Assertions.*;
|
||||
import org.junit.jupiter.api.Disabled;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
public class SystemUtilTest {
|
||||
|
||||
@Test
|
||||
@Ignore
|
||||
@Disabled
|
||||
public void dumpTest() {
|
||||
SystemUtil.dumpSystemInfo();
|
||||
}
|
||||
@@ -18,25 +18,25 @@ public class SystemUtilTest {
|
||||
@Test
|
||||
public void getCurrentPidTest() {
|
||||
final long pid = SystemUtil.getCurrentPID();
|
||||
Assert.assertTrue(pid > 0);
|
||||
assertTrue(pid > 0);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void getJavaInfoTest() {
|
||||
final JavaInfo javaInfo = SystemUtil.getJavaInfo();
|
||||
Assert.assertNotNull(javaInfo);
|
||||
assertNotNull(javaInfo);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void getJavaRuntimeInfoTest() {
|
||||
final JavaRuntimeInfo info = SystemUtil.getJavaRuntimeInfo();
|
||||
Assert.assertNotNull(info);
|
||||
assertNotNull(info);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void getOsInfoTest() {
|
||||
final OsInfo osInfo = SystemUtil.getOsInfo();
|
||||
Assert.assertNotNull(osInfo);
|
||||
assertNotNull(osInfo);
|
||||
|
||||
Console.log(osInfo.getName());
|
||||
}
|
||||
@@ -44,13 +44,13 @@ public class SystemUtilTest {
|
||||
@Test
|
||||
public void getHostInfo() {
|
||||
final HostInfo hostInfo = SystemUtil.getHostInfo();
|
||||
Assert.assertNotNull(hostInfo);
|
||||
assertNotNull(hostInfo);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void getUserInfoTest(){
|
||||
// https://gitee.com/dromara/hutool/issues/I3NM39
|
||||
final UserInfo userInfo = SystemUtil.getUserInfo();
|
||||
Assert.assertTrue(userInfo.getTempDir().endsWith(File.separator));
|
||||
assertTrue(userInfo.getTempDir().endsWith(File.separator));
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user