public String removeFileExtension(String filename) {

        if (filename == null || filename.isEmpty()) {
            return filename;
        }

        String extPattern = "(?<!^)[.]" + "[^.]*$";

        return filename.replaceAll(extPattern, "");
    }
@Test
    public void testRemoveFileExtension() {

        String result = fileUtil.removeFileExtension(FOOBAR_HTML);
        assertEquals(FOOBAR, result);

        result = fileUtil.removeFileExtension(null);
        assertNull(result);

        result = fileUtil.removeFileExtension("");
        assertEquals(0, result.length());
    }