more convenient method

This commit is contained in:
Alexey Kudravtsev
2011-03-25 19:45:17 +03:00
parent 1d9b3b155c
commit 310af0d25d
45 changed files with 72 additions and 70 deletions
@@ -57,7 +57,7 @@ public class JavaDocInfoGeneratorTest extends CodeInsightTestCase {
private void verifyJavaDoc(final PsiElement field) throws IOException {
final File htmlPath = new File(JavaTestUtil.getJavaTestDataPath() + "/codeInsight/javadocIG/" + getTestName(true) + ".html");
String htmlText = new String(FileUtil.loadFileText(htmlPath));
String htmlText = FileUtil.loadFile(htmlPath);
String docInfo = new JavaDocInfoGenerator(getProject(), field).generateDocInfo(null);
assertEquals(StringUtil.convertLineSeparators(htmlText.trim()), StringUtil.convertLineSeparators(docInfo.trim()));
}
@@ -68,7 +68,7 @@ public class JavaDocInfoGeneratorTest extends CodeInsightTestCase {
PsiTestUtil.createTestProjectStructure(myProject, myModule, path, myFilesToDelete);
final String info =
new JavaDocInfoGenerator(getProject(), JavaPsiFacade.getInstance(getProject()).findPackage(getTestName(true))).generateDocInfo(null);
String htmlText = new String(FileUtil.loadFileText(new File(packageInfo + File.separator + "packageInfo.html")));
String htmlText = FileUtil.loadFile(new File(packageInfo + File.separator + "packageInfo.html"));
assertEquals(StringUtil.convertLineSeparators(htmlText.trim()), StringUtil.convertLineSeparators(info.trim()));
}
@@ -43,8 +43,8 @@ public class FileTemplatesTest extends IdeaTestCase {
File propFile = new File(resultFile.getParent(), base + ".prop" + txt);
File inFile = new File(resultFile.getParent(), base + txt);
String inputText = new String(FileUtil.loadFileText(inFile, FileTemplate.ourEncoding));
String outputText = new String(FileUtil.loadFileText(resultFile, FileTemplate.ourEncoding));
String inputText = FileUtil.loadFile(inFile, FileTemplate.ourEncoding);
String outputText = FileUtil.loadFile(resultFile, FileTemplate.ourEncoding);
EncodingAwareProperties properties = new EncodingAwareProperties();
@@ -80,7 +80,7 @@ public class ClsBuilderTest extends LightIdeaTestCase {
final String goldFilePath = JavaTestUtil.getJavaTestDataPath() + "/psi/cls/stubBuilder/" + goldFile;
String expected = "";
try {
expected = new String(FileUtil.loadFileText(new File(goldFilePath)));
expected = FileUtil.loadFile(new File(goldFilePath));
expected = StringUtil.convertLineSeparators(expected);
}
catch (FileNotFoundException e) {
@@ -359,10 +359,10 @@ public class JavaStubBuilderTest extends LightIdeaTestCase {
public void testPerformance() throws Exception {
final String path = PathManagerEx.getTestDataPath() + "/psi/stub/StubPerformanceTest.java";
final char[] source = FileUtil.loadFileText(new File(path));
final PsiJavaFile file = (PsiJavaFile)createLightFile("test.java", new String(source));
String text = FileUtil.loadFile(new File(path));
final PsiJavaFile file = (PsiJavaFile)createLightFile("test.java", text);
IdeaTestUtil.assertTiming("Source file size: " + source.length, 2000, new Runnable() {
IdeaTestUtil.assertTiming("Source file size: " + text.length(), 2000, new Runnable() {
@Override
public void run() {
NEW_BUILDER.buildStubTree(file);
@@ -39,7 +39,7 @@ public class NormalizeDeclarationTest extends PsiTestCase{
private static String loadFile(String name) throws Exception {
String fullName = BASE_PATH + File.separatorChar + name;
String text = new String(FileUtil.loadFileText(new File(fullName)));
String text = FileUtil.loadFile(new File(fullName));
text = StringUtil.convertLineSeparators(text);
return text;
}
@@ -80,7 +80,7 @@ public class OptimizeImportsTest extends PsiTestCase{
private static String loadFile(String name) throws Exception {
String fullName = BASE_PATH + File.separatorChar + name;
String text = new String(FileUtil.loadFileText(new File(fullName)));
String text = FileUtil.loadFile(new File(fullName));
text = StringUtil.convertLineSeparators(text);
return text;
}
@@ -207,7 +207,7 @@ public abstract class AbstractJavaFormatterTest extends LightIdeaTestCase {
private static String loadFile(String name) throws Exception {
String fullName = BASE_PATH + File.separatorChar + name;
String text = new String(FileUtil.loadFileText(new File(fullName)));
String text = FileUtil.loadFile(new File(fullName));
text = StringUtil.convertLineSeparators(text);
return text;
}
@@ -74,7 +74,7 @@ public class ShortenClassReferencesTest extends PsiTestCase {
private String loadFile(String name) throws Exception {
String fullName = BASE_PATH + File.separatorChar + name;
String text = new String(FileUtil.loadFileText(new File(fullName)));
String text = FileUtil.loadFile(new File(fullName));
text = StringUtil.convertLineSeparators(text);
return text;
}