@Test
public void notGrantedIfFreeMemoryAvailableLessThanMinimal() throws Exception {

  final OsMemoryUtil memUtil = mock(OsMemoryUtil.class);
  final long availableFreeMem = 4L * 1024L * 1024L; //4 GB
  when(memUtil.getOsTotalFreeMemorySize()).thenReturn(availableFreeMem);
  final SystemMemoryInfo memInfo = new SystemMemoryInfo(memUtil);
  final long xmx = 2 * GB_UNIT; //2 GB
  final boolean isGranted = memInfo.canSystemGrantMemory(xmx);
  assertFalse(isGranted);
}