public void createRootElement() throws FileNotFoundException, IOException { Properties prop = new Properties(); prop.load(new FileInputStream("/home/asdf/Desktop/test.properties")); File file = new File(prop.getProperty("filefromroot")); try { // if file doesn't exists, then create it if (!file.exists()) { file.createNewFile(); } FileWriter fw = new FileWriter(file.getAbsoluteFile()); BufferedWriter bw = new BufferedWriter(fw); bw.write("<root>"); //create the root tag for the XML File. bw.close(); } catch(Exception e) { writeLog(e.getMessage(),false); } } I'm new to junit testing.I would like to know how to write test case for this and what all to be considered. how to call the method is called from this test.?