From b5bec6a8b5f8fc4017dcfcce3b9a803fba476aae Mon Sep 17 00:00:00 2001 From: Dmitry Jemerov Date: Wed, 22 Sep 2010 15:23:27 +0400 Subject: [PATCH] remove junk 'throws Exception' --- .../python/fixtures/LightMarkedTestCase.java | 21 +++++++++++-------- .../python/refactoring/PyInlineLocalTest.java | 16 +++++++------- 2 files changed, 20 insertions(+), 17 deletions(-) diff --git a/python/testSrc/com/jetbrains/python/fixtures/LightMarkedTestCase.java b/python/testSrc/com/jetbrains/python/fixtures/LightMarkedTestCase.java index 4f9c0a743254..ca616f64de14 100644 --- a/python/testSrc/com/jetbrains/python/fixtures/LightMarkedTestCase.java +++ b/python/testSrc/com/jetbrains/python/fixtures/LightMarkedTestCase.java @@ -28,7 +28,7 @@ public abstract class LightMarkedTestCase extends PyLightFixtureTestCase { /** * Marker "as expected", any alphanumeric sting in angle brackets. */ - public final @NonNls String MARKER = "<[a-zA-Z0-9_]+>"; + public static final @NonNls String MARKER = "<[a-zA-Z0-9_]+>"; /** * Uses MARKER as regexp. @@ -37,7 +37,7 @@ public abstract class LightMarkedTestCase extends PyLightFixtureTestCase { * @return a mapping of markers to PSI elements * @throws Exception */ - protected Map configureByFile(@TestDataFile @NonNls String filePath) throws Exception { + protected Map configureByFile(@TestDataFile @NonNls String filePath) { return configureByFile(filePath, MARKER); } @@ -48,14 +48,19 @@ public abstract class LightMarkedTestCase extends PyLightFixtureTestCase { * @return a mapping of markers to PSI elements * @throws Exception */ - protected Map configureByFile(@TestDataFile @NonNls String filePath, @NonNls String markerRegexp) - throws Exception - { + protected Map configureByFile(@TestDataFile @NonNls String filePath, @NonNls String markerRegexp) { final String fullPath = getTestDataPath() + filePath; final VirtualFile vFile = LocalFileSystem.getInstance().findFileByPath(fullPath.replace(File.separatorChar, '/')); assertNotNull("file " + fullPath + " not found", vFile); - String fileText = StringUtil.convertLineSeparators(VfsUtil.loadText(vFile), "\n"); + final String text; + try { + text = VfsUtil.loadText(vFile); + } + catch (IOException e) { + throw new RuntimeException(e); + } + String fileText = StringUtil.convertLineSeparators(text, "\n"); final String fileName = vFile.getName(); @@ -71,9 +76,7 @@ public abstract class LightMarkedTestCase extends PyLightFixtureTestCase { * @return mapping of markers to the PSI elements * @throws Exception */ - protected Map configureByFileText(String fileText, final String fileName, @NonNls String markerRegexp) - throws Exception - { + protected Map configureByFileText(String fileText, final String fileName, @NonNls String markerRegexp) { // build a map of marks to positions, and the text with marks stripped Pattern pat = Pattern.compile(markerRegexp); Matcher mat = pat.matcher(fileText); diff --git a/python/testSrc/com/jetbrains/python/refactoring/PyInlineLocalTest.java b/python/testSrc/com/jetbrains/python/refactoring/PyInlineLocalTest.java index da92365383a4..c995201182ee 100644 --- a/python/testSrc/com/jetbrains/python/refactoring/PyInlineLocalTest.java +++ b/python/testSrc/com/jetbrains/python/refactoring/PyInlineLocalTest.java @@ -13,11 +13,11 @@ import java.util.Map; * @author Dennis.Ushakov */ public class PyInlineLocalTest extends LightMarkedTestCase { - private void doTest() throws Exception { + private void doTest() { doTest(null); } - private void doTest(String expectedError) throws Exception { + private void doTest(String expectedError) { final String name = getTestName(true); final Map map = configureByFile("/refactoring/inlinelocal/" + name + ".before.py"); try { @@ -44,27 +44,27 @@ public class PyInlineLocalTest extends LightMarkedTestCase { myFixture.checkResultByFile("/refactoring/inlinelocal/" + name + ".after.py"); } - public void testSimple() throws Exception { + public void testSimple() { doTest(); } - public void testPriority() throws Exception { + public void testPriority() { doTest(); } - public void testNoDominator() throws Exception { + public void testNoDominator() { doTest("Cannot perform refactoring.\nCannot find a single definition to inline."); } - public void testDoubleDefinition() throws Exception { + public void testDoubleDefinition() { doTest("Cannot perform refactoring.\nAnother variable 'foo' definition is used together with inlined one."); } - public void testMultiple() throws Exception { + public void testMultiple() { doTest(); } - public void testPy994() throws Exception { + public void testPy994() { doTest(); } }