@Test
  public void doesNotCreateBucketIfOverMemoryLimit() {
    final int numMBytes = 5;
    final PartitionedRegion regionAck = (PartitionedRegion) new RegionFactory()
        .setPartitionAttributes(new PartitionAttributesFactory().setRedundantCopies(0)
            .setLocalMaxMemory(numMBytes).create())
        .create(regionName);

    boolean createdBucket =
        regionAck.getDataStore().handleManageBucketRequest(1, Integer.MAX_VALUE, null, false);
    assertFalse(createdBucket);
  }
This method checks whether the canAccomodateMoreBytesSafely returns false after reaching the
localMax memory.
geode-core/src/integrationTest/java/org/apache/geode/internal/cache/PartitionedRegionDataStoreJUnitTest.java