From ddd61fab040262e3fd9ae98e2d4bdbeff9d16744 Mon Sep 17 00:00:00 2001 From: Dmitry Jemerov Date: Thu, 24 Jun 2010 16:01:16 +0400 Subject: [PATCH] narrow down throws clause --- .../intellij/testFramework/ParsingTestCase.java | 14 +++++++------- .../src/com/intellij/lang/ant/CustomTypesTest.java | 3 ++- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/platform/testFramework/src/com/intellij/testFramework/ParsingTestCase.java b/platform/testFramework/src/com/intellij/testFramework/ParsingTestCase.java index a6393382fb7f..cea036ac61e4 100644 --- a/platform/testFramework/src/com/intellij/testFramework/ParsingTestCase.java +++ b/platform/testFramework/src/com/intellij/testFramework/ParsingTestCase.java @@ -53,7 +53,7 @@ public abstract class ParsingTestCase extends LightPlatformTestCase { return false; } - protected void doTest(boolean checkResult) throws Exception{ + protected void doTest(boolean checkResult) throws Exception { String name = getTestName(false); String text = loadFile(name + "." + myFileExt); myFile = createPsiFile(name, text); @@ -67,7 +67,7 @@ public abstract class ParsingTestCase extends LightPlatformTestCase { } } - protected void doTest(String suffix) throws Exception{ + protected void doTest(String suffix) throws IOException { String name = getTestName(false); String text = loadFile(name + "." + myFileExt); myFile = createPsiFile(name, text); @@ -80,11 +80,11 @@ public abstract class ParsingTestCase extends LightPlatformTestCase { return createFile(name + "." + myFileExt, text); } - protected void checkResult(@NonNls @TestDataFile String targetDataName, final PsiFile file) throws Exception { + protected void checkResult(@NonNls @TestDataFile String targetDataName, final PsiFile file) throws IOException { doCheckResult(myFullDataPath, file, targetDataName, includeRanges()); } - public static void doCheckResult(String myFullDataPath, PsiFile file, String targetDataName, boolean printRanges) throws Exception { + public static void doCheckResult(String myFullDataPath, PsiFile file, String targetDataName, boolean printRanges) throws IOException { final PsiElement[] psiRoots = file.getPsiRoots(); if(psiRoots.length > 1){ for (int i = 0; i < psiRoots.length; i++) { @@ -97,11 +97,11 @@ public abstract class ParsingTestCase extends LightPlatformTestCase { } } - protected void checkResult(@TestDataFile @NonNls String targetDataName, final String text) throws Exception { + protected void checkResult(@TestDataFile @NonNls String targetDataName, final String text) throws IOException { doCheckResult(myFullDataPath, targetDataName, text); } - private static void doCheckResult(String myFullDataPath, String targetDataName, String text) throws Exception { + private static void doCheckResult(String myFullDataPath, String targetDataName, String text) throws IOException { try { text = text.trim(); String expectedText = doLoadFile(myFullDataPath, targetDataName); @@ -124,7 +124,7 @@ public abstract class ParsingTestCase extends LightPlatformTestCase { return DebugUtil.psiToString(file, false, printRanges); } - protected String loadFile(@NonNls @TestDataFile String name) throws Exception { + protected String loadFile(@NonNls @TestDataFile String name) throws IOException { return doLoadFile(myFullDataPath, name); } diff --git a/plugins/ant/tests/src/com/intellij/lang/ant/CustomTypesTest.java b/plugins/ant/tests/src/com/intellij/lang/ant/CustomTypesTest.java index e164c87b1fd0..f26f08fcc99f 100644 --- a/plugins/ant/tests/src/com/intellij/lang/ant/CustomTypesTest.java +++ b/plugins/ant/tests/src/com/intellij/lang/ant/CustomTypesTest.java @@ -26,6 +26,7 @@ import com.intellij.testFramework.ParsingTestCase; import org.jetbrains.annotations.NotNull; import java.io.File; +import java.io.IOException; public class CustomTypesTest extends ParsingTestCase { @@ -63,7 +64,7 @@ public class CustomTypesTest extends ParsingTestCase { return result; } - protected String loadFile(String name) throws Exception { + protected String loadFile(String name) throws IOException { String fullName = getTestDataPath() + File.separatorChar + name; String text = new String(FileUtil.loadFileText(new File(fullName))).trim(); text = StringUtil.convertLineSeparators(text);