[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:
Dmitriy Novozhilov
2024-02-16 13:04:40 +02:00
committed by Space Team
parent 7ad371b215
commit 9b5a9ccba8
16 changed files with 170 additions and 73 deletions
@@ -39,7 +39,7 @@ import static org.jetbrains.kotlin.codegen.BytecodeTextUtilsKt.readExpectedOccur
public abstract class AbstractTopLevelMembersInvocationTest extends AbstractBytecodeTextTest {
@Override
public void doTest(@NotNull String filename) throws Exception {
public void doTest(@NotNull String filename) {
File root = new File(filename);
List<String> sourceFiles = SequencesKt.toList(SequencesKt.map(
SequencesKt.filter(FilesKt.walkTopDown(root).maxDepth(1), File::isFile),
@@ -513,17 +513,21 @@ public abstract class CodegenTestCase extends KotlinBaseTest<KotlinBaseTest.Test
}
@Override
protected void doTest(@NotNull String filePath) throws Exception {
protected void doTest(@NotNull String filePath) {
doTestWithTransformer(filePath, s -> s);
}
protected void doTestWithTransformer(@NotNull String filePath, @NotNull Function<String, String> sourceTransformer) throws Exception {
protected void doTestWithTransformer(@NotNull String filePath, @NotNull Function<String, String> sourceTransformer) {
File file = new File(filePath);
String expectedText = sourceTransformer.apply(KtTestUtil.doLoadFile(file));
List<TestFile> testFiles = createTestFilesFromFile(file, expectedText);
doMultiFileTest(file, testFiles);
try {
doMultiFileTest(file, testFiles);
} catch (Exception e) {
throw new RuntimeException(e);
}
}
@Override
@@ -36,7 +36,16 @@ public abstract class AbstractDefaultArgumentsReflectionTest extends CodegenTest
}
@Override
protected void doTest(@NotNull String path) throws IOException {
protected void doTest(@NotNull String path) {
try {
doTestImpl(path);
}
catch (IOException e) {
throw new RuntimeException(e);
}
}
private void doTestImpl(@NotNull String path) throws IOException {
loadFileByFullPath(path);
File file = new File(path);