Refactoring: remove ownImports method
This commit is contained in:
-6
@@ -67,10 +67,4 @@ public class DelegatingTestClassModel extends TestClassModel {
|
||||
public Collection<AnnotationModel> getAnnotations() {
|
||||
return delegate.getAnnotations();
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public Collection<Class<?>> getOwnImports() {
|
||||
return delegate.getOwnImports();
|
||||
}
|
||||
}
|
||||
|
||||
-6
@@ -236,12 +236,6 @@ public class SimpleTestClassModel extends TestClassModel {
|
||||
return annotations;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public Collection<Class<?>> getOwnImports() {
|
||||
return annotations.stream().map(AnnotationModel::getAnnotation).collect(Collectors.toSet());
|
||||
}
|
||||
|
||||
private class TestAllFilesPresentMethodModel extends TestMethodModel {
|
||||
@NotNull
|
||||
@Override
|
||||
|
||||
-6
@@ -146,12 +146,6 @@ public class SingleClassTestModel extends TestClassModel {
|
||||
return annotations;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public Collection<Class<?>> getOwnImports() {
|
||||
return annotations.stream().map(AnnotationModel::getAnnotation).collect(Collectors.toSet());
|
||||
}
|
||||
|
||||
private class TestAllFilesPresentMethodModel extends TestMethodModel {
|
||||
@NotNull
|
||||
@Override
|
||||
|
||||
+1
-4
@@ -120,10 +120,7 @@ class TestGenerator(
|
||||
override val annotations: Collection<AnnotationModel>
|
||||
get() = emptyList()
|
||||
|
||||
override val ownImports: Collection<Class<*>>
|
||||
get() = emptyList()
|
||||
|
||||
override val imports: Collection<Class<*>>
|
||||
override val imports: Set<Class<*>>
|
||||
get() = super.imports
|
||||
}
|
||||
}
|
||||
|
||||
+4
-5
@@ -24,20 +24,19 @@ interface TestEntityModel {
|
||||
}
|
||||
|
||||
interface ClassModel : TestEntityModel {
|
||||
val ownImports: Collection<Class<*>>
|
||||
val innerTestClasses: Collection<TestClassModel>
|
||||
val methods: Collection<MethodModel>
|
||||
val isEmpty: Boolean
|
||||
val dataPathRoot: String?
|
||||
val annotations: Collection<AnnotationModel>
|
||||
val imports: Collection<Class<*>>
|
||||
val imports: Set<Class<*>>
|
||||
}
|
||||
|
||||
abstract class TestClassModel : ClassModel {
|
||||
override val imports: Collection<Class<*>>
|
||||
override val imports: Set<Class<*>>
|
||||
get() {
|
||||
return mutableListOf<Class<*>>().also { allImports ->
|
||||
allImports.addAll(ownImports)
|
||||
return mutableSetOf<Class<*>>().also { allImports ->
|
||||
annotations.mapTo(allImports) { it.annotation }
|
||||
methods.flatMapTo(allImports) { it.imports() }
|
||||
innerTestClasses.flatMapTo(allImports) { it.imports }
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user