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);
}
}
我是 junit 测试的新手。我想知道如何为此编写测试用例以及要考虑的所有内容。如何调用从这个测试中调用的方法。?