Skip to content

Commit

Permalink
Fix memory comparison in ProcessInfoTests
Browse files Browse the repository at this point in the history
Closes gh-43926
  • Loading branch information
wilkinsona committed Jan 22, 2025
1 parent 1e35a0b commit ef82719
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -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.
Expand Down Expand Up @@ -43,13 +43,13 @@ void processInfoIsAvailable() {
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);
}
Expand Down

0 comments on commit ef82719

Please sign in to comment.