Register ProjectRootModificationTracker as NEVER_CHANGE in StandaloneJavaToKotlinConverterTest.
This commit is contained in:
@@ -44,7 +44,7 @@ public class JavaToKotlinTranslator {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
private static final ProjectRootModificationTracker NEVER_CHANGED = new ProjectRootModificationTracker() {
|
/*package*/ static final ProjectRootModificationTracker NEVER_CHANGED = new ProjectRootModificationTracker() {
|
||||||
@Override
|
@Override
|
||||||
public long getModificationCount() {
|
public long getModificationCount() {
|
||||||
return 0;
|
return 0;
|
||||||
|
|||||||
@@ -16,6 +16,8 @@
|
|||||||
|
|
||||||
package org.jetbrains.jet.j2k;
|
package org.jetbrains.jet.j2k;
|
||||||
|
|
||||||
|
import com.intellij.mock.MockProject;
|
||||||
|
import com.intellij.openapi.roots.ProjectRootModificationTracker;
|
||||||
import com.intellij.openapi.util.io.FileUtil;
|
import com.intellij.openapi.util.io.FileUtil;
|
||||||
import com.intellij.psi.PsiFile;
|
import com.intellij.psi.PsiFile;
|
||||||
import com.intellij.psi.PsiJavaFile;
|
import com.intellij.psi.PsiJavaFile;
|
||||||
@@ -45,7 +47,11 @@ public class StandaloneJavaToKotlinConverterTest extends UsefulTestCase {
|
|||||||
@Override
|
@Override
|
||||||
protected void runTest() throws Throwable {
|
protected void runTest() throws Throwable {
|
||||||
JetCoreEnvironment jetCoreEnvironment = createEnvironmentWithMockJdkAndIdeaAnnotations(getTestRootDisposable(), ConfigurationKind.JDK_ONLY);
|
JetCoreEnvironment jetCoreEnvironment = createEnvironmentWithMockJdkAndIdeaAnnotations(getTestRootDisposable(), ConfigurationKind.JDK_ONLY);
|
||||||
Converter converter = new Converter(jetCoreEnvironment.getProject());
|
|
||||||
|
MockProject project = (MockProject) jetCoreEnvironment.getProject();
|
||||||
|
project.registerService(ProjectRootModificationTracker.class, JavaToKotlinTranslator.NEVER_CHANGED);
|
||||||
|
|
||||||
|
Converter converter = new Converter(project);
|
||||||
|
|
||||||
String javaPath = "j2k/tests/testData/" + getTestFilePath();
|
String javaPath = "j2k/tests/testData/" + getTestFilePath();
|
||||||
String kotlinPath = javaPath.replace(".jav", ".kt");
|
String kotlinPath = javaPath.replace(".jav", ".kt");
|
||||||
@@ -81,8 +87,8 @@ public class StandaloneJavaToKotlinConverterTest extends UsefulTestCase {
|
|||||||
|
|
||||||
File tmp = new File(kotlinPath + ".tmp");
|
File tmp = new File(kotlinPath + ".tmp");
|
||||||
if (!expected.equals(actual)) FileUtil.writeToFile(tmp, actual);
|
if (!expected.equals(actual)) FileUtil.writeToFile(tmp, actual);
|
||||||
if (expected.equals(actual) && tmp.exists()) //noinspection ResultOfMethodCallIgnored
|
if (expected.equals(actual) && tmp.exists()) {
|
||||||
{
|
//noinspection ResultOfMethodCallIgnored
|
||||||
tmp.delete();
|
tmp.delete();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user