private void assertOffHeapMetrics(final int freeMemory, final int allocatedMemory,
      final int objects, final int fragmentation) {
    ManagementService service = ManagementService.getExistingManagementService(getCache());
    assertThat(service).isNotNull();

    assertThat(service.isManager()).isTrue();

    MemberMXBean memberBean = service.getMemberMXBean();
    assertThat(memberBean).isNotNull();

    assertThat(memberBean.getOffHeapFreeMemory()).isEqualTo(freeMemory);
    assertThat(memberBean.getOffHeapUsedMemory()).isEqualTo(allocatedMemory);
    assertThat(memberBean.getOffHeapObjects()).isEqualTo(objects);
    assertThat(memberBean.getOffHeapFragmentation()).isEqualTo(fragmentation);
  }
Asserts that OffHeapMetrics match input parameters.

@param freeMemory total off-heap free memory in bytes.
@param allocatedMemory allocated (or used) off-heap memory in bytes.
@param objects number of objects stored in off-heap memory.
@param fragmentation the fragmentation percentage.
geode-core/src/distributedTest/java/org/apache/geode/management/OffHeapManagementDUnitTest.java