FileTasks { public static String getFilenameWithoutExtension(Path file) { assertFile(file); String filename = file.getFileName().toString(); return getFilenameWithoutExtension(filename); }  static void createFile(Path file, String content); static void deleteDirectory(Path directory); static void mkdirs(Path dir); static void assertDirectory(Path dir); static void assertExecutableFile(Path p); static void assertFile(Path p); static void assertFileExtension(Path path, String extension); static List<String> readAllLines(Path path); static void deleteLine(Path path, int lineNumber); static void replaceLine(Path path, String oldContent, String newLineContent); static void deleteFile(Path file); static void copyFileIntoFolder(Path file, Path targetFolder); static void copyFileIntoFolderAndOverwrite(Path file, Path targetFolder); static void copyFileIntoFolderAndOverwrite(URL url, String filename, Path targetFolder); static void copyFileContentsToNewFile(Path source, Path target); static boolean hasFile(Path file); static boolean hasFolder(Path folder); static boolean hasNoFile(Path file); static boolean hasFileSpecificSubstring(Path path, String substring); static void move(Path from, Path to); static void moveFolderWithForcedCleanup(Path from, Path to); static Path findFirstMatchInFolder(Path folder, String glob); static List<Path> findAllInFolder(Path folder); static List<Path> findAllInFolder(Path folder, String glob); static void copyFilesInFolderIntoOtherFolder(Path from, Path to); static void replaceTokensInFile(Path targetFile, Map<String, ?> replacements); static void replaceTokensInFolder(Path targetFile, String token, Object replacement); static void replaceTokensInFolder(Path targetFile, Map<String, ?> replacements); static void replaceTokenInFile(Path targetFile, String token, String value); static String getFilenameWithoutExtension(Path file); static String getFilenameWithoutExtension(String filename); static String getFileExtension(Path filename); static void copyMatchingFilesIntoFolder(Path from, Path to, String globPattern); static void replaceLogFileContent(List<String> listToReplace, String replacement, Path logPath);  }
@Test public void testGetFilenameWithoutExtension() { assertEquals("", FileTasks.getFilenameWithoutExtension(Paths.get(".gitignore"))); assertEquals("build", FileTasks.getFilenameWithoutExtension(Paths.get("build.gradle"))); }