[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
@@ -84,7 +84,7 @@ public class KtTestUtil {
return doLoadFile(new File(fullName));
}
public static String doLoadFile(@NotNull File file) throws IOException {
public static String doLoadFile(@NotNull File file) {
try {
return FileUtil.loadFile(file, CharsetToolkit.UTF8, true);
}
@@ -94,11 +94,16 @@ public class KtTestUtil {
* This clarifies the exception by showing the full path.
*/
String messageWithFullPath = file.getAbsolutePath() + " (No such file or directory)";
throw new IOException(
"Ensure you have your 'Working Directory' configured correctly as the root " +
"Kotlin project directory in your test configuration\n\t" +
messageWithFullPath,
fileNotFoundException);
throw new RuntimeException(
new IOException(
"Ensure you have your 'Working Directory' configured correctly as the root " +
"Kotlin project directory in your test configuration\n\t" +
messageWithFullPath,
fileNotFoundException
)
);
} catch (IOException e) {
throw new RuntimeException(e);
}
}