KotlinAndJavaCheckerTest -> JavaAgainstKotlinSourceTest and make it generated

This commit is contained in:
Pavel V. Talanov
2015-10-28 19:09:12 +03:00
parent 6b391d6ed2
commit 506b5509f3
3 changed files with 126 additions and 67 deletions
@@ -381,6 +381,10 @@ fun main(args: Array<String>) {
model("checker/infos", testMethod = "doTestWithInfos")
}
testClass<AbstractJavaAgainstKotlinSourceCheckerTest>() {
model("kotlinAndJavaChecker")
}
testClass<AbstractJetPsiUnifierTest>() {
model("unifier")
}
@@ -32,13 +32,15 @@ import org.jetbrains.kotlin.idea.KotlinDaemonAnalyzerTestCase;
import org.jetbrains.kotlin.idea.test.ConfigLibraryUtil;
import org.jetbrains.kotlin.idea.test.PluginTestCaseBase;
import org.jetbrains.kotlin.test.InTextDirectivesUtils;
import org.jetbrains.kotlin.test.JetTestUtils;
import org.jetbrains.kotlin.utils.ExceptionUtilsKt;
import java.io.File;
import java.io.IOException;
import java.util.List;
public class KotlinAndJavaCheckerTest extends KotlinDaemonAnalyzerTestCase {
public abstract class AbstractJavaAgainstKotlinSourceCheckerTest extends KotlinDaemonAnalyzerTestCase {
private static final LocalInspectionTool[] DEFAULT_TOOLS = new LocalInspectionTool[] {
new StaticCallOnSubclassInspection(),
new StaticFieldReferenceOnSubclassInspection(),
@@ -60,7 +62,7 @@ public class KotlinAndJavaCheckerTest extends KotlinDaemonAnalyzerTestCase {
@Nullable
protected String getConfigFileText() {
File configureFile = new File(getTestDataPath(), getTestName(false) + ".txt");
File configureFile = new File(PluginTestCaseBase.getTestDataPathBase() + "/kotlinAndJavaChecker/" + getTestName(false) + ".txt");
if (!configureFile.exists()) return null;
try {
@@ -98,16 +100,6 @@ public class KotlinAndJavaCheckerTest extends KotlinDaemonAnalyzerTestCase {
return module;
}
@Override
protected void setUp() throws Exception {
super.setUp();
}
@Override
protected void tearDown() throws Exception {
super.tearDown();
}
@Override
protected Sdk getTestProjectJdk() {
return PluginTestCaseBase.mockJdk();
@@ -115,62 +107,10 @@ public class KotlinAndJavaCheckerTest extends KotlinDaemonAnalyzerTestCase {
@Override
protected String getTestDataPath() {
return PluginTestCaseBase.getTestDataPathBase() + "/kotlinAndJavaChecker/";
return JetTestUtils.getHomeDirectory() + "/";
}
public void testClassObjects() throws Exception {
doTest();
}
public void testNoNotNullOnParameterInOverride() throws Exception {
doTest();
}
public void testTopLevelFunctionInDataFlowInspection() throws Exception {
doTest();
}
public void testUsingKotlinPackageDeclarations() throws Exception {
doTest();
}
public void testAssignKotlinClassToObjectInJava() throws Exception {
doTest();
}
public void testAssignMappedKotlinType() throws Exception {
doTest();
}
public void testUseKotlinSubclassesOfMappedTypes() throws Exception {
doTest();
}
public void testImplementedMethodsFromTraits() throws Exception {
doTest();
}
public void testJvmOverloadsFunctions() throws Exception {
doTest();
}
public void testEnumAutoGeneratedMethods() throws Exception {
doTest();
}
public void testEnumEntriesInSwitch() throws Exception {
doTest();
}
public void testEnumStaticImportInJava() throws Exception {
doTest();
}
public void testKotlinAnnotations() throws Exception {
doTest();
}
public void doTest() throws Exception {
doTest(true, true, getTestName(false) + ".java", getTestName(false) + ".kt");
public void doTest(String path) throws Exception {
doTest(true, true, path.replace(".kt", ".java"), path);
}
}
@@ -0,0 +1,115 @@
/*
* Copyright 2010-2015 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jetbrains.kotlin.checkers;
import com.intellij.testFramework.TestDataPath;
import org.jetbrains.kotlin.test.JUnit3RunnerWithInners;
import org.jetbrains.kotlin.test.JetTestUtils;
import org.jetbrains.kotlin.test.TestMetadata;
import org.junit.runner.RunWith;
import java.io.File;
import java.util.regex.Pattern;
/** This class is generated by {@link org.jetbrains.kotlin.generators.tests.TestsPackage}. DO NOT MODIFY MANUALLY */
@SuppressWarnings("all")
@TestMetadata("idea/testData/kotlinAndJavaChecker")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public class JavaAgainstKotlinSourceCheckerTestGenerated extends AbstractJavaAgainstKotlinSourceCheckerTest {
public void testAllFilesPresentInKotlinAndJavaChecker() throws Exception {
JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("idea/testData/kotlinAndJavaChecker"), Pattern.compile("^(.+)\\.kt$"), true);
}
@TestMetadata("AssignKotlinClassToObjectInJava.kt")
public void testAssignKotlinClassToObjectInJava() throws Exception {
String fileName = JetTestUtils.navigationMetadata("idea/testData/kotlinAndJavaChecker/AssignKotlinClassToObjectInJava.kt");
doTest(fileName);
}
@TestMetadata("AssignMappedKotlinType.kt")
public void testAssignMappedKotlinType() throws Exception {
String fileName = JetTestUtils.navigationMetadata("idea/testData/kotlinAndJavaChecker/AssignMappedKotlinType.kt");
doTest(fileName);
}
@TestMetadata("ClassObjects.kt")
public void testClassObjects() throws Exception {
String fileName = JetTestUtils.navigationMetadata("idea/testData/kotlinAndJavaChecker/ClassObjects.kt");
doTest(fileName);
}
@TestMetadata("EnumAutoGeneratedMethods.kt")
public void testEnumAutoGeneratedMethods() throws Exception {
String fileName = JetTestUtils.navigationMetadata("idea/testData/kotlinAndJavaChecker/EnumAutoGeneratedMethods.kt");
doTest(fileName);
}
@TestMetadata("EnumEntriesInSwitch.kt")
public void testEnumEntriesInSwitch() throws Exception {
String fileName = JetTestUtils.navigationMetadata("idea/testData/kotlinAndJavaChecker/EnumEntriesInSwitch.kt");
doTest(fileName);
}
@TestMetadata("EnumStaticImportInJava.kt")
public void testEnumStaticImportInJava() throws Exception {
String fileName = JetTestUtils.navigationMetadata("idea/testData/kotlinAndJavaChecker/EnumStaticImportInJava.kt");
doTest(fileName);
}
@TestMetadata("ImplementedMethodsFromTraits.kt")
public void testImplementedMethodsFromTraits() throws Exception {
String fileName = JetTestUtils.navigationMetadata("idea/testData/kotlinAndJavaChecker/ImplementedMethodsFromTraits.kt");
doTest(fileName);
}
@TestMetadata("JvmOverloadsFunctions.kt")
public void testJvmOverloadsFunctions() throws Exception {
String fileName = JetTestUtils.navigationMetadata("idea/testData/kotlinAndJavaChecker/JvmOverloadsFunctions.kt");
doTest(fileName);
}
@TestMetadata("KotlinAnnotations.kt")
public void testKotlinAnnotations() throws Exception {
String fileName = JetTestUtils.navigationMetadata("idea/testData/kotlinAndJavaChecker/KotlinAnnotations.kt");
doTest(fileName);
}
@TestMetadata("NoNotNullOnParameterInOverride.kt")
public void testNoNotNullOnParameterInOverride() throws Exception {
String fileName = JetTestUtils.navigationMetadata("idea/testData/kotlinAndJavaChecker/NoNotNullOnParameterInOverride.kt");
doTest(fileName);
}
@TestMetadata("TopLevelFunctionInDataFlowInspection.kt")
public void testTopLevelFunctionInDataFlowInspection() throws Exception {
String fileName = JetTestUtils.navigationMetadata("idea/testData/kotlinAndJavaChecker/TopLevelFunctionInDataFlowInspection.kt");
doTest(fileName);
}
@TestMetadata("UseKotlinSubclassesOfMappedTypes.kt")
public void testUseKotlinSubclassesOfMappedTypes() throws Exception {
String fileName = JetTestUtils.navigationMetadata("idea/testData/kotlinAndJavaChecker/UseKotlinSubclassesOfMappedTypes.kt");
doTest(fileName);
}
@TestMetadata("UsingKotlinPackageDeclarations.kt")
public void testUsingKotlinPackageDeclarations() throws Exception {
String fileName = JetTestUtils.navigationMetadata("idea/testData/kotlinAndJavaChecker/UsingKotlinPackageDeclarations.kt");
doTest(fileName);
}
}