OsMemoryUtil { long getOsTotalFreeMemorySize() { return getAggregatedFreeMemorySize(MEM_KEYS); }    }
@Test public void canReadMemInfoFileIfExists() { final long size = this.util.getOsTotalFreeMemorySize(); final Path memFile = Paths.get("/proc/meminfo"); if (!(Files.isRegularFile(memFile) && Files.isReadable(memFile))) { assertTrue(size == 0); } }
@Test public void getOsTotalFreeMemorySize() { final List<String> lines = Arrays.asList("MemFree: 1 kB", "Buffers: 2 kB", "Cached: 3 kB", "SwapFree: 4 kB", "Foo: 10 kB"); final long size = this.util.getOsTotalFreeMemorySizeFromStrings(lines, OsMemoryUtil.MEM_KEYS); assertEquals(10, size); }