### Question:
FileUtils { @NotNull public static File getDatafolderFile(@NotNull Plugin plugin, @NotNull String... children) { try { return Paths.get(plugin.getDataFolder().getAbsolutePath(), children).toFile(); } catch (NullPointerException e) { throw new IllegalArgumentException( "One of the children given is null. children: " + joinPath(File.separatorChar, false, children)); } }  static boolean createParentFolders(@NotNull File file); @NotNull static File createDatafolderFile(@NotNull Plugin plugin, @NotNull String... children); static void createFileSafely(@NotNull File file); static boolean createFolder(@NotNull Plugin plugin, @NotNull String... children); static boolean createFolderSafely(@NotNull File folder); static boolean writeFromInternal(Plugin plugin, String[] externalPath, String... internalPath); static boolean writeFromInternal(Plugin plugin, String[] externalPath, Class<?> resourceClass,
                                            String... internalPath); static boolean writeFromInternal(Plugin plugin, Class<?> resourceClass, String... path); static boolean writeFromInternal(Plugin plugin, String... path); static boolean writeFromInternal(File outFile, String... internalPath); static boolean writeFromInternal(File outFile, Class<?> resourceClass, String... internalPath); static boolean write(@NotNull String string, @NotNull Plugin plugin, @NotNull String... path); static boolean write(@NotNull String string, @NotNull File file); static boolean save(@NotNull InputStream in, @NotNull Plugin plugin, @NotNull String... path); static boolean save(@NotNull InputStream in, @NotNull File file); static String[] splitAtSlash(String path); @NotNull static String joinPath(String... path); @NotNull static String joinPath(boolean abs, String... path); @NotNull static String joinPath(char delimiter, boolean abs, String... path); static void extractInternalFolder(@NotNull Plugin plugin, @NotNull File file, @NotNull String... folderPath); @NotNull static File getDatafolderFile(@NotNull Plugin plugin, @NotNull String... children); @Nullable static String read(@NotNull Plugin plugin, @NotNull String... path); @Nullable static String read(@NotNull File file); @Nullable static List<File> getFiles(@NotNull Plugin plugin, @NotNull String... subPath); @Nullable static List<File> getFiles(@NotNull File folder); @Nullable static List<String> getFileNames(@NotNull Plugin plugin, @NotNull String... subPath); @NotNull static List<String> getFileNames(@NotNull List<File> files); @NotNull static List<File> getRecursiveFiles(boolean excludeHyphenPrefix, @NotNull Plugin plugin,
                                               @NotNull String... children); @NotNull static List<File> getRecursiveFiles(boolean excludeHyphenPrefix, @NotNull File file); @Nullable static InputStream getInternalFileStream(@NotNull String... absPath); @Nullable static InputStream getInternalFileStream(@NotNull Class<?> resourceClass, @NotNull String... absPath); @Nullable static String readInternalFile(@NotNull String... absPath); @Nullable static String readInternalFile(@NotNull Class<?> resourceClass, @NotNull String... absPath); static Logger logger; }### Answer:
@Test public void getDatafolderFileDoesNotCreateAnything() { File file = FileUtils.getDatafolderFile(plugin, "notafile.txt"); assertFalse(file.exists()); }
@Test(expected = IllegalArgumentException.class) public void getDatafolderFileWithNullElementReturnsNull() { FileUtils.getDatafolderFile(plugin, null, "notafile.txt"); }
@Test(expected = IllegalArgumentException.class) public void getDatafolderFileWithNullElementReturnsNull2() { FileUtils.getDatafolderFile(plugin, "folder", null); }