### Question:
AppDataDirectory { public static Path get(String appName) { final Path applicationDataDirectory = getPath(appName); try { Files.createDirectories(applicationDataDirectory); } catch (IOException ioe) { throw new RuntimeException("Couldn't find/create AppDataDirectory", ioe); } return applicationDataDirectory; }  static Path get(String appName); static Path getPath(String appName);  }### Answer:
@Test public void worksOnCurrentPlatform() { final String appName = "bitcoinj"; String path = AppDataDirectory.get(appName).toString(); if (Utils.isWindows()) { assertEquals("Path wrong on Windows", winPath(appName), path); } else if (Utils.isMac()) { assertEquals("Path wrong on Mac", macPath(appName), path); } else if (Utils.isLinux()) { assertEquals("Path wrong on Linux", unixPath(appName), path); } else { assertEquals("Path wrong on unknown/default", unixPath(appName), path); } }
@Test public void worksOnCurrentPlatformForBitcoinCore() { final String appName = "Bitcoin"; String path = AppDataDirectory.get(appName).toString(); if (Utils.isWindows()) { assertEquals("Path wrong on Windows", winPath(appName), path); } else if (Utils.isMac()) { assertEquals("Path wrong on Mac", macPath(appName), path); } else if (Utils.isLinux()) { assertEquals("Path wrong on Linux", unixPath(appName), path); } else { assertEquals("Path wrong on unknown/default", unixPath(appName), path); } }
@Test(expected = RuntimeException.class) public void throwsIOExceptionIfPathNotFound() { if (Utils.isWindows()) { AppDataDirectory.get(":"); } if (Utils.isMac()) { AppDataDirectory.get("\0"); } if (Utils.isLinux()) { AppDataDirectory.get("\0"); } }
@Test public void worksOnCurrentPlatform() { final String appName = "bitcoinj"; String path = AppDataDirectory.get(appName).toString(); if (Utils.isWindows()) { assertEquals("Path wrong on Mac", winPath(appName), path); } else if (Utils.isMac()) { assertEquals("Path wrong on Mac", macPath(appName), path); } else if (Utils.isLinux()) { assertEquals("Path wrong on Linux", unixPath(appName), path); } else { assertEquals("Path wrong on unknown/default", unixPath(appName), path); } }
@Test public void worksOnCurrentPlatformForBitcoinCore() { final String appName = "Bitcoin"; String path = AppDataDirectory.get(appName).toString(); if (Utils.isWindows()) { assertEquals("Path wrong on Mac", winPath(appName), path); } else if (Utils.isMac()) { assertEquals("Path wrong on Mac", macPath(appName), path); } else if (Utils.isLinux()) { assertEquals("Path wrong on Linux", unixPath(appName), path); } else { assertEquals("Path wrong on unknown/default", unixPath(appName), path); } }
@Test(expected = RuntimeException.class) public void throwsIOExceptionIfPathNotFound() { if (Utils.isWindows()) { AppDataDirectory.get("/"); } if (Utils.isMac()) { AppDataDirectory.get("\0"); } if (Utils.isLinux()) { AppDataDirectory.get("\0"); } }