FileUtils { public static String getFileExtension( File file ) { return splitFilename( file ).second; }  static String getFilename( File file ); static String getBasename( File file ); static String getFileExtension( File file ); static URL loadDeegreeConfiguration( Class<?> configurationClass, String fileName ); static List<File> findFilesForExtensions( File topDirectory, boolean recurse, String patternList ); static String getSystemCharset();  }
@Test public void testGetFileExtension() { assertEquals( "txt", FileUtils.getFileExtension( new File( "/tmp/foo.txt" ) ) ); assertEquals( "txt", FileUtils.getFileExtension( new File( "/tmp/foo.bar.txt" ) ) ); assertEquals( "", FileUtils.getFileExtension( new File( "/tmp/foo.bar." ) ) ); assertEquals( "", FileUtils.getFileExtension( new File( "/tmp/foo" ) ) ); assertEquals( "", FileUtils.getFileExtension( new File( "/tmp.dir/foo" ) ) ); assertEquals( "", FileUtils.getFileExtension( new File( "" ) ) ); }