Fix memory comparison in ProcessInfoTests

Closes gh-43926
This commit is contained in:
Andy Wilkinson 2025-01-22 11:57:32 +00:00
parent 1e35a0b82d
commit ef82719ca8
1 changed files with 3 additions and 3 deletions

View File

@ -1,5 +1,5 @@
/*
* Copyright 2012-2024 the original author or authors.
* Copyright 2012-2025 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -43,13 +43,13 @@ class ProcessInfoTests {
void memoryInfoIsAvailable() {
ProcessInfo processInfo = new ProcessInfo();
MemoryUsageInfo heapUsageInfo = processInfo.getMemory().getHeap();
MemoryUsageInfo nonHeapUsageInfo = processInfo.getMemory().getNonHeap();
assertThat(heapUsageInfo.getInit()).isPositive().isLessThanOrEqualTo(heapUsageInfo.getMax());
assertThat(heapUsageInfo.getUsed()).isPositive().isLessThanOrEqualTo(heapUsageInfo.getCommitted());
assertThat(heapUsageInfo.getCommitted()).isPositive().isLessThanOrEqualTo(heapUsageInfo.getMax());
assertThat(heapUsageInfo.getMax()).isPositive();
MemoryUsageInfo nonHeapUsageInfo = processInfo.getMemory().getNonHeap();
assertThat(nonHeapUsageInfo.getInit()).isPositive();
assertThat(nonHeapUsageInfo.getUsed()).isPositive().isLessThanOrEqualTo(heapUsageInfo.getCommitted());
assertThat(nonHeapUsageInfo.getUsed()).isPositive().isLessThanOrEqualTo(nonHeapUsageInfo.getCommitted());
assertThat(nonHeapUsageInfo.getCommitted()).isPositive();
assertThat(nonHeapUsageInfo.getMax()).isEqualTo(-1);
}