JdkTool { protected static String getJdkToolPathname(final String jdkToolExecutableName, final GemFireException throwable) { assertNotNull(jdkToolExecutableName, "The JDK tool executable name cannot be null!"); assertNotNull(throwable, "The GemFireException cannot be null!"); Stack<String> pathnames = new Stack<>(); pathnames.push(jdkToolExecutableName); pathnames .push(IOUtils.appendToPath(System.getenv("JAVA_HOME"), "..", "bin", jdkToolExecutableName)); pathnames.push(IOUtils.appendToPath(System.getenv("JAVA_HOME"), "bin", jdkToolExecutableName)); pathnames.push(IOUtils.appendToPath(JAVA_HOME, "..", "bin", jdkToolExecutableName)); pathnames.push(IOUtils.appendToPath(JAVA_HOME, "bin", jdkToolExecutableName)); return getJdkToolPathname(pathnames, throwable); }  static String getJVisualVMPathname(); static String getJConsolePathname();  }
@Test(expected = NullPointerException.class) public void testGetJdkToolPathnameWithNullPathnames() { try { JdkTool.getJdkToolPathname((Stack<String>) null, new GemFireException() {}); } catch (NullPointerException expected) { assertEquals("The JDK tool executable pathnames cannot be null!", expected.getMessage()); throw expected; } }
@Test(expected = NullPointerException.class) public void testGetJdkToolPathnameWithNullGemFireException() { try { JdkTool.getJdkToolPathname(new Stack<String>(), null); } catch (NullPointerException expected) { assertEquals("The GemFireException cannot be null!", expected.getMessage()); throw expected; } }
@Test public void testGetJdkToolPathnameForNonExistingTool() { try { final GemFireException expected = new GemFireException() { @Override public String getMessage() { return "expected"; } }; JdkTool.getJdkToolPathname("nonExistingTool.exe", expected); } catch (GemFireException expected) { assertEquals("expected", expected.getMessage()); } }