[Test] Don't generate throws Exception on methods of generated tests
This is needed to reduce the size of generated test files, which started to exceed default IDE limit Also update some (mostly old) test utilities to remove exceptions from java signatures
This commit is contained in:
committed by
Space Team
parent
7ad371b215
commit
9b5a9ccba8
@@ -35,7 +35,7 @@ import java.io.IOException;
|
||||
public abstract class AbstractModuleXmlParserTest extends TestCase {
|
||||
|
||||
@SuppressWarnings("MethodMayBeStatic")
|
||||
protected void doTest(String xmlPath) throws IOException {
|
||||
protected void doTest(String xmlPath) {
|
||||
File txtFile = new File(FileUtil.getNameWithoutExtension(xmlPath) + ".txt");
|
||||
|
||||
ModuleChunk result = ModuleXmlParser.parseModuleScript(xmlPath, new MessageCollector() {
|
||||
@@ -65,7 +65,12 @@ public abstract class AbstractModuleXmlParserTest extends TestCase {
|
||||
String actual = sb.toString();
|
||||
|
||||
if (!txtFile.exists()) {
|
||||
FileUtil.writeToFile(txtFile, actual);
|
||||
try {
|
||||
FileUtil.writeToFile(txtFile, actual);
|
||||
}
|
||||
catch (IOException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
fail("Expected data file does not exist. A new file created: " + txtFile);
|
||||
}
|
||||
|
||||
|
||||
@@ -78,23 +78,31 @@ public abstract class AbstractParsingTest extends KtParsingTestCase {
|
||||
}
|
||||
}
|
||||
|
||||
protected void doParsingTest(@NotNull String filePath) throws Exception {
|
||||
protected void doParsingTest(@NotNull String filePath) {
|
||||
doBaseTest(filePath, KtNodeTypes.KT_FILE, null);
|
||||
}
|
||||
|
||||
protected void doParsingTest(@NotNull String filePath, Function1<String, String> contentFilter) throws Exception {
|
||||
protected void doParsingTest(@NotNull String filePath, Function1<String, String> contentFilter) {
|
||||
doBaseTest(filePath, KtNodeTypes.KT_FILE, contentFilter);
|
||||
}
|
||||
|
||||
protected void doExpressionCodeFragmentParsingTest(@NotNull String filePath) throws Exception {
|
||||
protected void doExpressionCodeFragmentParsingTest(@NotNull String filePath) {
|
||||
doBaseTest(filePath, KtNodeTypes.EXPRESSION_CODE_FRAGMENT, null);
|
||||
}
|
||||
|
||||
protected void doBlockCodeFragmentParsingTest(@NotNull String filePath) throws Exception {
|
||||
protected void doBlockCodeFragmentParsingTest(@NotNull String filePath) {
|
||||
doBaseTest(filePath, KtNodeTypes.BLOCK_CODE_FRAGMENT, null);
|
||||
}
|
||||
|
||||
private void doBaseTest(@NotNull String filePath, @NotNull IElementType fileType, Function1<String, String> contentFilter) throws Exception {
|
||||
private void doBaseTest(@NotNull String filePath, @NotNull IElementType fileType, Function1<String, String> contentFilter) {
|
||||
try {
|
||||
doBaseTestImpl(filePath, fileType, contentFilter);
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
|
||||
private void doBaseTestImpl(@NotNull String filePath, @NotNull IElementType fileType, Function1<String, String> contentFilter) throws Exception {
|
||||
String fileContent = loadFile(filePath);
|
||||
|
||||
myFileExt = FileUtilRt.getExtension(PathUtil.getFileName(filePath));
|
||||
|
||||
Reference in New Issue
Block a user