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