public void setTestMaxMemoryBytes(final long testMaxMemoryBytes) {
    synchronized (this) {
      MemoryThresholds newThresholds;

      if (testMaxMemoryBytes == 0) {
        newThresholds = new MemoryThresholds(getTenuredPoolMaxMemory());
      } else {
        newThresholds = new MemoryThresholds(testMaxMemoryBytes,
            thresholds.getCriticalThreshold(), thresholds.getEvictionThreshold());
      }

      thresholds = newThresholds;
      final String builder =
          "In testing, the following values were set" + " maxMemoryBytes:"
              + newThresholds.getMaxMemoryBytes()
              + " criticalThresholdBytes:" + newThresholds.getCriticalThresholdBytes()
              + " evictionThresholdBytes:" + newThresholds.getEvictionThresholdBytes();
      logger.debug(builder);
    }
  }
Overrides the value returned by the JVM as the number of bytes of available memory.

@param testMaxMemoryBytes The value to use as the maximum number of bytes of memory available.
geode-core/src/main/java/org/apache/geode/internal/cache/control/HeapMemoryMonitor.java