本文整理了Java中org.testng.internal.Utils.replaceSpecialCharacters()
方法的一些代码示例,展示了Utils.replaceSpecialCharacters()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Utils.replaceSpecialCharacters()
方法的具体详情如下:
包路径:org.testng.internal.Utils
类名称:Utils
方法名:replaceSpecialCharacters
[英]If the file name contains special characters like ,/,\ and so on, exception will be thrown and report file will not be created.
Special characters are platform specific and they are not same for example on Windows and Macintosh. * is not allowed on Windows, but it is on Macintosh.
In order to have the same behavior of testng on the all platforms, characters like * will be replaced on all platforms whether they are causing the problem or not.
[中]如果文件名包含特殊字符,如、/、\等,将引发异常,并且不会创建报告文件。
特殊字符是特定于平台的,例如在Windows和Macintosh上它们是不同的。Windows上不允许,但Macintosh上允许。
为了在所有平台上都具有相同的testng行为,所有平台上都将替换像这样的字符,无论它们是否导致问题。
代码示例来源:origin: org.testng/testng
/**
* Open a BufferedWriter for the specified file. If output directory doesn't
* exist, it is created. If the output file exists, it is deleted. The output file is
* created in any case.
* @param outputDir output directory. If <tt>null</tt>, then current directory is used
* @param fileNameParameter file name
* @throws IOException if anything goes wrong while creating files.
*/
public static BufferedWriter openWriter(@Nullable String outputDir, String fileNameParameter) throws IOException {
String fileName = fileNameParameter;
String outDirPath= outputDir != null ? outputDir : "";
File outDir= new File(outDirPath);
if (!outDir.exists()) {
outDir.mkdirs();
}
fileName = replaceSpecialCharacters(fileName);
File outputFile = new File(outDir, fileName);
outputFile.delete();
return openWriter(outputFile, null);
}
代码示例来源:origin: cbeust/testng
/**
* Open a BufferedWriter for the specified file. If output directory doesn't exist, it is created.
* If the output file exists, it is deleted. The output file is created in any case.
*
* @param outputDir output directory. If <tt>null</tt>, then current directory is used
* @param fileNameParameter file name
* @throws IOException if anything goes wrong while creating files.
*/
public static BufferedWriter openWriter(@Nullable String outputDir, String fileNameParameter)
throws IOException {
String fileName = fileNameParameter;
String outDirPath = outputDir != null ? outputDir : "";
File outDir = new File(outDirPath);
if (!outDir.exists()) {
outDir.mkdirs();
}
fileName = replaceSpecialCharacters(fileName);
File outputFile = new File(outDir, fileName);
outputFile.delete();
return openWriter(outputFile, null);
}
代码示例来源:origin: org.testng/testng
fileName = replaceSpecialCharacters(fileName);
File outputFile = new File(outDir, fileName);
outputFile.delete();
代码示例来源:origin: cbeust/testng
fileName = replaceSpecialCharacters(fileName);
File outputFile = new File(outDir, fileName);
outputFile.delete();
内容来源于网络,如有侵权,请联系作者删除!