1
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 testing的新手。我想知道如何編寫測試用例,以及需要考慮的全部內容。如何調用該方法從此測試中調用。從一次測試中調用某個方法時的junit測試
這應該讓你開始:http://junit.sourceforge.net/doc/faq/faq.htm – Aboutblank 2013-03-05 18:31:53