mirror of
https://gitee.com/chinabugotech/hutool.git
synced 2025-07-21 15:09:48 +08:00
fix #I2AQ2M
This commit is contained in:
@@ -298,7 +298,7 @@ public class RuntimeUtil {
|
||||
*
|
||||
* @return 最大可用内存
|
||||
*/
|
||||
public final long getUsableMemory() {
|
||||
public static long getUsableMemory() {
|
||||
return getMaxMemory() - getTotalMemory() + getFreeMemory();
|
||||
}
|
||||
}
|
||||
|
@@ -1,11 +1,10 @@
|
||||
package cn.hutool.core.util;
|
||||
|
||||
import cn.hutool.core.lang.Console;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Ignore;
|
||||
import org.junit.Test;
|
||||
|
||||
import cn.hutool.core.lang.Console;
|
||||
import cn.hutool.core.util.RuntimeUtil;
|
||||
|
||||
/**
|
||||
* 命令行单元测试
|
||||
* @author looly
|
||||
@@ -26,4 +25,9 @@ public class RuntimeUtilTest {
|
||||
String str = RuntimeUtil.execForStr("cmd /c dir");
|
||||
Console.log(str);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void getUsableMemoryTest(){
|
||||
Assert.assertTrue(RuntimeUtil.getUsableMemory() > 0);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user