[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
@@ -23,7 +23,7 @@ import org.jetbrains.kotlin.codegen.forTestCompile.ForTestCompileRuntime;
import java.io.File;
public abstract class AbstractAntTaskTest extends KotlinIntegrationTestBase {
protected void doTest(String testFile) throws Exception {
protected void doTest(String testFile) {
String testDataDir = new File(testFile).getAbsolutePath();
String antClasspath = System.getProperty("kotlin.ant.classpath");
@@ -53,13 +53,18 @@ public abstract class KotlinIntegrationTestBase extends TestCaseWithTmpdir {
KotlinTestUtils.runTestWithThrowable(this, () -> super.runTest());
}
protected int runJava(@NotNull String testDataDir, @Nullable String logName, @NotNull String... arguments) throws Exception {
protected int runJava(@NotNull String testDataDir, @Nullable String logName, @NotNull String... arguments) {
GeneralCommandLine commandLine = new GeneralCommandLine().withWorkDirectory(testDataDir);
commandLine.setExePath(getJavaRuntime().getAbsolutePath());
commandLine.addParameters(arguments);
StringBuilder executionLog = new StringBuilder();
int exitCode = runProcess(commandLine, executionLog);
int exitCode;
try {
exitCode = runProcess(commandLine, executionLog);
} catch (ExecutionException e) {
throw new RuntimeException(e);
}
if (logName == null) {
assertEquals("Non-zero exit code", 0, exitCode);