Browse Source

Fix memory comparison in ProcessInfoTests

Closes gh-43926
pull/44020/head
Andy Wilkinson 11 months ago
parent
commit
ef82719ca8
  1. 6
      spring-boot-project/spring-boot/src/test/java/org/springframework/boot/info/ProcessInfoTests.java

6
spring-boot-project/spring-boot/src/test/java/org/springframework/boot/info/ProcessInfoTests.java

@ -1,5 +1,5 @@ @@ -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 { @@ -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);
}

Loading…
Cancel
Save