Test framework fix: Load kotlin test classes in separate class loader

This commit is contained in:
Mikhael Bogdanov
2013-10-11 13:41:08 +04:00
parent 7d7352954e
commit 6154464050
11 changed files with 118 additions and 30 deletions
@@ -108,8 +108,17 @@ public class TestlibTest extends UsefulTestCase {
ClassFileFactory classFileFactory = generationState.getFactory();
classLoader = new GeneratedClassLoader(classFileFactory,
new URLClassLoader(new URL[] {ForTestCompileRuntime.runtimeJarForTests().toURI().toURL(), junitJar.toURI().toURL()},
TestCase.class.getClassLoader()));
new URLClassLoader(new URL[] {ForTestCompileRuntime.runtimeJarForTests().toURI().toURL()},
null)) {
@Override
public Class<?> loadClass(String name) throws ClassNotFoundException {
if (name.startsWith("junit.") || name.startsWith("org.junit.")) {
//In other way we don't find any test cause will have two different TestCase classes!
return TestlibTest.class.getClassLoader().loadClass(name);
}
return super.loadClass(name);
}
};
typeMapper = generationState.getTypeMapper();