### Question:
FileUtil { public static File createJavaFile(File baseDir, String packageName, String shortClassName) { File packageDir; if (packageName == null) { packageDir = baseDir; } else { packageDir = new File(baseDir, packageName.replace('.', File.separatorChar)); } return new File(packageDir, shortClassName + ".java"); } protected  FileUtil(); static void copy(File src, File dest); static void append(File src, File dest); static String getCanonicalPath(File file); static boolean createNewFile(File file); static File createTempFile(String prefix, String suffix); static File getCanonicalFile(File file); static void traverseDirectory(File dir, FilenameFilter filter,
            Comparator<File> comparator, FileHandler handler); static File createJavaFile(File baseDir, String packageName,
            String shortClassName);  }### Answer:
@Test public void testCreateJavaFile() { File baseDir = new File("base"); File javaFile = new File(baseDir, "aaa"); javaFile = new File(javaFile, "bbb"); javaFile = new File(javaFile, "Ccc.java"); assertEquals(javaFile, FileUtil.createJavaFile(baseDir, "aaa.bbb", "Ccc")); }
@Test public void testCreateJavaFile_defaultPackage() { File baseDir = new File("base"); assertEquals(new File(baseDir, "Ccc.java"), FileUtil.createJavaFile( baseDir, null, "Ccc")); }