From ebf19b733f751bada225c8f0068dc9b55cd0edac Mon Sep 17 00:00:00 2001 From: Andrey Breslav Date: Tue, 10 Jul 2012 14:11:25 +0400 Subject: [PATCH] ReadJavaBinaryClassTest updated - new generator used - generator code moved to the abstract class --- .../AbstractReadJavaBinaryClassTest.java | 20 + .../ReadJavaBinaryClassTestGenerated.java | 480 +++++++++++------- .../ReadJavaBinaryClassTestGenerator.java | 46 -- 3 files changed, 318 insertions(+), 228 deletions(-) delete mode 100644 compiler/tests/org/jetbrains/jet/jvm/compiler/ReadJavaBinaryClassTestGenerator.java diff --git a/compiler/tests/org/jetbrains/jet/jvm/compiler/AbstractReadJavaBinaryClassTest.java b/compiler/tests/org/jetbrains/jet/jvm/compiler/AbstractReadJavaBinaryClassTest.java index d0c88cb1121..cf32aab1ca9 100644 --- a/compiler/tests/org/jetbrains/jet/jvm/compiler/AbstractReadJavaBinaryClassTest.java +++ b/compiler/tests/org/jetbrains/jet/jvm/compiler/AbstractReadJavaBinaryClassTest.java @@ -38,10 +38,13 @@ import org.jetbrains.jet.lang.resolve.name.FqName; import org.jetbrains.jet.lang.resolve.name.Name; import org.jetbrains.jet.plugin.JetLanguage; import org.jetbrains.jet.test.TestCaseWithTmpdir; +import org.jetbrains.jet.test.generator.SimpleTestClassModel; +import org.jetbrains.jet.test.generator.TestGenerator; import org.junit.Assert; import javax.tools.*; import java.io.File; +import java.io.IOException; import java.nio.charset.Charset; import java.util.Arrays; import java.util.Collections; @@ -105,4 +108,21 @@ public abstract class AbstractReadJavaBinaryClassTest extends TestCaseWithTmpdir JavaDescriptorResolver javaDescriptorResolver = injector.getJavaDescriptorResolver(); return javaDescriptorResolver.resolveNamespace(FqName.topLevel(Name.identifier("test")), DescriptorSearchRule.ERROR_IF_FOUND_IN_KOTLIN); } + + public static void main(String[] args) throws IOException { + String aPackage = "org.jetbrains.jet.jvm.compiler"; + String extension = "java"; + new TestGenerator( + "compiler/tests/", + aPackage, + "ReadJavaBinaryClassTestGenerated", + aPackage, + "AbstractReadJavaBinaryClassTest", + Arrays.asList( + new SimpleTestClassModel(new File("compiler/testData/readJavaBinaryClass"), true, extension, "doTest") + ), + AbstractReadJavaBinaryClassTest.class.getName(), + TestGenerator.TargetTestFrameworks.JUNIT_3 + ).generateAndSave(); + } } diff --git a/compiler/tests/org/jetbrains/jet/jvm/compiler/ReadJavaBinaryClassTestGenerated.java b/compiler/tests/org/jetbrains/jet/jvm/compiler/ReadJavaBinaryClassTestGenerated.java index 04ce61b715e..478be32fa96 100644 --- a/compiler/tests/org/jetbrains/jet/jvm/compiler/ReadJavaBinaryClassTestGenerated.java +++ b/compiler/tests/org/jetbrains/jet/jvm/compiler/ReadJavaBinaryClassTestGenerated.java @@ -15,304 +15,420 @@ */ package org.jetbrains.jet.jvm.compiler; -import junit.framework.Assert; import junit.framework.Test; import junit.framework.TestSuite; +import org.jetbrains.jet.JetTestUtils; +import org.jetbrains.jet.test.TestMetadata; import java.io.File; -import java.lang.reflect.Method; -import java.util.HashSet; -import java.util.Set; -/* This class is generated by org.jetbrains.jet.jvm.compiler.ReadJavaBinaryClassTestGenerator. DO NOT MODIFY MANUALLY */ -public class ReadJavaBinaryClassTestGenerated { - public static class ReadJavaBinaryClass extends AbstractReadJavaBinaryClassTest { - public void testAllFilesPresentInReadJavaBinaryClass() throws Exception { - allTestsPresent(ReadJavaBinaryClass.class, new File("compiler/testData/readJavaBinaryClass"), true); +/* This class is generated by org.jetbrains.jet.jvm.compiler.AbstractReadJavaBinaryClassTest. DO NOT MODIFY MANUALLY */ +@TestMetadata("compiler/testData/readJavaBinaryClass") +public class ReadJavaBinaryClassTestGenerated extends AbstractReadJavaBinaryClassTest { + public void testAllFilesPresentInReadJavaBinaryClass() throws Exception { + JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), "org.jetbrains.jet.jvm.compiler.AbstractReadJavaBinaryClassTest", new File("compiler/testData/readJavaBinaryClass"), "java", false); + } + + @TestMetadata("ClassDoesNotOverrideMethod.java") + public void testClassDoesNotOverrideMethod() throws Exception { + doTest("compiler/testData/readJavaBinaryClass/ClassDoesNotOverrideMethod.java"); + } + + @TestMetadata("ClassWithTypeP.java") + public void testClassWithTypeP() throws Exception { + doTest("compiler/testData/readJavaBinaryClass/ClassWithTypeP.java"); + } + + @TestMetadata("ClassWithTypePExtendsIterableP.java") + public void testClassWithTypePExtendsIterableP() throws Exception { + doTest("compiler/testData/readJavaBinaryClass/ClassWithTypePExtendsIterableP.java"); + } + + @TestMetadata("ClassWithTypePP.java") + public void testClassWithTypePP() throws Exception { + doTest("compiler/testData/readJavaBinaryClass/ClassWithTypePP.java"); + } + + @TestMetadata("ClassWithTypePRefNext.java") + public void testClassWithTypePRefNext() throws Exception { + doTest("compiler/testData/readJavaBinaryClass/ClassWithTypePRefNext.java"); + } + + @TestMetadata("ClassWithTypePRefSelf.java") + public void testClassWithTypePRefSelf() throws Exception { + doTest("compiler/testData/readJavaBinaryClass/ClassWithTypePRefSelf.java"); + } + + @TestMetadata("FieldAsVar.java") + public void testFieldAsVar() throws Exception { + doTest("compiler/testData/readJavaBinaryClass/FieldAsVar.java"); + } + + @TestMetadata("FieldOfArrayType.java") + public void testFieldOfArrayType() throws Exception { + doTest("compiler/testData/readJavaBinaryClass/FieldOfArrayType.java"); + } + + @TestMetadata("FinalFieldAsVal.java") + public void testFinalFieldAsVal() throws Exception { + doTest("compiler/testData/readJavaBinaryClass/FinalFieldAsVal.java"); + } + + @TestMetadata("InnerClass.java") + public void testInnerClass() throws Exception { + doTest("compiler/testData/readJavaBinaryClass/InnerClass.java"); + } + + @TestMetadata("InnerClassesInGeneric.java") + public void testInnerClassesInGeneric() throws Exception { + doTest("compiler/testData/readJavaBinaryClass/InnerClassesInGeneric.java"); + } + + @TestMetadata("InnerClassReferencesOuterTP.java") + public void testInnerClassReferencesOuterTP() throws Exception { + doTest("compiler/testData/readJavaBinaryClass/InnerClassReferencesOuterTP.java"); + } + + @TestMetadata("MethodReferencesOuterClassTP.java") + public void testMethodReferencesOuterClassTP() throws Exception { + doTest("compiler/testData/readJavaBinaryClass/MethodReferencesOuterClassTP.java"); + } + + @TestMetadata("MethodTypePOneUpperBound.java") + public void testMethodTypePOneUpperBound() throws Exception { + doTest("compiler/testData/readJavaBinaryClass/MethodTypePOneUpperBound.java"); + } + + @TestMetadata("MethodTypePTwoUpperBounds.java") + public void testMethodTypePTwoUpperBounds() throws Exception { + doTest("compiler/testData/readJavaBinaryClass/MethodTypePTwoUpperBounds.java"); + } + + @TestMetadata("MethodWithTypeP.java") + public void testMethodWithTypeP() throws Exception { + doTest("compiler/testData/readJavaBinaryClass/MethodWithTypeP.java"); + } + + @TestMetadata("MethodWithTypePP.java") + public void testMethodWithTypePP() throws Exception { + doTest("compiler/testData/readJavaBinaryClass/MethodWithTypePP.java"); + } + + @TestMetadata("MethodWithTypePRefClassP.java") + public void testMethodWithTypePRefClassP() throws Exception { + doTest("compiler/testData/readJavaBinaryClass/MethodWithTypePRefClassP.java"); + } + + @TestMetadata("MethosWithPRefTP.java") + public void testMethosWithPRefTP() throws Exception { + doTest("compiler/testData/readJavaBinaryClass/MethosWithPRefTP.java"); + } + + @TestMetadata("MyException.java") + public void testMyException() throws Exception { + doTest("compiler/testData/readJavaBinaryClass/MyException.java"); + } + + @TestMetadata("Simple.java") + public void testSimple() throws Exception { + doTest("compiler/testData/readJavaBinaryClass/Simple.java"); + } + + @TestMetadata("TwoFields.java") + public void testTwoFields() throws Exception { + doTest("compiler/testData/readJavaBinaryClass/TwoFields.java"); + } + + @TestMetadata("compiler/testData/readJavaBinaryClass/annotation") + public static class Annotation extends AbstractReadJavaBinaryClassTest { + public void testAllFilesPresentInAnnotation() throws Exception { + JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), "org.jetbrains.jet.jvm.compiler.AbstractReadJavaBinaryClassTest", new File("compiler/testData/readJavaBinaryClass/annotation"), "java", false); } + @TestMetadata("AnnotatedAnnotation.java") public void testAnnotatedAnnotation() throws Exception { doTest("compiler/testData/readJavaBinaryClass/annotation/AnnotatedAnnotation.java"); } + @TestMetadata("AnnotatedMethod.java") public void testAnnotatedMethod() throws Exception { doTest("compiler/testData/readJavaBinaryClass/annotation/AnnotatedMethod.java"); } + @TestMetadata("SimpleAnnotation.java") public void testSimpleAnnotation() throws Exception { doTest("compiler/testData/readJavaBinaryClass/annotation/SimpleAnnotation.java"); } - public void testClassDoesNotOverrideMethod() throws Exception { - doTest("compiler/testData/readJavaBinaryClass/ClassDoesNotOverrideMethod.java"); - } - - public void testClassWithTypeP() throws Exception { - doTest("compiler/testData/readJavaBinaryClass/ClassWithTypeP.java"); - } - - public void testClassWithTypePExtendsIterableP() throws Exception { - doTest("compiler/testData/readJavaBinaryClass/ClassWithTypePExtendsIterableP.java"); - } - - public void testClassWithTypePP() throws Exception { - doTest("compiler/testData/readJavaBinaryClass/ClassWithTypePP.java"); - } - - public void testClassWithTypePRefNext() throws Exception { - doTest("compiler/testData/readJavaBinaryClass/ClassWithTypePRefNext.java"); - } - - public void testClassWithTypePRefSelf() throws Exception { - doTest("compiler/testData/readJavaBinaryClass/ClassWithTypePRefSelf.java"); + } + + @TestMetadata("compiler/testData/readJavaBinaryClass/constructor") + public static class Constructor extends AbstractReadJavaBinaryClassTest { + public void testAllFilesPresentInConstructor() throws Exception { + JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), "org.jetbrains.jet.jvm.compiler.AbstractReadJavaBinaryClassTest", new File("compiler/testData/readJavaBinaryClass/constructor"), "java", false); } + @TestMetadata("ConstructorGenericDeep.java") public void testConstructorGenericDeep() throws Exception { doTest("compiler/testData/readJavaBinaryClass/constructor/ConstructorGenericDeep.java"); } + @TestMetadata("ConstructorGenericSimple.java") public void testConstructorGenericSimple() throws Exception { doTest("compiler/testData/readJavaBinaryClass/constructor/ConstructorGenericSimple.java"); } + @TestMetadata("ConstructorGenericUpperBound.java") public void testConstructorGenericUpperBound() throws Exception { doTest("compiler/testData/readJavaBinaryClass/constructor/ConstructorGenericUpperBound.java"); } - public void testFieldAsVar() throws Exception { - doTest("compiler/testData/readJavaBinaryClass/FieldAsVar.java"); - } - - public void testFieldOfArrayType() throws Exception { - doTest("compiler/testData/readJavaBinaryClass/FieldOfArrayType.java"); - } - - public void testFinalFieldAsVal() throws Exception { - doTest("compiler/testData/readJavaBinaryClass/FinalFieldAsVal.java"); - } - - public void testInnerClass() throws Exception { - doTest("compiler/testData/readJavaBinaryClass/InnerClass.java"); - } - - public void testInnerClassesInGeneric() throws Exception { - doTest("compiler/testData/readJavaBinaryClass/InnerClassesInGeneric.java"); - } - - public void testInnerClassReferencesOuterTP() throws Exception { - doTest("compiler/testData/readJavaBinaryClass/InnerClassReferencesOuterTP.java"); + } + + @TestMetadata("compiler/testData/readJavaBinaryClass/javaBean") + public static class JavaBean extends AbstractReadJavaBinaryClassTest { + public void testAllFilesPresentInJavaBean() throws Exception { + JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), "org.jetbrains.jet.jvm.compiler.AbstractReadJavaBinaryClassTest", new File("compiler/testData/readJavaBinaryClass/javaBean"), "java", false); } + @TestMetadata("DifferentGetterAndSetter.java") public void testDifferentGetterAndSetter() throws Exception { doTest("compiler/testData/readJavaBinaryClass/javaBean/DifferentGetterAndSetter.java"); } + @TestMetadata("JavaBeanAbstractGetter.java") public void testJavaBeanAbstractGetter() throws Exception { doTest("compiler/testData/readJavaBinaryClass/javaBean/JavaBeanAbstractGetter.java"); } + @TestMetadata("JavaBeanVal.java") public void testJavaBeanVal() throws Exception { doTest("compiler/testData/readJavaBinaryClass/javaBean/JavaBeanVal.java"); } + @TestMetadata("JavaBeanVar.java") public void testJavaBeanVar() throws Exception { doTest("compiler/testData/readJavaBinaryClass/javaBean/JavaBeanVar.java"); } + @TestMetadata("JavaBeanVarOfGenericType.java") public void testJavaBeanVarOfGenericType() throws Exception { doTest("compiler/testData/readJavaBinaryClass/javaBean/JavaBeanVarOfGenericType.java"); } + @TestMetadata("TwoSetters.java") public void testTwoSetters() throws Exception { doTest("compiler/testData/readJavaBinaryClass/javaBean/TwoSetters.java"); } - public void testAddingNullability() throws Exception { - doTest("compiler/testData/readJavaBinaryClass/kotlinSignature/error/AddingNullability.java"); - } - - public void testExtraUpperBound() throws Exception { - doTest("compiler/testData/readJavaBinaryClass/kotlinSignature/error/ExtraUpperBound.java"); - } - - public void testMissingUpperBound() throws Exception { - doTest("compiler/testData/readJavaBinaryClass/kotlinSignature/error/MissingUpperBound.java"); - } - - public void testNotVarargReplacedWithVararg() throws Exception { - doTest("compiler/testData/readJavaBinaryClass/kotlinSignature/error/NotVarargReplacedWithVararg.java"); - } - - public void testReturnTypeMissing() throws Exception { - doTest("compiler/testData/readJavaBinaryClass/kotlinSignature/error/ReturnTypeMissing.java"); - } - - public void testSyntaxError() throws Exception { - doTest("compiler/testData/readJavaBinaryClass/kotlinSignature/error/SyntaxError.java"); - } - - public void testVarargReplacedWithNotVararg() throws Exception { - doTest("compiler/testData/readJavaBinaryClass/kotlinSignature/error/VarargReplacedWithNotVararg.java"); - } - - public void testWrongMethodName() throws Exception { - doTest("compiler/testData/readJavaBinaryClass/kotlinSignature/error/WrongMethodName.java"); - } - - public void testWrongReturnTypeStructure() throws Exception { - doTest("compiler/testData/readJavaBinaryClass/kotlinSignature/error/WrongReturnTypeStructure.java"); - } - - public void testWrongTypeName1() throws Exception { - doTest("compiler/testData/readJavaBinaryClass/kotlinSignature/error/WrongTypeName1.java"); - } - - public void testWrongTypeName2() throws Exception { - doTest("compiler/testData/readJavaBinaryClass/kotlinSignature/error/WrongTypeName2.java"); - } - - public void testWrongTypeName3() throws Exception { - doTest("compiler/testData/readJavaBinaryClass/kotlinSignature/error/WrongTypeName3.java"); - } - - public void testWrongTypeParameterBoundStructure1() throws Exception { - doTest("compiler/testData/readJavaBinaryClass/kotlinSignature/error/WrongTypeParameterBoundStructure1.java"); - } - - public void testWrongTypeParameterBoundStructure2() throws Exception { - doTest("compiler/testData/readJavaBinaryClass/kotlinSignature/error/WrongTypeParameterBoundStructure2.java"); - } - - public void testWrongTypeParametersCount() throws Exception { - doTest("compiler/testData/readJavaBinaryClass/kotlinSignature/error/WrongTypeParametersCount.java"); - } - - public void testWrongTypeVariance() throws Exception { - doTest("compiler/testData/readJavaBinaryClass/kotlinSignature/error/WrongTypeVariance.java"); - } - - public void testWrongValueParametersCount() throws Exception { - doTest("compiler/testData/readJavaBinaryClass/kotlinSignature/error/WrongValueParametersCount.java"); - } - - public void testWrongValueParameterStructure1() throws Exception { - doTest("compiler/testData/readJavaBinaryClass/kotlinSignature/error/WrongValueParameterStructure1.java"); - } - - public void testWrongValueParameterStructure2() throws Exception { - doTest("compiler/testData/readJavaBinaryClass/kotlinSignature/error/WrongValueParameterStructure2.java"); + } + + @TestMetadata("compiler/testData/readJavaBinaryClass/kotlinSignature") + public static class KotlinSignature extends AbstractReadJavaBinaryClassTest { + public void testAllFilesPresentInKotlinSignature() throws Exception { + JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), "org.jetbrains.jet.jvm.compiler.AbstractReadJavaBinaryClassTest", new File("compiler/testData/readJavaBinaryClass/kotlinSignature"), "java", false); } + @TestMetadata("MethodWithFunctionTypes.java") public void testMethodWithFunctionTypes() throws Exception { doTest("compiler/testData/readJavaBinaryClass/kotlinSignature/MethodWithFunctionTypes.java"); } + @TestMetadata("MethodWithGenerics.java") public void testMethodWithGenerics() throws Exception { doTest("compiler/testData/readJavaBinaryClass/kotlinSignature/MethodWithGenerics.java"); } + @TestMetadata("MethodWithTupleType.java") public void testMethodWithTupleType() throws Exception { doTest("compiler/testData/readJavaBinaryClass/kotlinSignature/MethodWithTupleType.java"); } + @TestMetadata("MethodWithTypeParameters.java") public void testMethodWithTypeParameters() throws Exception { doTest("compiler/testData/readJavaBinaryClass/kotlinSignature/MethodWithTypeParameters.java"); } + @TestMetadata("MethodWithVararg.java") public void testMethodWithVararg() throws Exception { doTest("compiler/testData/readJavaBinaryClass/kotlinSignature/MethodWithVararg.java"); } - public void testMethodReferencesOuterClassTP() throws Exception { - doTest("compiler/testData/readJavaBinaryClass/MethodReferencesOuterClassTP.java"); + @TestMetadata("compiler/testData/readJavaBinaryClass/kotlinSignature/error") + public static class Error extends AbstractReadJavaBinaryClassTest { + public void testAllFilesPresentInError() throws Exception { + JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), "org.jetbrains.jet.jvm.compiler.AbstractReadJavaBinaryClassTest", new File("compiler/testData/readJavaBinaryClass/kotlinSignature/error"), "java", false); + } + + @TestMetadata("AddingNullability.java") + public void testAddingNullability() throws Exception { + doTest("compiler/testData/readJavaBinaryClass/kotlinSignature/error/AddingNullability.java"); + } + + @TestMetadata("ExtraUpperBound.java") + public void testExtraUpperBound() throws Exception { + doTest("compiler/testData/readJavaBinaryClass/kotlinSignature/error/ExtraUpperBound.java"); + } + + @TestMetadata("MissingUpperBound.java") + public void testMissingUpperBound() throws Exception { + doTest("compiler/testData/readJavaBinaryClass/kotlinSignature/error/MissingUpperBound.java"); + } + + @TestMetadata("NotVarargReplacedWithVararg.java") + public void testNotVarargReplacedWithVararg() throws Exception { + doTest("compiler/testData/readJavaBinaryClass/kotlinSignature/error/NotVarargReplacedWithVararg.java"); + } + + @TestMetadata("ReturnTypeMissing.java") + public void testReturnTypeMissing() throws Exception { + doTest("compiler/testData/readJavaBinaryClass/kotlinSignature/error/ReturnTypeMissing.java"); + } + + @TestMetadata("SyntaxError.java") + public void testSyntaxError() throws Exception { + doTest("compiler/testData/readJavaBinaryClass/kotlinSignature/error/SyntaxError.java"); + } + + @TestMetadata("VarargReplacedWithNotVararg.java") + public void testVarargReplacedWithNotVararg() throws Exception { + doTest("compiler/testData/readJavaBinaryClass/kotlinSignature/error/VarargReplacedWithNotVararg.java"); + } + + @TestMetadata("WrongMethodName.java") + public void testWrongMethodName() throws Exception { + doTest("compiler/testData/readJavaBinaryClass/kotlinSignature/error/WrongMethodName.java"); + } + + @TestMetadata("WrongReturnTypeStructure.java") + public void testWrongReturnTypeStructure() throws Exception { + doTest("compiler/testData/readJavaBinaryClass/kotlinSignature/error/WrongReturnTypeStructure.java"); + } + + @TestMetadata("WrongTypeName1.java") + public void testWrongTypeName1() throws Exception { + doTest("compiler/testData/readJavaBinaryClass/kotlinSignature/error/WrongTypeName1.java"); + } + + @TestMetadata("WrongTypeName2.java") + public void testWrongTypeName2() throws Exception { + doTest("compiler/testData/readJavaBinaryClass/kotlinSignature/error/WrongTypeName2.java"); + } + + @TestMetadata("WrongTypeName3.java") + public void testWrongTypeName3() throws Exception { + doTest("compiler/testData/readJavaBinaryClass/kotlinSignature/error/WrongTypeName3.java"); + } + + @TestMetadata("WrongTypeParameterBoundStructure1.java") + public void testWrongTypeParameterBoundStructure1() throws Exception { + doTest("compiler/testData/readJavaBinaryClass/kotlinSignature/error/WrongTypeParameterBoundStructure1.java"); + } + + @TestMetadata("WrongTypeParameterBoundStructure2.java") + public void testWrongTypeParameterBoundStructure2() throws Exception { + doTest("compiler/testData/readJavaBinaryClass/kotlinSignature/error/WrongTypeParameterBoundStructure2.java"); + } + + @TestMetadata("WrongTypeParametersCount.java") + public void testWrongTypeParametersCount() throws Exception { + doTest("compiler/testData/readJavaBinaryClass/kotlinSignature/error/WrongTypeParametersCount.java"); + } + + @TestMetadata("WrongTypeVariance.java") + public void testWrongTypeVariance() throws Exception { + doTest("compiler/testData/readJavaBinaryClass/kotlinSignature/error/WrongTypeVariance.java"); + } + + @TestMetadata("WrongValueParametersCount.java") + public void testWrongValueParametersCount() throws Exception { + doTest("compiler/testData/readJavaBinaryClass/kotlinSignature/error/WrongValueParametersCount.java"); + } + + @TestMetadata("WrongValueParameterStructure1.java") + public void testWrongValueParameterStructure1() throws Exception { + doTest("compiler/testData/readJavaBinaryClass/kotlinSignature/error/WrongValueParameterStructure1.java"); + } + + @TestMetadata("WrongValueParameterStructure2.java") + public void testWrongValueParameterStructure2() throws Exception { + doTest("compiler/testData/readJavaBinaryClass/kotlinSignature/error/WrongValueParameterStructure2.java"); + } + } - public void testMethodTypePOneUpperBound() throws Exception { - doTest("compiler/testData/readJavaBinaryClass/MethodTypePOneUpperBound.java"); - } - - public void testMethodTypePTwoUpperBounds() throws Exception { - doTest("compiler/testData/readJavaBinaryClass/MethodTypePTwoUpperBounds.java"); - } - - public void testMethodWithTypeP() throws Exception { - doTest("compiler/testData/readJavaBinaryClass/MethodWithTypeP.java"); - } - - public void testMethodWithTypePP() throws Exception { - doTest("compiler/testData/readJavaBinaryClass/MethodWithTypePP.java"); - } - - public void testMethodWithTypePRefClassP() throws Exception { - doTest("compiler/testData/readJavaBinaryClass/MethodWithTypePRefClassP.java"); - } - - public void testMethosWithPRefTP() throws Exception { - doTest("compiler/testData/readJavaBinaryClass/MethosWithPRefTP.java"); + public static Test suite() { + TestSuite suite = new TestSuite("KotlinSignature"); + suite.addTestSuite(KotlinSignature.class); + suite.addTestSuite(Error.class); + return suite; + } + } + + @TestMetadata("compiler/testData/readJavaBinaryClass/modality") + public static class Modality extends AbstractReadJavaBinaryClassTest { + public void testAllFilesPresentInModality() throws Exception { + JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), "org.jetbrains.jet.jvm.compiler.AbstractReadJavaBinaryClassTest", new File("compiler/testData/readJavaBinaryClass/modality"), "java", false); } + @TestMetadata("ModalityOfFakeOverrides.java") public void testModalityOfFakeOverrides() throws Exception { doTest("compiler/testData/readJavaBinaryClass/modality/ModalityOfFakeOverrides.java"); } - public void testMyException() throws Exception { - doTest("compiler/testData/readJavaBinaryClass/MyException.java"); + } + + @TestMetadata("compiler/testData/readJavaBinaryClass/notNull") + public static class NotNull extends AbstractReadJavaBinaryClassTest { + public void testAllFilesPresentInNotNull() throws Exception { + JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), "org.jetbrains.jet.jvm.compiler.AbstractReadJavaBinaryClassTest", new File("compiler/testData/readJavaBinaryClass/notNull"), "java", false); } + @TestMetadata("NotNullField.java") public void testNotNullField() throws Exception { doTest("compiler/testData/readJavaBinaryClass/notNull/NotNullField.java"); } + @TestMetadata("NotNullMethod.java") public void testNotNullMethod() throws Exception { doTest("compiler/testData/readJavaBinaryClass/notNull/NotNullMethod.java"); } + @TestMetadata("NotNullParameter.java") public void testNotNullParameter() throws Exception { doTest("compiler/testData/readJavaBinaryClass/notNull/NotNullParameter.java"); } - public void testSimple() throws Exception { - doTest("compiler/testData/readJavaBinaryClass/Simple.java"); - } - - public void testTwoFields() throws Exception { - doTest("compiler/testData/readJavaBinaryClass/TwoFields.java"); + } + + @TestMetadata("compiler/testData/readJavaBinaryClass/vararg") + public static class Vararg extends AbstractReadJavaBinaryClassTest { + public void testAllFilesPresentInVararg() throws Exception { + JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), "org.jetbrains.jet.jvm.compiler.AbstractReadJavaBinaryClassTest", new File("compiler/testData/readJavaBinaryClass/vararg"), "java", false); } + @TestMetadata("VarargInt.java") public void testVarargInt() throws Exception { doTest("compiler/testData/readJavaBinaryClass/vararg/VarargInt.java"); } + @TestMetadata("VarargString.java") public void testVarargString() throws Exception { doTest("compiler/testData/readJavaBinaryClass/vararg/VarargString.java"); } - public static void allTestsPresent(Class clazz, File testDataDir, boolean recursive) { - Set methodNames = new HashSet(); - for (Method method : clazz.getDeclaredMethods()) { - if (method.getName().startsWith("test")) { - methodNames.add(method.getName().toLowerCase() + ".java"); - } - } - for (File file : testDataDir.listFiles()) { - if (file.isDirectory()) { - if (recursive) { - allTestsPresent(clazz, file, recursive); - } - } - else { - String name = file.getName(); - if (name.endsWith(".java") && !methodNames.contains("test" + name.toLowerCase())) { - Assert.fail("Test data file missing from the generated test class: " + file + "\nPlease re-run the generator: org.jetbrains.jet.jvm.compiler.ReadJavaBinaryClassTestGenerator"); - } - } - } - } } public static Test suite() { - TestSuite suite = new TestSuite(); - suite.addTestSuite(ReadJavaBinaryClass.class); + TestSuite suite = new TestSuite("ReadJavaBinaryClassTestGenerated"); + suite.addTestSuite(ReadJavaBinaryClassTestGenerated.class); + suite.addTestSuite(Annotation.class); + suite.addTestSuite(Constructor.class); + suite.addTestSuite(JavaBean.class); + suite.addTest(KotlinSignature.suite()); + suite.addTestSuite(Modality.class); + suite.addTestSuite(NotNull.class); + suite.addTestSuite(Vararg.class); return suite; } } diff --git a/compiler/tests/org/jetbrains/jet/jvm/compiler/ReadJavaBinaryClassTestGenerator.java b/compiler/tests/org/jetbrains/jet/jvm/compiler/ReadJavaBinaryClassTestGenerator.java deleted file mode 100644 index 55bca1e6913..00000000000 --- a/compiler/tests/org/jetbrains/jet/jvm/compiler/ReadJavaBinaryClassTestGenerator.java +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Copyright 2010-2012 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.jet.jvm.compiler; - -import org.jetbrains.jet.test.generator.SimpleTestClassModel; -import org.jetbrains.jet.test.generator.TestGenerator; - -import java.io.File; -import java.io.IOException; -import java.util.Arrays; - -/** - * @author abreslav - */ -public class ReadJavaBinaryClassTestGenerator { - public static void main(String[] args) throws IOException { - String aPackage = "org.jetbrains.jet.jvm.compiler"; - String extension = "java"; - new TestGenerator( - "compiler/tests/", - aPackage, - "ReadJavaBinaryClassTestGenerated", - aPackage, - "AbstractReadJavaBinaryClassTest", - Arrays.asList( - new SimpleTestClassModel(new File("compiler/testData/readJavaBinaryClass"), true, extension, "doTest") - ), - ReadJavaBinaryClassTestGenerator.class.getName(), - TestGenerator.TargetTestFrameworks.JUNIT_3 - ).generateAndSave(); - } -}