MkStdDirExec { public void readDirInfo(String filePath) throws IOException { File file = new File(filePath); BufferedReader in = new BufferedReader(new FileReader(file)); try { Integer lineNo = new Integer(0); String lineStr = null; while ((lineStr = in.readLine()) != null) { if (lineStr.trim() == null || lineStr.trim().length() == 0) { continue; } lineNoAndLine.put(lineNo++, lineStr); } } finally { in.close(); file = null; } }  void readDirInfo(String filePath); void parseLines(Integer fistIndex,String dot,int level,MenuInfo parentMenu); String pow(String doc,int size); String parseLineContent(String dot,String line); void mkdir(String rootPath,MenuInfo menuInfo); static void main(String[] args);  }
@Test public void readDirInfo() throws NoSuchFieldException, SecurityException, IllegalArgumentException, IllegalAccessException, IOException { MkStdDirExec intance = injector.getInstance(MkStdDirExec.class); Field field = intance.getClass().getDeclaredField("lineNoAndLine"); String filePath = this.getClass().getResource("/dirinfo/").getPath() + "dirinfo.txt"; intance.readDirInfo(filePath); Map<Integer, String> lineNoAndStrs = new HashMap<Integer, String>(); lineNoAndStrs.put(new Integer(0), "## aa ##"); lineNoAndStrs.put(new Integer(1), "### bbb ###"); lineNoAndStrs.put(new Integer(2), "### ccc ###"); lineNoAndStrs.put(new Integer(3), "#### 111 ####"); lineNoAndStrs.put(new Integer(4), "## ddd ##"); lineNoAndStrs.put(new Integer(5), "## ee ##"); Assert.assertEquals(field.get(intance), lineNoAndStrs); }