Skip to content

Commit 662763b

Browse files
authored
Field modifiers correction in Spring generated test classes #2325 (#2377)
Correct field modifiers and locate setUp and tearDown methods under test methods
1 parent e6abd33 commit 662763b

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

utbot-framework/src/main/kotlin/org/utbot/framework/codegen/domain/models/CgElement.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ class CgFieldDeclaration(
173173
val ownerClassId: ClassId,
174174
val declaration: CgDeclaration,
175175
val annotation: CgAnnotation? = null,
176-
val visibility: VisibilityModifier = VisibilityModifier.PUBLIC,
176+
val visibility: VisibilityModifier = VisibilityModifier.PRIVATE,
177177
) : CgElement
178178

179179
/**

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,6 @@ abstract class CgAbstractSpringTestClassConstructor(context: CgContext):
3636
fields += constructClassFields(testClassModel)
3737
clearUnwantedVariableModels()
3838

39-
methodRegions += constructAdditionalMethods()
40-
4139
for ((testSetIndex, testSet) in testClassModel.methodTestSets.withIndex()) {
4240
updateCurrentExecutable(testSet.executableId)
4341
withTestSetIdScope(testSetIndex) {
@@ -50,6 +48,8 @@ abstract class CgAbstractSpringTestClassConstructor(context: CgContext):
5048
}
5149
}
5250

51+
methodRegions += constructAdditionalMethods()
52+
5353
if (currentTestClass == outerMostTestClass) {
5454
val utilEntities = collectUtilEntities()
5555
// If utilMethodProvider is TestClassUtilMethodProvider, then util entities should be declared

0 commit comments

Comments
 (0)