Make it possible to generate getTestsRoot() method with the test directory
Method can be used in setUp()
This commit is contained in:
committed by
Nikolay Krasko
parent
178aba54dd
commit
7be9699263
@@ -794,6 +794,15 @@ public class KotlinTestUtils {
|
|||||||
return testFile;
|
return testFile;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static String getTestsRoot(@NotNull TestCase testCase) {
|
||||||
|
try {
|
||||||
|
return (String) testCase.getClass().getMethod("getTestsRoot").invoke(testCase);
|
||||||
|
}
|
||||||
|
catch (Exception e) {
|
||||||
|
throw new RuntimeException("Can't call getTestsRoot() on test class", e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public static void assertAllTestsPresentByMetadata(
|
public static void assertAllTestsPresentByMetadata(
|
||||||
@NotNull Class<?> testCaseClass,
|
@NotNull Class<?> testCaseClass,
|
||||||
@NotNull File testDataDir,
|
@NotNull File testDataDir,
|
||||||
|
|||||||
@@ -1088,7 +1088,7 @@ private class TestGroup(val testsRoot: String, val testDataRoot: String) {
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
SimpleTestClassModel(rootFile, recursive, excludeParentDirs,
|
SimpleTestClassModel(rootFile, recursive, excludeParentDirs,
|
||||||
compiledPattern, filenameStartsLowerCase, testMethod, className, targetBackend, excludeDirs)
|
compiledPattern, filenameStartsLowerCase, testMethod, className, targetBackend, excludeDirs, false)
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
+3
-2
@@ -28,6 +28,7 @@ public class DelegatingTestClassModel implements TestClassModel {
|
|||||||
this.delegate = delegate;
|
this.delegate = delegate;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@NotNull
|
||||||
@Override
|
@Override
|
||||||
public String getName() {
|
public String getName() {
|
||||||
return delegate.getName();
|
return delegate.getName();
|
||||||
@@ -41,8 +42,8 @@ public class DelegatingTestClassModel implements TestClassModel {
|
|||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
@Override
|
@Override
|
||||||
public Collection<TestMethodModel> getTestMethods() {
|
public Collection<MethodModel> getMethods() {
|
||||||
return delegate.getTestMethods();
|
return delegate.getMethods();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
+47
-7
@@ -46,6 +46,7 @@ public class SimpleTestClassModel implements TestClassModel {
|
|||||||
private final Pattern filenamePattern;
|
private final Pattern filenamePattern;
|
||||||
@Nullable
|
@Nullable
|
||||||
private final Boolean checkFilenameStartsLowerCase;
|
private final Boolean checkFilenameStartsLowerCase;
|
||||||
|
private final boolean withTestRootMethod;
|
||||||
@NotNull
|
@NotNull
|
||||||
private final String doTestMethodName;
|
private final String doTestMethodName;
|
||||||
@NotNull
|
@NotNull
|
||||||
@@ -57,7 +58,7 @@ public class SimpleTestClassModel implements TestClassModel {
|
|||||||
@Nullable
|
@Nullable
|
||||||
private Collection<TestClassModel> innerTestClasses;
|
private Collection<TestClassModel> innerTestClasses;
|
||||||
@Nullable
|
@Nullable
|
||||||
private Collection<TestMethodModel> testMethods;
|
private Collection<MethodModel> testMethods;
|
||||||
|
|
||||||
public SimpleTestClassModel(
|
public SimpleTestClassModel(
|
||||||
@NotNull File rootFile,
|
@NotNull File rootFile,
|
||||||
@@ -68,7 +69,8 @@ public class SimpleTestClassModel implements TestClassModel {
|
|||||||
@NotNull String doTestMethodName,
|
@NotNull String doTestMethodName,
|
||||||
@NotNull String testClassName,
|
@NotNull String testClassName,
|
||||||
@NotNull TargetBackend targetBackend,
|
@NotNull TargetBackend targetBackend,
|
||||||
@NotNull Collection<String> excludeDirs
|
@NotNull Collection<String> excludeDirs,
|
||||||
|
boolean withTestRootMethod
|
||||||
) {
|
) {
|
||||||
this.rootFile = rootFile;
|
this.rootFile = rootFile;
|
||||||
this.recursive = recursive;
|
this.recursive = recursive;
|
||||||
@@ -78,6 +80,7 @@ public class SimpleTestClassModel implements TestClassModel {
|
|||||||
this.testClassName = testClassName;
|
this.testClassName = testClassName;
|
||||||
this.targetBackend = targetBackend;
|
this.targetBackend = targetBackend;
|
||||||
this.checkFilenameStartsLowerCase = checkFilenameStartsLowerCase;
|
this.checkFilenameStartsLowerCase = checkFilenameStartsLowerCase;
|
||||||
|
this.withTestRootMethod = withTestRootMethod;
|
||||||
this.excludeDirs = excludeDirs.isEmpty() ? Collections.<String>emptySet() : new LinkedHashSet<String>(excludeDirs);
|
this.excludeDirs = excludeDirs.isEmpty() ? Collections.<String>emptySet() : new LinkedHashSet<String>(excludeDirs);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -97,7 +100,8 @@ public class SimpleTestClassModel implements TestClassModel {
|
|||||||
String innerTestClassName = TestGeneratorUtil.fileNameToJavaIdentifier(file);
|
String innerTestClassName = TestGeneratorUtil.fileNameToJavaIdentifier(file);
|
||||||
children.add(new SimpleTestClassModel(
|
children.add(new SimpleTestClassModel(
|
||||||
file, true, excludeParentDirs, filenamePattern, checkFilenameStartsLowerCase,
|
file, true, excludeParentDirs, filenamePattern, checkFilenameStartsLowerCase,
|
||||||
doTestMethodName, innerTestClassName, targetBackend, excludesStripOneDirectory(file.getName()))
|
doTestMethodName, innerTestClassName, targetBackend, excludesStripOneDirectory(file.getName()),
|
||||||
|
withTestRootMethod)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -147,15 +151,15 @@ public class SimpleTestClassModel implements TestClassModel {
|
|||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
@Override
|
@Override
|
||||||
public Collection<TestMethodModel> getTestMethods() {
|
public Collection<MethodModel> getMethods() {
|
||||||
if (testMethods == null) {
|
if (testMethods == null) {
|
||||||
if (!rootFile.isDirectory()) {
|
if (!rootFile.isDirectory()) {
|
||||||
testMethods = Collections.<TestMethodModel>singletonList(new SimpleTestMethodModel(rootFile, rootFile, doTestMethodName,
|
testMethods = Collections.<MethodModel>singletonList(new SimpleTestMethodModel(rootFile, rootFile, doTestMethodName,
|
||||||
filenamePattern, checkFilenameStartsLowerCase,
|
filenamePattern, checkFilenameStartsLowerCase,
|
||||||
targetBackend));
|
targetBackend));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
List<TestMethodModel> result = Lists.newArrayList();
|
List<MethodModel> result = Lists.newArrayList();
|
||||||
|
|
||||||
result.add(new TestAllFilesPresentMethodModel());
|
result.add(new TestAllFilesPresentMethodModel());
|
||||||
|
|
||||||
@@ -174,6 +178,10 @@ public class SimpleTestClassModel implements TestClassModel {
|
|||||||
}
|
}
|
||||||
Collections.sort(result, BY_NAME);
|
Collections.sort(result, BY_NAME);
|
||||||
|
|
||||||
|
if (withTestRootMethod) {
|
||||||
|
result.add(new TestRootsMethodModel());
|
||||||
|
}
|
||||||
|
|
||||||
testMethods = result;
|
testMethods = result;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -182,7 +190,8 @@ public class SimpleTestClassModel implements TestClassModel {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isEmpty() {
|
public boolean isEmpty() {
|
||||||
return getTestMethods().size() == 1 && getInnerTestClasses().isEmpty();
|
boolean noTestMethods = withTestRootMethod ? getMethods().size() == 2 : getMethods().size() == 1;
|
||||||
|
return noTestMethods && getInnerTestClasses().isEmpty();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -196,12 +205,38 @@ public class SimpleTestClassModel implements TestClassModel {
|
|||||||
return "$PROJECT_ROOT";
|
return "$PROJECT_ROOT";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@NotNull
|
||||||
@Override
|
@Override
|
||||||
public String getName() {
|
public String getName() {
|
||||||
return testClassName;
|
return testClassName;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private class TestRootsMethodModel implements MethodModel {
|
||||||
|
@NotNull
|
||||||
|
@Override
|
||||||
|
public String getName() {
|
||||||
|
return "getTestsRoot";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void generateBody(@NotNull Printer p) {
|
||||||
|
p.println(String.format("return \"%s\";", KotlinTestUtils.getFilePath(rootFile)));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void generateSignature(@NotNull Printer p) {
|
||||||
|
p.print(String.format("public String %s()", getName()));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Nullable
|
||||||
|
@Override
|
||||||
|
public String getDataString() {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private class TestAllFilesPresentMethodModel implements TestMethodModel {
|
private class TestAllFilesPresentMethodModel implements TestMethodModel {
|
||||||
|
@NotNull
|
||||||
@Override
|
@Override
|
||||||
public String getName() {
|
public String getName() {
|
||||||
return "testAllFilesPresentIn" + testClassName;
|
return "testAllFilesPresentIn" + testClassName;
|
||||||
@@ -226,5 +261,10 @@ public class SimpleTestClassModel implements TestClassModel {
|
|||||||
public String getDataString() {
|
public String getDataString() {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void generateSignature(@NotNull Printer p) {
|
||||||
|
TestMethodModel.DefaultImpls.generateSignature(this, p);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+6
@@ -104,6 +104,7 @@ public class SimpleTestMethodModel implements TestMethodModel {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@NotNull
|
||||||
@Override
|
@Override
|
||||||
public String getName() {
|
public String getName() {
|
||||||
Matcher matcher = filenamePattern.matcher(file.getName());
|
Matcher matcher = filenamePattern.matcher(file.getName());
|
||||||
@@ -123,4 +124,9 @@ public class SimpleTestMethodModel implements TestMethodModel {
|
|||||||
}
|
}
|
||||||
return (isIgnored() ? "ignored" : "test") + StringUtil.capitalize(TestGeneratorUtil.escapeForJavaIdentifier(unescapedName));
|
return (isIgnored() ? "ignored" : "test") + StringUtil.capitalize(TestGeneratorUtil.escapeForJavaIdentifier(unescapedName));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void generateSignature(@NotNull Printer p) {
|
||||||
|
TestMethodModel.DefaultImpls.generateSignature(this, p);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+13
-6
@@ -49,7 +49,7 @@ public class SingleClassTestModel implements TestClassModel {
|
|||||||
@NotNull
|
@NotNull
|
||||||
private final TargetBackend targetBackend;
|
private final TargetBackend targetBackend;
|
||||||
@Nullable
|
@Nullable
|
||||||
private Collection<TestMethodModel> testMethods;
|
private Collection<MethodModel> methods;
|
||||||
|
|
||||||
public SingleClassTestModel(
|
public SingleClassTestModel(
|
||||||
@NotNull File rootFile,
|
@NotNull File rootFile,
|
||||||
@@ -75,8 +75,8 @@ public class SingleClassTestModel implements TestClassModel {
|
|||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
@Override
|
@Override
|
||||||
public Collection<TestMethodModel> getTestMethods() {
|
public Collection<MethodModel> getMethods() {
|
||||||
if (testMethods == null) {
|
if (methods == null) {
|
||||||
final List<TestMethodModel> result = Lists.newArrayList();
|
final List<TestMethodModel> result = Lists.newArrayList();
|
||||||
|
|
||||||
result.add(new TestAllFilesPresentMethodModel());
|
result.add(new TestAllFilesPresentMethodModel());
|
||||||
@@ -99,10 +99,10 @@ public class SingleClassTestModel implements TestClassModel {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
testMethods = result;
|
methods = Lists.<MethodModel>newArrayList(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
return testMethods;
|
return methods;
|
||||||
}
|
}
|
||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
@@ -115,7 +115,7 @@ public class SingleClassTestModel implements TestClassModel {
|
|||||||
@Override
|
@Override
|
||||||
public boolean isEmpty() {
|
public boolean isEmpty() {
|
||||||
// There's always one test for checking if all tests are present
|
// There's always one test for checking if all tests are present
|
||||||
return getTestMethods().size() <= 1;
|
return getMethods().size() <= 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -129,12 +129,14 @@ public class SingleClassTestModel implements TestClassModel {
|
|||||||
return "$PROJECT_ROOT";
|
return "$PROJECT_ROOT";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@NotNull
|
||||||
@Override
|
@Override
|
||||||
public String getName() {
|
public String getName() {
|
||||||
return testClassName;
|
return testClassName;
|
||||||
}
|
}
|
||||||
|
|
||||||
private class TestAllFilesPresentMethodModel implements TestMethodModel {
|
private class TestAllFilesPresentMethodModel implements TestMethodModel {
|
||||||
|
@NotNull
|
||||||
@Override
|
@Override
|
||||||
public String getName() {
|
public String getName() {
|
||||||
return "testAllFilesPresentIn" + testClassName;
|
return "testAllFilesPresentIn" + testClassName;
|
||||||
@@ -153,5 +155,10 @@ public class SingleClassTestModel implements TestClassModel {
|
|||||||
public String getDataString() {
|
public String getDataString() {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void generateSignature(@NotNull Printer p) {
|
||||||
|
TestMethodModel.DefaultImpls.generateSignature(this, p);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,36 +0,0 @@
|
|||||||
/*
|
|
||||||
* 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.generators.tests.generator;
|
|
||||||
|
|
||||||
import org.jetbrains.annotations.NotNull;
|
|
||||||
import org.jetbrains.annotations.Nullable;
|
|
||||||
|
|
||||||
import java.util.Collection;
|
|
||||||
|
|
||||||
public interface TestClassModel extends TestEntityModel {
|
|
||||||
|
|
||||||
@NotNull
|
|
||||||
Collection<TestClassModel> getInnerTestClasses();
|
|
||||||
|
|
||||||
@NotNull
|
|
||||||
Collection<TestMethodModel> getTestMethods();
|
|
||||||
|
|
||||||
boolean isEmpty();
|
|
||||||
|
|
||||||
@Nullable
|
|
||||||
String getDataPathRoot();
|
|
||||||
}
|
|
||||||
@@ -1,26 +0,0 @@
|
|||||||
/*
|
|
||||||
* 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.generators.tests.generator;
|
|
||||||
|
|
||||||
import org.jetbrains.annotations.Nullable;
|
|
||||||
|
|
||||||
public interface TestEntityModel {
|
|
||||||
String getName();
|
|
||||||
|
|
||||||
@Nullable
|
|
||||||
String getDataString();
|
|
||||||
}
|
|
||||||
@@ -102,6 +102,7 @@ public class TestGenerator {
|
|||||||
TestClassModel model;
|
TestClassModel model;
|
||||||
if (testClassModels.size() == 1) {
|
if (testClassModels.size() == 1) {
|
||||||
model = new DelegatingTestClassModel(single(testClassModels)) {
|
model = new DelegatingTestClassModel(single(testClassModels)) {
|
||||||
|
@NotNull
|
||||||
@Override
|
@Override
|
||||||
public String getName() {
|
public String getName() {
|
||||||
return suiteClassName;
|
return suiteClassName;
|
||||||
@@ -118,7 +119,7 @@ public class TestGenerator {
|
|||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
@Override
|
@Override
|
||||||
public Collection<TestMethodModel> getTestMethods() {
|
public Collection<MethodModel> getMethods() {
|
||||||
return Collections.emptyList();
|
return Collections.emptyList();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -127,6 +128,7 @@ public class TestGenerator {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@NotNull
|
||||||
@Override
|
@Override
|
||||||
public String getName() {
|
public String getName() {
|
||||||
return suiteClassName;
|
return suiteClassName;
|
||||||
@@ -161,12 +163,12 @@ public class TestGenerator {
|
|||||||
p.println("public " + staticModifier + "class ", testClassModel.getName(), " extends ", baseTestClassName, " {");
|
p.println("public " + staticModifier + "class ", testClassModel.getName(), " extends ", baseTestClassName, " {");
|
||||||
p.pushIndent();
|
p.pushIndent();
|
||||||
|
|
||||||
Collection<TestMethodModel> testMethods = testClassModel.getTestMethods();
|
Collection<MethodModel> testMethods = testClassModel.getMethods();
|
||||||
Collection<TestClassModel> innerTestClasses = testClassModel.getInnerTestClasses();
|
Collection<TestClassModel> innerTestClasses = testClassModel.getInnerTestClasses();
|
||||||
|
|
||||||
for (Iterator<TestMethodModel> iterator = testMethods.iterator(); iterator.hasNext(); ) {
|
for (Iterator<MethodModel> iterator = testMethods.iterator(); iterator.hasNext(); ) {
|
||||||
TestMethodModel testMethodModel = iterator.next();
|
MethodModel methodModel = iterator.next();
|
||||||
generateTestMethod(p, testMethodModel);
|
generateTestMethod(p, methodModel);
|
||||||
if (iterator.hasNext() || !innerTestClasses.isEmpty()) {
|
if (iterator.hasNext() || !innerTestClasses.isEmpty()) {
|
||||||
p.println();
|
p.println();
|
||||||
}
|
}
|
||||||
@@ -186,12 +188,16 @@ public class TestGenerator {
|
|||||||
p.println("}");
|
p.println("}");
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void generateTestMethod(Printer p, TestMethodModel testMethodModel) {
|
private static void generateTestMethod(Printer p, MethodModel methodModel) {
|
||||||
generateMetadata(p, testMethodModel);
|
generateMetadata(p, methodModel);
|
||||||
p.println("public void ", testMethodModel.getName(), "() throws Exception {");
|
|
||||||
|
methodModel.generateSignature(p);
|
||||||
|
p.printWithNoIndent(" {");
|
||||||
|
p.println();
|
||||||
|
|
||||||
p.pushIndent();
|
p.pushIndent();
|
||||||
|
|
||||||
testMethodModel.generateBody(p);
|
methodModel.generateBody(p);
|
||||||
|
|
||||||
p.popIndent();
|
p.popIndent();
|
||||||
p.println("}");
|
p.println("}");
|
||||||
|
|||||||
@@ -1,24 +0,0 @@
|
|||||||
/*
|
|
||||||
* 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.generators.tests.generator;
|
|
||||||
|
|
||||||
import org.jetbrains.annotations.NotNull;
|
|
||||||
import org.jetbrains.kotlin.utils.Printer;
|
|
||||||
|
|
||||||
public interface TestMethodModel extends TestEntityModel {
|
|
||||||
void generateBody(@NotNull Printer p);
|
|
||||||
}
|
|
||||||
@@ -0,0 +1,42 @@
|
|||||||
|
/*
|
||||||
|
* 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.generators.tests.generator
|
||||||
|
|
||||||
|
import org.jetbrains.kotlin.utils.Printer
|
||||||
|
|
||||||
|
interface TestEntityModel {
|
||||||
|
val name: String
|
||||||
|
val dataString: String?
|
||||||
|
}
|
||||||
|
|
||||||
|
interface TestClassModel : TestEntityModel {
|
||||||
|
val innerTestClasses: Collection<TestClassModel>
|
||||||
|
val methods: Collection<MethodModel>
|
||||||
|
val isEmpty: Boolean
|
||||||
|
val dataPathRoot: String?
|
||||||
|
}
|
||||||
|
|
||||||
|
interface MethodModel : TestEntityModel {
|
||||||
|
fun generateSignature(p: Printer)
|
||||||
|
fun generateBody(p: Printer)
|
||||||
|
}
|
||||||
|
|
||||||
|
interface TestMethodModel : MethodModel {
|
||||||
|
override fun generateSignature(p: Printer) {
|
||||||
|
p.print("public void $name() throws Exception")
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user