Skip to content

Commit a101ee3

Browse files
committed
Little refactoring
1 parent b35a614 commit a101ee3

File tree

4 files changed

+12
-34
lines changed

4 files changed

+12
-34
lines changed

utbot-framework-api/src/main/kotlin/org/utbot/framework/plugin/api/util/SpringModelUtils.kt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package org.utbot.framework.plugin.api.util
22

3+
import org.utbot.framework.plugin.api.BuiltinClassId
34
import org.utbot.framework.plugin.api.ClassId
45
import org.utbot.framework.plugin.api.MethodId
56
import org.utbot.framework.plugin.api.SpringRepositoryId
@@ -10,9 +11,15 @@ import org.utbot.framework.plugin.api.UtPrimitiveModel
1011
import org.utbot.framework.plugin.api.UtSpringContextModel
1112

1213
object SpringModelUtils {
14+
val autowiredClassId = ClassId("org.springframework.beans.factory.annotation.Autowired")
15+
1316
val applicationContextClassId = ClassId("org.springframework.context.ApplicationContext")
1417
val crudRepositoryClassId = ClassId("org.springframework.data.repository.CrudRepository")
1518

19+
val springBootTestClassId = ClassId("org.springframework.boot.test.context.SpringBootTest")
20+
val dirtiesContextClassId = ClassId("org.springframework.test.annotation.DirtiesContext")
21+
val dirtiesContextClassModeClassId = ClassId("org.springframework.test.annotation.DirtiesContext.ClassMode")
22+
1623
val getBeanMethodId = MethodId(
1724
classId = applicationContextClassId,
1825
name = "getBean",

utbot-framework/src/main/kotlin/org/utbot/framework/codegen/domain/builtin/SpringBuiltins.kt

Lines changed: 0 additions & 23 deletions
This file was deleted.

utbot-framework/src/main/kotlin/org/utbot/framework/codegen/tree/CgAbstractSpringTestClassConstructor.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
package org.utbot.framework.codegen.tree
22

33
import org.utbot.framework.codegen.domain.builtin.TestClassUtilMethodProvider
4-
import org.utbot.framework.codegen.domain.builtin.autowiredClassId
54
import org.utbot.framework.codegen.domain.builtin.injectMocksClassId
65
import org.utbot.framework.codegen.domain.builtin.mockClassId
76
import org.utbot.framework.codegen.domain.context.CgContext
@@ -19,6 +18,7 @@ import org.utbot.framework.codegen.domain.models.CgVariable
1918
import org.utbot.framework.codegen.domain.models.SpringTestClassModel
2019
import org.utbot.framework.codegen.domain.models.builders.TypedModelWrappers
2120
import org.utbot.framework.plugin.api.ClassId
21+
import org.utbot.framework.plugin.api.util.SpringModelUtils.autowiredClassId
2222
import org.utbot.framework.plugin.api.util.id
2323
import java.lang.Exception
2424

utbot-framework/src/main/kotlin/org/utbot/framework/codegen/tree/CgSpringIntegrationTestClassConstructor.kt

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,15 @@
11
package org.utbot.framework.codegen.tree
22

3-
import org.utbot.framework.codegen.domain.builtin.autowiredClassId
4-
import org.utbot.framework.codegen.domain.builtin.dirtiesContextClassId
5-
import org.utbot.framework.codegen.domain.builtin.dirtiesContextClassModeClassId
6-
import org.utbot.framework.codegen.domain.builtin.springBootTestClassId
73
import org.utbot.framework.codegen.domain.context.CgContext
8-
import org.utbot.framework.codegen.domain.models.CgAnnotation
94
import org.utbot.framework.codegen.domain.models.CgClass
105
import org.utbot.framework.codegen.domain.models.CgEnumConstantAccess
116
import org.utbot.framework.codegen.domain.models.CgFieldDeclaration
12-
import org.utbot.framework.codegen.domain.models.CgLiteral
137
import org.utbot.framework.codegen.domain.models.CgMethodsCluster
14-
import org.utbot.framework.codegen.domain.models.CgNotNullAssertion
15-
import org.utbot.framework.codegen.domain.models.CgSingleArgAnnotation
16-
import org.utbot.framework.codegen.domain.models.CgValue
178
import org.utbot.framework.codegen.domain.models.SpringTestClassModel
18-
import org.utbot.framework.plugin.api.util.stringClassId
9+
import org.utbot.framework.plugin.api.util.SpringModelUtils.autowiredClassId
10+
import org.utbot.framework.plugin.api.util.SpringModelUtils.dirtiesContextClassId
11+
import org.utbot.framework.plugin.api.util.SpringModelUtils.dirtiesContextClassModeClassId
12+
import org.utbot.framework.plugin.api.util.SpringModelUtils.springBootTestClassId
1913

2014
class CgSpringIntegrationTestClassConstructor(context: CgContext) : CgAbstractSpringTestClassConstructor(context) {
2115
override fun constructTestClass(testClassModel: SpringTestClassModel): CgClass {

0 commit comments

Comments
 (0)