@Nonnull private static Path getHeapDumpPath() { final String filename = String.format("heapdump-%s.hprof", Instant.now()); return getHeapDumpDir().resolve(filename); }
@Test public void getHeapDumpDirMesos() { final String testValue = "/bing/bing/bam/bam"; final Function<String, String> old = Memory.getenv; Memory.getenv = name -> { if (name.equals("MESOS_SANDBOX")) { return testValue; } throw new AssertionError("unexpected environment inspection"); }; Assert.assertEquals(Memory.getHeapDumpDir().toString(), testValue); Memory.getenv = old; }