FileUtil { public static String getFileNameWithoutSuffix(String fileName) { int lastIndexOf = fileName.lastIndexOf("."); if(lastIndexOf >= 0) { return fileName.substring(0, lastIndexOf); } else { return fileName; } } private  FileUtil(); static File createTempDirectory(); static byte[] readFile(File f); static String getFileNameWithoutSuffix(String fileName);  }
@Test public void testGetFileNameWithoutSuffix() throws Exception { assertEquals("test", FileUtil.getFileNameWithoutSuffix("test.txt")); assertEquals("test", FileUtil.getFileNameWithoutSuffix("test.bpel")); assertEquals("test.txt", FileUtil.getFileNameWithoutSuffix("test.txt.bpel")); assertEquals("test", FileUtil.getFileNameWithoutSuffix("test.txt")); }