@@ -37,8 +37,10 @@ import org.utbot.framework.codegen.domain.models.CgSwitchCase
3737import org.utbot.framework.codegen.domain.models.CgSwitchCaseLabel
3838import org.utbot.framework.codegen.domain.models.CgValue
3939import org.utbot.framework.codegen.domain.models.CgVariable
40+ import org.utbot.framework.codegen.services.CgNameGenerator
4041import org.utbot.framework.codegen.services.access.CgCallableAccessManager
4142import org.utbot.framework.codegen.services.access.CgCallableAccessManagerImpl
43+ import org.utbot.framework.codegen.tree.CgComponents.getNameGeneratorBy
4244import org.utbot.framework.codegen.tree.CgComponents.getVariableConstructorBy
4345import org.utbot.framework.codegen.tree.CgStatementConstructor
4446import org.utbot.framework.codegen.tree.CgStatementConstructorImpl
@@ -72,6 +74,7 @@ abstract class CgVariableConstructorComponent(val context: CgContext) :
7274 CgCallableAccessManager by CgCallableAccessManagerImpl (context),
7375 CgStatementConstructor by CgStatementConstructorImpl (context) {
7476
77+ val nameGenerator: CgNameGenerator = getNameGeneratorBy(context)
7578 val variableConstructor: CgVariableConstructor by lazy { getVariableConstructorBy(context) }
7679
7780 fun mockitoArgumentMatchersFor (executable : ExecutableId ): Array <CgMethodCall > =
@@ -220,7 +223,7 @@ private class MockitoStaticMocker(context: CgContext, private val mocker: Object
220223
221224 val mockClassCounter = CgDeclaration (
222225 atomicIntegerClassId,
223- variableConstructor.constructVarName (MOCK_CLASS_COUNTER_NAME ),
226+ nameGenerator.variableName (MOCK_CLASS_COUNTER_NAME ),
224227 CgConstructorCall (ConstructorId (atomicIntegerClassId, emptyList()), emptyList())
225228 )
226229 + mockClassCounter
@@ -241,7 +244,7 @@ private class MockitoStaticMocker(context: CgContext, private val mocker: Object
241244 )
242245 val mockedConstructionDeclaration = CgDeclaration (
243246 MockitoStaticMocking .mockedConstructionClassId,
244- variableConstructor.constructVarName (MOCKED_CONSTRUCTION_NAME ),
247+ nameGenerator.variableName (MOCKED_CONSTRUCTION_NAME ),
245248 mockConstructionInitializer
246249 )
247250 resources + = mockedConstructionDeclaration
@@ -300,7 +303,7 @@ private class MockitoStaticMocker(context: CgContext, private val mocker: Object
300303 mockedStaticForMethods.getOrPut(classId) {
301304 val modelClass = getClassOf(classId)
302305 val classMockStaticCall = mockStatic(modelClass)
303- val mockedStaticVariableName = variableConstructor.constructVarName (MOCKED_STATIC_NAME )
306+ val mockedStaticVariableName = nameGenerator.variableName (MOCKED_STATIC_NAME )
304307 CgDeclaration (
305308 MockitoStaticMocking .mockedStaticClassId,
306309 mockedStaticVariableName,
@@ -319,11 +322,11 @@ private class MockitoStaticMocker(context: CgContext, private val mocker: Object
319322 ): CgMethodCall {
320323 val mockParameter = variableConstructor.declareParameter(
321324 classId,
322- variableConstructor.constructVarName (classId.simpleName, isMock = true )
325+ nameGenerator.variableName (classId.simpleName, isMock = true )
323326 )
324327 val contextParameter = variableConstructor.declareParameter(
325328 mockedConstructionContextClassId,
326- variableConstructor.constructVarName (" context" )
329+ nameGenerator.variableName (" context" )
327330 )
328331
329332 val caseLabels = mutableListOf<CgSwitchCaseLabel >()
0 commit comments