### Question:
StructuredDirectory { public static int decodeFileName(File inputFile) throws IOException { try { int ret = parseInt(removeExtension(inputFile.getName())); ret += 1000 * parseInt(inputFile.getParentFile().getName()); ret += 1000000 * parseInt(inputFile.getParentFile().getParentFile() .getName()); return ret; } catch (Throwable t) { throw new IOException("could not decode filename, make sure" + " it looks like somepath/12/345/678.txt", t); } }  static int[] getSplit(int docId); static File storeFile(File outDir, File inputFile); static int decodeFileName(File inputFile); static int decodeFileName(String inputFile); static String getFilePath(int docId, String extention);  }### Answer:
@Test public void testDecodeFileName() throws Exception { File outDir = new File("target/testStoreFile2"); File inputFile = new File("target/12345678.txt"); inputFile.createNewFile(); File newFile = StructuredDirectory.storeFile(outDir, inputFile); assertEquals("cannot decodeFileName", 12345678, StructuredDirectory.decodeFileName(newFile)); assertEquals("cannot getFile", newFile, new File(outDir, StructuredDirectory.getFilePath(12345678, "txt"))); }
@Test public void testDecodeFileName2() throws Exception { assertEquals("", 12345678, StructuredDirectory.decodeFileName("12/345/678.txt")); assertEquals("", 12005008, StructuredDirectory.decodeFileName("12/5/8.txt")); }