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